]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup: Use ``SoundSpecifier`` instead of string literals in ``EyeClosingComponent...
authorWinkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Mon, 24 Feb 2025 16:10:23 +0000 (19:10 +0300)
committerGitHub <noreply@github.com>
Mon, 24 Feb 2025 16:10:23 +0000 (17:10 +0100)
* Cleanup

* Update

* Update

* Update

Content.Shared/Eye/Blinding/Components/EyeClosingComponent.cs
Resources/Prototypes/SoundCollections/eyes.yml [new file with mode: 0644]

index c687e9668878f98125a7b8894e0e2f0e65ba7265..b4b5d36a252cd83a8599e98b1a6c8d15f73b7e47 100644 (file)
@@ -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
 {
+    /// <summary>
+    /// Default eyes opening sound.
+    /// </summary>
+    private static readonly ProtoId<SoundCollectionPrototype> DefaultEyeOpen = new("EyeOpen");
+
+    /// <summary>
+    /// Default eyes closing sound.
+    /// </summary>
+    private static readonly ProtoId<SoundCollectionPrototype> DefaultEyeClose = new("EyeClose");
+
     /// <summary>
     /// The prototype to grant to enable eye-toggling action.
     /// </summary>
@@ -25,16 +34,16 @@ public sealed partial class EyeClosingComponent : Component
     public EntityUid? EyeToggleActionEntity;
 
     /// <summary>
-    /// Path to sound to play when opening eyes
+    /// Sound to play when opening eyes.
     /// </summary>
     [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
-    public string EyeOpenSound = "/Audio/Effects/eye_open.ogg";
+    public SoundSpecifier EyeOpenSound = new SoundCollectionSpecifier(DefaultEyeOpen);
 
     /// <summary>
-    /// Path to sound to play when closing eyes
+    /// Sound to play when closing eyes.
     /// </summary>
     [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
-    public string EyeCloseSound = "/Audio/Effects/eye_close.ogg";
+    public SoundSpecifier EyeCloseSound = new SoundCollectionSpecifier(DefaultEyeClose);
 
     /// <summary>
     /// 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 (file)
index 0000000..fe3eb20
--- /dev/null
@@ -0,0 +1,9 @@
+- type: soundCollection
+  id: EyeOpen
+  files:
+  - /Audio/Effects/eye_open.ogg
+
+- type: soundCollection
+  id: EyeClose
+  files:
+  - /Audio/Effects/eye_close.ogg