AirlockComponent.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using Content.Shared.DeviceLinking;
  2. using Content.Shared.Doors.Systems;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  6. namespace Content.Shared.Doors.Components;
  7. /// <summary>
  8. /// Companion component to DoorComponent that handles airlock-specific behavior -- wires, requiring power to operate, bolts, and allowing automatic closing.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  11. [Access(typeof(SharedAirlockSystem), Friend = AccessPermissions.ReadWriteExecute, Other = AccessPermissions.Read)]
  12. public sealed partial class AirlockComponent : Component
  13. {
  14. [DataField, AutoNetworkedField]
  15. public bool Powered;
  16. // Need to network airlock safety state to avoid mis-predicts when a door auto-closes as the client walks through the door.
  17. [ViewVariables(VVAccess.ReadWrite)]
  18. [DataField, AutoNetworkedField]
  19. public bool Safety = true;
  20. [ViewVariables(VVAccess.ReadWrite)]
  21. [DataField, AutoNetworkedField]
  22. public bool EmergencyAccess = false;
  23. /// <summary>
  24. /// Sound to play when the airlock emergency access is turned on.
  25. /// </summary>
  26. [DataField]
  27. public SoundSpecifier EmergencyOnSound = new SoundPathSpecifier("/Audio/Machines/airlock_emergencyon.ogg");
  28. /// <summary>
  29. /// Sound to play when the airlock emergency access is turned off.
  30. /// </summary>
  31. [DataField]
  32. public SoundSpecifier EmergencyOffSound = new SoundPathSpecifier("/Audio/Machines/airlock_emergencyoff.ogg");
  33. /// <summary>
  34. /// Pry modifier for a powered airlock.
  35. /// Most anything that can pry powered has a pry speed bonus,
  36. /// so this default is closer to 6 effectively on e.g. jaws (9 seconds when applied to other default.)
  37. /// </summary>
  38. [DataField]
  39. public float PoweredPryModifier = 9f;
  40. /// <summary>
  41. /// Whether the maintenance panel should be visible even if the airlock is opened.
  42. /// </summary>
  43. [DataField]
  44. public bool OpenPanelVisible = false;
  45. /// <summary>
  46. /// Whether the airlock should stay open if the airlock was clicked.
  47. /// If the airlock was bumped into it will still auto close.
  48. /// </summary>
  49. [DataField]
  50. public bool KeepOpenIfClicked = false;
  51. /// <summary>
  52. /// Whether the airlock should auto close. This value is reset every time the airlock closes.
  53. /// </summary>
  54. [DataField, AutoNetworkedField]
  55. public bool AutoClose = true;
  56. /// <summary>
  57. /// Delay until an open door automatically closes.
  58. /// </summary>
  59. [DataField]
  60. public TimeSpan AutoCloseDelay = TimeSpan.FromSeconds(5f);
  61. /// <summary>
  62. /// Multiplicative modifier for the auto-close delay. Can be modified by hacking the airlock wires. Setting to
  63. /// zero will disable auto-closing.
  64. /// </summary>
  65. [ViewVariables(VVAccess.ReadWrite)]
  66. public float AutoCloseDelayModifier = 1.0f;
  67. /// <summary>
  68. /// The receiver port for turning off automatic closing.
  69. /// </summary>
  70. [DataField(customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
  71. public string AutoClosePort = "AutoClose";
  72. #region Graphics
  73. /// <summary>
  74. /// Whether the door lights should be visible.
  75. /// </summary>
  76. [DataField]
  77. public bool OpenUnlitVisible = false;
  78. /// <summary>
  79. /// Whether the door should display emergency access lights.
  80. /// </summary>
  81. [DataField]
  82. public bool EmergencyAccessLayer = true;
  83. /// <summary>
  84. /// Whether or not to animate the panel when the door opens or closes.
  85. /// </summary>
  86. [DataField]
  87. public bool AnimatePanel = true;
  88. /// <summary>
  89. /// The sprite state used to animate the airlock frame when the airlock opens.
  90. /// </summary>
  91. [DataField]
  92. public string OpeningSpriteState = "opening_unlit";
  93. /// <summary>
  94. /// The sprite state used to animate the airlock panel when the airlock opens.
  95. /// </summary>
  96. [DataField]
  97. public string OpeningPanelSpriteState = "panel_opening";
  98. /// <summary>
  99. /// The sprite state used to animate the airlock frame when the airlock closes.
  100. /// </summary>
  101. [DataField]
  102. public string ClosingSpriteState = "closing_unlit";
  103. /// <summary>
  104. /// The sprite state used to animate the airlock panel when the airlock closes.
  105. /// </summary>
  106. [DataField]
  107. public string ClosingPanelSpriteState = "panel_closing";
  108. /// <summary>
  109. /// The sprite state used for the open airlock lights.
  110. /// </summary>
  111. [DataField]
  112. public string OpenSpriteState = "open_unlit";
  113. /// <summary>
  114. /// The sprite state used for the closed airlock lights.
  115. /// </summary>
  116. [DataField]
  117. public string ClosedSpriteState = "closed_unlit";
  118. /// <summary>
  119. /// The sprite state used for the 'access denied' lights animation.
  120. /// </summary>
  121. [DataField]
  122. public string DenySpriteState = "deny_unlit";
  123. /// <summary>
  124. /// How long the animation played when the airlock denies access is in seconds.
  125. /// </summary>
  126. [DataField]
  127. public float DenyAnimationTime = 0.3f;
  128. /// <summary>
  129. /// Pry modifier for a bolted airlock.
  130. /// Currently only zombies can pry bolted airlocks.
  131. /// </summary>
  132. [DataField]
  133. public float BoltedPryModifier = 3f;
  134. #endregion Graphics
  135. }