EnvelopeComponent.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Content.Shared.DoAfter;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Serialization;
  5. namespace Content.Shared.Paper;
  6. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
  7. public sealed partial class EnvelopeComponent : Component
  8. {
  9. /// <summary>
  10. /// The current open/sealed/torn state of the envelope
  11. /// </summary>
  12. [ViewVariables, DataField, AutoNetworkedField]
  13. public EnvelopeState State = EnvelopeState.Open;
  14. [DataField, ViewVariables]
  15. public string SlotId = "letter_slot";
  16. /// <summary>
  17. /// Stores the current sealing/tearing doafter of the envelope
  18. /// to prevent doafter spam/prediction issues
  19. /// </summary>
  20. [DataField, ViewVariables]
  21. public DoAfterId? EnvelopeDoAfter;
  22. /// <summary>
  23. /// How long it takes to seal the envelope closed
  24. /// </summary>
  25. [DataField, ViewVariables]
  26. public TimeSpan SealDelay = TimeSpan.FromSeconds(1);
  27. /// <summary>
  28. /// How long it takes to tear open the envelope
  29. /// </summary>
  30. [DataField, ViewVariables]
  31. public TimeSpan TearDelay = TimeSpan.FromSeconds(1);
  32. /// <summary>
  33. /// The sound to play when the envelope is sealed closed
  34. /// </summary>
  35. [DataField, ViewVariables]
  36. public SoundPathSpecifier? SealSound = new SoundPathSpecifier("/Audio/Effects/packetrip.ogg");
  37. /// <summary>
  38. /// The sound to play when the envelope is torn open
  39. /// </summary>
  40. [DataField, ViewVariables]
  41. public SoundPathSpecifier? TearSound = new SoundPathSpecifier("/Audio/Effects/poster_broken.ogg");
  42. [Serializable, NetSerializable]
  43. public enum EnvelopeState : byte
  44. {
  45. Open,
  46. Sealed,
  47. Torn
  48. }
  49. }
  50. [Serializable, NetSerializable]
  51. public sealed partial class EnvelopeDoAfterEvent : SimpleDoAfterEvent
  52. {
  53. }