-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Security Hailer #37646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lanedon
wants to merge
135
commits into
space-wizards:master
Choose a base branch
from
Lanedon:sec-hail-merge
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Security Hailer #37646
Changes from 32 commits
Commits
Show all changes
135 commits
Select commit
Hold shift + click to select a range
216f9fd
Created / modified needed files
fccaa56
Added custom action event
ed1c788
Added events on System, added properties to Component, added special …
0fb29d8
Switched to a sharedsystem and a server one for ic chat use
4f37c8a
Tests on server side
dc0ddec
Exclamation code
27ae216
added localization file
46f7896
Added ALL files for now with copyright, will need to remove some for …
88d3262
trying audio stuff...
793977a
Basic sound + IC chat working
b068fb7
Updated SharedToolSystem to have ScrewQuality and updates references …
258953f
Began interaction with tools
f1e3b75
Screwed this up (literally)
Lanedon c270034
Made the mask skip the transformation of the chat message (and broke …
Lanedon 34445e5
Wirecutting WIP
Lanedon 2a4f3cc
Added ALL of the sounds, which is NOT what should be in the final PR.…
Lanedon 00a1e01
Avoid the wearer being exclamated at
Lanedon 65c1024
Added demo video for the forums
Lanedon 2745699
Changed some audio
Lanedon 4d0fccf
Finished cutting
Lanedon 1e915dd
Added popup when screwing it
Lanedon a93b017
Emag interaction and OnExamine stuff
Lanedon 63047ec
Remove actions if the mask is pulled down
Lanedon 4e9e8eb
Trying to merge, fix conflicts and removed demo video
Lanedon dc51354
Remove useless ftl file
Lanedon 4a5aff0
Added ERT / HOS hailer. ERT have special lines. HOS has an exemption …
Lanedon 67917e9
fix of ftl
Lanedon c4b56ba
fixed some uses of the new public stirng ScrewingQuality
Lanedon 4af5434
credits stuff
Lanedon dfb95ef
Changed where action is stored and added a WIP icon for the hail
Lanedon 4aeeef5
bugfix
Lanedon dd23f59
quickfix YAML
Lanedon 8184921
Removed the "trans" out of nanotrasen (word typo, don't freak)
Lanedon a639999
Add some comments to hails.ftl for clarity
Lanedon 4b5f4cf
rearranged some audio and ftl files to be more in line with aggressio…
Lanedon fe0bef2
Remove some meh voicelines (will include in audio post to compare)
Lanedon 4b7433c
Used localization support for enums as reviewed
Lanedon e13f721
Changed some speaker name for ERT and lowercased the normal one
Lanedon 9791d01
Add some DoAfter for the cutting
Lanedon 02929e2
Putting warnings when others do something to your mask [Not working]
Lanedon 0ac10ae
Merge branch 'sec-hail-merge' of https://github.com/Lanedon/space-sta…
Lanedon fa0d021
fix
Lanedon e88aa52
finished doAfter, abandonned interacting with someone else mask becau…
Lanedon b4f9133
Added verb interaction
Lanedon 5217665
Goofin around with access
Lanedon bd051db
Added access check to the verb action
Lanedon b655d75
Forgor the SWAT mask :(
Lanedon 4810ab7
Added real cooldown
Lanedon 8a888a2
Added some verb cooldown and some sound variations for the beeps
Lanedon d0b8c1b
FUCK
Lanedon 31259f2
Did a oopsie in yaml + error sound is LOUD
Lanedon c620b7b
More oopsies
Lanedon 9085e11
Added a really bad looksing wire cutted swat mask visual
Lanedon d6fb110
Moving playing the voiceline to Shared for prediction ?
Lanedon 444325a
Cleanup
Lanedon 90228e6
typo
Lanedon b61c35a
Bugfix + Cleaning
Lanedon 89d171d
CLEAN CLEAN CLEAN
Lanedon b6e4023
added copyright
Lanedon 80818c0
Attributions fix + forgor a sound
Lanedon 21ff0f4
I HATE VISUAL STUDIO I HATE VISUAL STUDIO I HATE VISUAL STUDIO
Lanedon 75e3fc4
deleting ALL audio NYAHAHAHA
Lanedon 032b010
Adding all back without first letter capitalization
Lanedon 179132c
Pleasing the YAML gods
Lanedon 63baa10
deleting because formatting
Lanedon 5337275
adding again...
Lanedon 9afdb37
fix: file-scoped namespaces
Lanedon 0972939
Making User nullable
Lanedon 50d6582
Localized chat name
Lanedon 822c297
Added attributes + moved enums out of component
Lanedon 7b32837
fixing previous commit's errors
Lanedon f8de898
Redoing replacement sounds, WIP
Lanedon 2766b99
solution for sound replacement for HOS
Lanedon 2f9f746
Datafields + documentation
Lanedon 56dec09
primary constructor
Lanedon ac208b5
Undoing the primary constructor
Lanedon 84d481a
changed enum to ToolQualityPrototype
Lanedon 599c0eb
fix use delay
Lanedon 5bb64e3
Merge branch 'space-wizards:master' into sec-hail-merge
Lanedon a46acc8
Trying stuff for linter, dont mind me
Lanedon 5947cfb
Hmmm
Lanedon b33c0ef
Merge branch 'master' into sec-hail-merge
Lanedon 996b27d
Fix YAML Linter
Lanedon e39fb3c
Merge branch 'space-wizards:master' into sec-hail-merge
Lanedon 9effc4d
Added platform for handle in attributions
Lanedon af3ced2
Merge branch 'space-wizards:master' into sec-hail-merge
Lanedon 1013b28
Refactor part 1
Lanedon e803ba7
YAML / Component changes
Lanedon 5337606
BUI
Lanedon 12c4ec1
BUI is love, BUI is life
Lanedon e535878
Feeding BUI + ItemGrantAction
Lanedon b4cdf5e
cancel the UI is mask is pulled down
Lanedon 93a6274
BUI stuff
Lanedon c8323f8
Interactions with tools
Lanedon ee86a3f
Spirte stuff
Lanedon 6a0bccb
Emag interaction (not complete)
Lanedon 20b66df
New sounds
Lanedon 889d5d9
Remove metadata
Lanedon bd94799
Reorganisation
Lanedon be553d7
Updated attributions
Lanedon 81f457b
Emag Interaction
Lanedon b4a5a2b
Emag, icons, descriptions
Lanedon 30953f0
ERT + Clean up code/comments
Lanedon fc96f87
Remove error.ogg sound, was too long and too disruptive
Lanedon 9a13363
Add dirty to cooldown timer
Lanedon 989a05a
Applied to SWAT mask
Lanedon c5259a0
Merge branch 'master' into sec-hail-merge
Lanedon de1a3da
Codebase change broke my BUI :(
Lanedon aa2fcfe
Merge branch 'space-wizards:master' into sec-hail-merge
Lanedon 0aa65cb
Changed audio
Lanedon eec3506
Trying predicted in shared
Lanedon 2175153
Prediction + networking AreWiresCut
Lanedon 7d89949
Merge branch 'master' into sec-hail-merge
Lanedon 82c0ddd
chat system in shared + prediction for popup
Lanedon 195dd35
Made the text go bold again
Lanedon 5edf18a
First step towards a working radial menu
Lanedon 34fa37b
Minor changes to locale and file replacement
Lanedon fad059d
Finished radio menu
Lanedon eaa96a3
Added voiceline sound handling to server since Robust Random is used
Lanedon 814cc77
Added SpeechComponent to hailer and made the hailer says the IC chat …
Lanedon 66477e8
some event handling
Lanedon f0d51c1
Testing removing chat code
Lanedon be7fb69
Fixed loc string
Lanedon e538c9b
Fixed chat system interaction, no more modifying chat system
Lanedon 4c4b028
SpeechComp for ALL !
Lanedon 86a21d0
Audio changes for ERT, file renaming
Lanedon a4293f0
Typo
Lanedon 595323e
Halt audio change
Lanedon e292901
Tidying up code
Lanedon 2a58cc2
Attributions cleanup
Lanedon 179212e
whitespace
Lanedon 2bc98cc
revert fuckup
Lanedon 0d32c7a
Make deathsquad gasmask not inherit ERT gas mask
Lanedon 12b374c
YAML tidying
Lanedon 91e39f7
Merge branch 'sec-hail-merge' of https://github.com/Lanedon/space-sta…
Lanedon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
Content.Server/Clothing/Systems/SecurityHailerSystem.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| using Content.Shared.Clothing.ActionEvent; | ||
| using Content.Shared.Clothing.Components; | ||
| using Content.Shared.Clothing.EntitySystems; | ||
| using Content.Server.Chat.Systems; | ||
| using Robust.Server.Audio; | ||
| using Robust.Shared.Audio; | ||
| using Content.Shared.Emag.Components; | ||
|
|
||
| namespace Content.Server.Clothing.Systems | ||
| { | ||
| public sealed class SecurityHailerSystem : SharedSecurityHailerSystem | ||
| { | ||
| [Dependency] private readonly ChatSystem _chat = default!; | ||
| [Dependency] private readonly AudioSystem _audio = default!; | ||
| private readonly (string, string) _replaceLineHos = ("hail-high-8", "hail-high-HOS"); //the line to replace if a HOS gas mask hails | ||
|
|
||
| public override void Initialize() | ||
| { | ||
| base.Initialize(); | ||
| SubscribeLocalEvent<SecurityHailerComponent, ActionSecHailerActionEvent>(OnHailOrder); | ||
| } | ||
|
|
||
| private void OnHailOrder(Entity<SecurityHailerComponent> ent, ref ActionSecHailerActionEvent ev) | ||
| { | ||
| //If the event is already handled | ||
| if (ev.Handled) | ||
| return; | ||
|
|
||
| //Put the exclamations mark around people at the distance specified in the comp side | ||
| //Just like a whistle | ||
| bool exclamationHandled = base.ExclamateHumanoidsAround(ent); | ||
|
|
||
| //Play the damn sound | ||
| int index = PlaySoundEffect(ent); // index gotten from AudioSystem.ResolveSound() of the sound chosen in the soundcollection (Basically, which random line is playing ?) | ||
| bool chatHandled = SayChatMessage(ent, ev, index); | ||
|
|
||
| //If both exclamation and chat were done, we handled it yay ! | ||
| ev.Handled = exclamationHandled && chatHandled; | ||
| } | ||
|
|
||
| private bool SayChatMessage(Entity<SecurityHailerComponent> ent, ActionSecHailerActionEvent ev, int index) | ||
| { | ||
| string ftlLine = GetTheCorrectLine(ent, index); | ||
| if (IsVoiceReplaced(ent, index)) //This is some bandaid code, replace it omg | ||
| ftlLine = _replaceLineHos.Item2; | ||
|
|
||
| //Make a chat line with the sec hailer as speaker, in bold and UPPERCASE for added impact | ||
| _chat.TrySendInGameICMessage(ev.Performer, Loc.GetString(ftlLine).ToUpper(), InGameICChatType.Speak, hideChat: false, hideLog: true, nameOverride: ent.Comp.ChatName, | ||
| checkRadioPrefix: false, ignoreActionBlocker: true, skipTransform: true); | ||
| return true; | ||
| } | ||
|
|
||
| private int PlaySoundEffect(Entity<SecurityHailerComponent> ent) | ||
| { | ||
| var (uid, comp) = ent; | ||
|
|
||
| SoundSpecifier currentSpecifier; | ||
| if (comp.SpecialCircumtance == SecurityHailerComponent.SpecialUseCase.ERT) | ||
| currentSpecifier = comp.ERTAggressionSounds; | ||
| else if (HasComp<EmaggedComponent>(ent)) | ||
| currentSpecifier = ent.Comp.EmagAggressionSounds; | ||
| else | ||
| { | ||
| currentSpecifier = comp.AggresionLevel switch | ||
| { | ||
| SecurityHailerComponent.AggresionState.Medium => comp.MediumAggressionSounds, | ||
| SecurityHailerComponent.AggresionState.High => comp.HighAggressionSounds, | ||
| _ => comp.LowAggressionSounds, | ||
| }; | ||
| } | ||
| var resolver = _audio.ResolveSound(currentSpecifier); | ||
| if (resolver is not ResolvedCollectionSpecifier collectionResolver) | ||
| return -1; | ||
|
|
||
| if (IsVoiceReplaced(ent, collectionResolver.Index)) | ||
| { | ||
| collectionResolver = (ResolvedCollectionSpecifier)_audio.ResolveSound(comp.HOSReplaceSounds); //add a check ? What to do if multiple in future ? | ||
| } | ||
|
|
||
| _audio.PlayPvs(resolver, ent.Owner, audioParams: new AudioParams().WithVolume(-3f)); | ||
|
|
||
| return collectionResolver.Index; | ||
| } | ||
|
|
||
| private bool IsVoiceReplaced(Entity<SecurityHailerComponent> ent, int index) | ||
| { | ||
| if (ent.Comp.SpecialCircumtance == SecurityHailerComponent.SpecialUseCase.HOS && GetTheCorrectLine(ent, index) == _replaceLineHos.Item1) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| private string GetTheCorrectLine(Entity<SecurityHailerComponent> ent, int index) | ||
| { | ||
| string finalLine = String.Empty; | ||
| if (HasComp<EmaggedComponent>(ent)) | ||
| finalLine = $"hail-emag-{index}"; | ||
| else if (ent.Comp.SpecialCircumtance == SecurityHailerComponent.SpecialUseCase.ERT) | ||
| finalLine = $"hail-ERT-{index}"; | ||
| else | ||
| finalLine = $"hail-{ent.Comp.AggresionLevel.ToString().ToLower()}-{index}"; | ||
|
|
||
| return finalLine; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
Content.Shared/Clothing/Components/SecurityHailerComponent.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| using Robust.Shared.Audio; | ||
| using Robust.Shared.GameStates; | ||
| using Robust.Shared.Prototypes; | ||
| using Robust.Shared.Serialization; | ||
|
|
||
|
|
||
| namespace Content.Shared.Clothing.Components | ||
| { | ||
| /// <summary> | ||
| /// Handle the hails (audible orders to stop) coming from a security gas mask / swat mask | ||
| /// </summary> | ||
| [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] | ||
| public sealed partial class SecurityHailerComponent : Component | ||
| { | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| [DataField] | ||
| public SecMaskState CurrentState = SecMaskState.Functional; | ||
|
|
||
| /// <summary> | ||
| /// Range value | ||
| /// </summary> | ||
| [DataField] | ||
| public float Distance = 0; | ||
|
|
||
| /// <summary> | ||
| /// The name displayed as the speaker when hailing orders | ||
| /// </summary> | ||
| [DataField] | ||
| public string? ChatName = "Security Hailer"; | ||
|
|
||
| /// <summary> | ||
| /// Delay when the hailer is screwed to change aggression level | ||
| /// </summary> | ||
| [DataField] | ||
| public float ScrewingDoAfterDelay = 1f; | ||
|
|
||
| public enum SpecialUseCase : byte | ||
| { | ||
| None = 0, | ||
| HOS = 1, | ||
| ERT = 2 | ||
| } | ||
Lanedon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> | ||
| /// Special use cases where some voicelines shouldn't play or we want to play some other voicelines, ex: HOS or ERT | ||
| /// </summary> | ||
| [DataField] | ||
| public SpecialUseCase SpecialCircumtance = SpecialUseCase.None; | ||
|
|
||
| /// <summary> | ||
| /// What ftl line to replace in special circumstances | ||
| /// </summary> | ||
| public Dictionary<SpecialUseCase, (string[], string[])> ReplaceVoicelinesSpecial = new() //List of Tuples | ||
| { | ||
| { SpecialUseCase.HOS, (["hail-high-8"], ["hail-high-HOS"]) }//"Take it to the HOS voice" line, make no sense if HOS | ||
| }; | ||
|
|
||
| /// <summary> | ||
| /// How aggresive are the orders coming from the hailer ? Higher means more aggressive / shitsec | ||
| /// </summary> | ||
| public enum AggresionState : byte | ||
| { | ||
| Low = 0, | ||
| Medium = 1, | ||
| High = 2 | ||
| } | ||
Lanedon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [DataField, AutoNetworkedField] | ||
| public AggresionState AggresionLevel = AggresionState.Low; | ||
|
|
||
| public SoundSpecifier LowAggressionSounds = new SoundCollectionSpecifier("SecHailLow"); | ||
| public SoundSpecifier MediumAggressionSounds = new SoundCollectionSpecifier("SecHailMedium"); | ||
| public SoundSpecifier HighAggressionSounds = new SoundCollectionSpecifier("SecHailHigh"); | ||
| public SoundSpecifier EmagAggressionSounds = new SoundCollectionSpecifier("SecHailEmag"); | ||
| public SoundSpecifier ERTAggressionSounds = new SoundCollectionSpecifier("SecHailERT"); | ||
| public SoundSpecifier HOSReplaceSounds = new SoundCollectionSpecifier("SecHailHOS"); | ||
| public SoundSpecifier ScrewedSounds = new SoundCollectionSpecifier("Screwdriver"); //From the soundcollection of tools | ||
| public SoundSpecifier CutSounds = new SoundCollectionSpecifier("Wirecutter"); //From the soundcollection of tools | ||
|
|
||
| /// <summary> | ||
| /// The action that gets displayed when the gas mask is equipped. | ||
| /// </summary> | ||
| [DataField] | ||
| public EntProtoId Action = "ActionSecHailer"; | ||
Lanedon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> | ||
| /// Reference to the action. | ||
| /// </summary> | ||
| [DataField] | ||
| public EntityUid? ActionEntity; | ||
|
|
||
| /// <summary> | ||
| /// Entity prototype to spawn when used, using the whistle one | ||
| /// </summary> | ||
| [DataField] | ||
| public EntProtoId ExclamationEffect = "WhistleExclamation"; | ||
| } | ||
|
|
||
| [Serializable, NetSerializable] | ||
| public enum SecMaskVisuals : byte | ||
| { | ||
| State | ||
| } | ||
|
|
||
| [Serializable, NetSerializable] | ||
| public enum SecMaskState : byte | ||
| { | ||
| Functional, | ||
| WiresCut | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.