From f4fab85e3478a8a93136eff2263bb60ebe3dc5d6 Mon Sep 17 00:00:00 2001 From: Winkarst <74284083+Winkarst-cpu@users.noreply.github.com> Date: Mon, 24 Feb 2025 19:10:23 +0300 Subject: [PATCH] Cleanup: Use ``SoundSpecifier`` instead of string literals in ``EyeClosingComponent`` (#35425) * Cleanup * Update * Update * Update --- .../Components/EyeClosingComponent.cs | 21 +++++++++++++------ .../Prototypes/SoundCollections/eyes.yml | 9 ++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 Resources/Prototypes/SoundCollections/eyes.yml diff --git a/Content.Shared/Eye/Blinding/Components/EyeClosingComponent.cs b/Content.Shared/Eye/Blinding/Components/EyeClosingComponent.cs index c687e96688..b4b5d36a25 100644 --- a/Content.Shared/Eye/Blinding/Components/EyeClosingComponent.cs +++ b/Content.Shared/Eye/Blinding/Components/EyeClosingComponent.cs @@ -1,7 +1,6 @@ -using Content.Shared.Eye.Blinding.Systems; +using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; -using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Shared.Eye.Blinding.Components; @@ -12,6 +11,16 @@ namespace Content.Shared.Eye.Blinding.Components; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] public sealed partial class EyeClosingComponent : Component { + /// + /// Default eyes opening sound. + /// + private static readonly ProtoId DefaultEyeOpen = new("EyeOpen"); + + /// + /// Default eyes closing sound. + /// + private static readonly ProtoId DefaultEyeClose = new("EyeClose"); + /// /// The prototype to grant to enable eye-toggling action. /// @@ -25,16 +34,16 @@ public sealed partial class EyeClosingComponent : Component public EntityUid? EyeToggleActionEntity; /// - /// Path to sound to play when opening eyes + /// Sound to play when opening eyes. /// [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] - public string EyeOpenSound = "/Audio/Effects/eye_open.ogg"; + public SoundSpecifier EyeOpenSound = new SoundCollectionSpecifier(DefaultEyeOpen); /// - /// Path to sound to play when closing eyes + /// Sound to play when closing eyes. /// [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] - public string EyeCloseSound = "/Audio/Effects/eye_close.ogg"; + public SoundSpecifier EyeCloseSound = new SoundCollectionSpecifier(DefaultEyeClose); /// /// Toggles whether the eyes are open or closed. This is really just exactly what it says on the tin. Honest. diff --git a/Resources/Prototypes/SoundCollections/eyes.yml b/Resources/Prototypes/SoundCollections/eyes.yml new file mode 100644 index 0000000000..fe3eb20ffd --- /dev/null +++ b/Resources/Prototypes/SoundCollections/eyes.yml @@ -0,0 +1,9 @@ +- type: soundCollection + id: EyeOpen + files: + - /Audio/Effects/eye_open.ogg + +- type: soundCollection + id: EyeClose + files: + - /Audio/Effects/eye_close.ogg