CryostorageComponent.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Serialization;
  4. namespace Content.Shared.Bed.Cryostorage;
  5. /// <summary>
  6. /// This is used for a container which, when a player logs out while inside of,
  7. /// will delete their body and redistribute their items.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent]
  10. [AutoGenerateComponentState]
  11. public sealed partial class CryostorageComponent : Component
  12. {
  13. [DataField, ViewVariables(VVAccess.ReadWrite)]
  14. public string ContainerId = "storage";
  15. /// <summary>
  16. /// How long a player can remain inside Cryostorage before automatically being taken care of, given that they have no mind.
  17. /// </summary>
  18. [DataField, ViewVariables(VVAccess.ReadWrite)]
  19. [AutoNetworkedField]
  20. public TimeSpan NoMindGracePeriod = TimeSpan.FromSeconds(30f);
  21. /// <summary>
  22. /// How long a player can remain inside Cryostorage before automatically being taken care of.
  23. /// </summary>
  24. [DataField, ViewVariables(VVAccess.ReadWrite)]
  25. [AutoNetworkedField]
  26. public TimeSpan GracePeriod = TimeSpan.FromMinutes(5f);
  27. /// <summary>
  28. /// A list of players who have actively entered cryostorage.
  29. /// </summary>
  30. [DataField]
  31. [AutoNetworkedField]
  32. public List<EntityUid> StoredPlayers = new();
  33. /// <summary>
  34. /// Sound that is played when a player is removed by a cryostorage.
  35. /// </summary>
  36. [DataField]
  37. public SoundSpecifier? RemoveSound = new SoundPathSpecifier("/Audio/Effects/teleport_departure.ogg");
  38. }
  39. [Serializable, NetSerializable]
  40. public enum CryostorageVisuals : byte
  41. {
  42. Full
  43. }
  44. [Serializable, NetSerializable]
  45. public record struct CryostorageContainedPlayerData()
  46. {
  47. /// <summary>
  48. /// The player's IC name
  49. /// </summary>
  50. public string PlayerName = string.Empty;
  51. /// <summary>
  52. /// The player's entity
  53. /// </summary>
  54. public NetEntity PlayerEnt = NetEntity.Invalid;
  55. /// <summary>
  56. /// A dictionary relating a slot definition name to the name of the item inside of it.
  57. /// </summary>
  58. public Dictionary<string, string> ItemSlots = new();
  59. /// <summary>
  60. /// A dictionary relating a hand ID to the hand name and the name of the item being held.
  61. /// </summary>
  62. public Dictionary<string, string> HeldItems = new();
  63. }
  64. [Serializable, NetSerializable]
  65. public sealed class CryostorageBuiState : BoundUserInterfaceState
  66. {
  67. public List<CryostorageContainedPlayerData> PlayerData;
  68. public CryostorageBuiState(List<CryostorageContainedPlayerData> playerData)
  69. {
  70. PlayerData = playerData;
  71. }
  72. }
  73. [Serializable, NetSerializable]
  74. public sealed class CryostorageRemoveItemBuiMessage : BoundUserInterfaceMessage
  75. {
  76. public NetEntity StoredEntity;
  77. public string Key;
  78. public RemovalType Type;
  79. public enum RemovalType : byte
  80. {
  81. Hand,
  82. Inventory
  83. }
  84. public CryostorageRemoveItemBuiMessage(NetEntity storedEntity, string key, RemovalType type)
  85. {
  86. StoredEntity = storedEntity;
  87. Key = key;
  88. Type = type;
  89. }
  90. }
  91. [Serializable, NetSerializable]
  92. public enum CryostorageUIKey : byte
  93. {
  94. Key
  95. }