Cleanup: Use `SoundSpecifier instead of string literals in EyeClosingComponent` (#35425)

* Cleanup

* Update

* Update

* Update
This commit is contained in:
Winkarst
2025-02-24 19:10:23 +03:00
committed by GitHub
parent 6fa4767b4c
commit f4fab85e34
2 changed files with 24 additions and 6 deletions

View File

@@ -1,7 +1,6 @@
using Content.Shared.Eye.Blinding.Systems; using Robust.Shared.Audio;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Eye.Blinding.Components; namespace Content.Shared.Eye.Blinding.Components;
@@ -12,6 +11,16 @@ namespace Content.Shared.Eye.Blinding.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
public sealed partial class EyeClosingComponent : Component 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> /// <summary>
/// The prototype to grant to enable eye-toggling action. /// The prototype to grant to enable eye-toggling action.
/// </summary> /// </summary>
@@ -25,16 +34,16 @@ public sealed partial class EyeClosingComponent : Component
public EntityUid? EyeToggleActionEntity; public EntityUid? EyeToggleActionEntity;
/// <summary> /// <summary>
/// Path to sound to play when opening eyes /// Sound to play when opening eyes.
/// </summary> /// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public string EyeOpenSound = "/Audio/Effects/eye_open.ogg"; public SoundSpecifier EyeOpenSound = new SoundCollectionSpecifier(DefaultEyeOpen);
/// <summary> /// <summary>
/// Path to sound to play when closing eyes /// Sound to play when closing eyes.
/// </summary> /// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public string EyeCloseSound = "/Audio/Effects/eye_close.ogg"; public SoundSpecifier EyeCloseSound = new SoundCollectionSpecifier(DefaultEyeClose);
/// <summary> /// <summary>
/// Toggles whether the eyes are open or closed. This is really just exactly what it says on the tin. Honest. /// Toggles whether the eyes are open or closed. This is really just exactly what it says on the tin. Honest.

View File

@@ -0,0 +1,9 @@
- type: soundCollection
id: EyeOpen
files:
- /Audio/Effects/eye_open.ogg
- type: soundCollection
id: EyeClose
files:
- /Audio/Effects/eye_close.ogg