FirelockComponent.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using Content.Shared.Guidebook;
  2. using Robust.Shared.GameStates;
  3. namespace Content.Shared.Doors.Components
  4. {
  5. /// <summary>
  6. /// Companion component to <see cref="DoorComponent"/> that handles firelock-specific behavior, including
  7. /// auto-closing on depressurization, air/fire alarm interactions, and preventing normal door functions when
  8. /// retaining pressure..
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  11. public sealed partial class FirelockComponent : Component
  12. {
  13. #region Settings
  14. /// <summary>
  15. /// Pry time modifier to be used when the firelock is currently closed due to fire or pressure.
  16. /// </summary>
  17. /// <returns></returns>
  18. [DataField("lockedPryTimeModifier"), ViewVariables(VVAccess.ReadWrite)]
  19. public float LockedPryTimeModifier = 1.5f;
  20. /// <summary>
  21. /// Maximum pressure difference before the firelock will refuse to open, in kPa.
  22. /// </summary>
  23. [DataField("pressureThreshold"), ViewVariables(VVAccess.ReadWrite)]
  24. [GuidebookData]
  25. public float PressureThreshold = 20;
  26. /// <summary>
  27. /// Maximum temperature difference before the firelock will refuse to open, in k.
  28. /// </summary>
  29. [DataField("temperatureThreshold"), ViewVariables(VVAccess.ReadWrite)]
  30. [GuidebookData]
  31. public float TemperatureThreshold = 330;
  32. // this used to check for hot-spots, but because accessing that data is a a mess this now just checks
  33. // temperature. This does mean a cold room will trigger hot-air pop-ups
  34. /// <summary>
  35. /// If true, and if this door has an <see cref="AtmosAlarmableComponent"/>, then it will only auto-close if the
  36. /// alarm is set to danger.
  37. /// </summary>
  38. [DataField("alarmAutoClose"), ViewVariables(VVAccess.ReadWrite)]
  39. public bool AlarmAutoClose = true;
  40. /// <summary>
  41. /// The cooldown duration before a firelock can automatically close due to a hazardous environment after it has
  42. /// been pried open. Measured in seconds.
  43. /// </summary>
  44. [DataField]
  45. public TimeSpan EmergencyCloseCooldownDuration = TimeSpan.FromSeconds(2);
  46. #endregion
  47. #region Set by system
  48. /// <summary>
  49. /// When the firelock will be allowed to automatically close again due to a hazardous environment.
  50. /// </summary>
  51. [DataField]
  52. public TimeSpan? EmergencyCloseCooldown;
  53. /// <summary>
  54. /// Whether the firelock can open, or is locked due to its environment.
  55. /// </summary>
  56. public bool IsLocked => Pressure || Temperature;
  57. /// <summary>
  58. /// Whether the firelock is holding back a hazardous pressure.
  59. /// </summary>
  60. [DataField, AutoNetworkedField]
  61. public bool Pressure;
  62. /// <summary>
  63. /// Whether the firelock is holding back extreme temperatures.
  64. /// </summary>
  65. [DataField, AutoNetworkedField]
  66. public bool Temperature;
  67. /// <summary>
  68. /// Whether the airlock is powered.
  69. /// </summary>
  70. [DataField, AutoNetworkedField]
  71. public bool Powered;
  72. #endregion
  73. }
  74. }