EyeClosingComponent.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  5. namespace Content.Shared.Eye.Blinding.Components;
  6. /// <summary>
  7. /// Allows mobs to toggle their eyes between being closed and being not closed.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
  10. public sealed partial class EyeClosingComponent : Component
  11. {
  12. /// <summary>
  13. /// Default eyes opening sound.
  14. /// </summary>
  15. private static readonly ProtoId<SoundCollectionPrototype> DefaultEyeOpen = new("EyeOpen");
  16. /// <summary>
  17. /// Default eyes closing sound.
  18. /// </summary>
  19. private static readonly ProtoId<SoundCollectionPrototype> DefaultEyeClose = new("EyeClose");
  20. /// <summary>
  21. /// The prototype to grant to enable eye-toggling action.
  22. /// </summary>
  23. [DataField("eyeToggleAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  24. public string EyeToggleAction = "ActionToggleEyes";
  25. /// <summary>
  26. /// The actual eye toggling action entity itself.
  27. /// </summary>
  28. [DataField]
  29. public EntityUid? EyeToggleActionEntity;
  30. /// <summary>
  31. /// Sound to play when opening eyes.
  32. /// </summary>
  33. [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
  34. public SoundSpecifier EyeOpenSound = new SoundCollectionSpecifier(DefaultEyeOpen);
  35. /// <summary>
  36. /// Sound to play when closing eyes.
  37. /// </summary>
  38. [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
  39. public SoundSpecifier EyeCloseSound = new SoundCollectionSpecifier(DefaultEyeClose);
  40. /// <summary>
  41. /// Toggles whether the eyes are open or closed. This is really just exactly what it says on the tin. Honest.
  42. /// </summary>
  43. [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
  44. public bool EyesClosed;
  45. [ViewVariables(VVAccess.ReadOnly), DataField]
  46. public bool PreviousEyelidPosition;
  47. [ViewVariables(VVAccess.ReadOnly), DataField]
  48. public bool NaturallyCreated;
  49. }