2024-05-22 11:16:20 +00:00
|
|
|
using Robust.Shared.GameStates;
|
2020-08-19 12:23:42 +02:00
|
|
|
|
2023-05-06 17:54:36 +12:00
|
|
|
namespace Content.Shared.Doors.Components
|
2020-08-19 12:23:42 +02:00
|
|
|
{
|
2021-02-12 07:02:14 -08:00
|
|
|
/// <summary>
|
2022-09-06 17:55:33 +12:00
|
|
|
/// Companion component to <see cref="DoorComponent"/> that handles firelock-specific behavior, including
|
|
|
|
|
/// auto-closing on depressurization, air/fire alarm interactions, and preventing normal door functions when
|
|
|
|
|
/// retaining pressure..
|
2021-02-12 07:02:14 -08:00
|
|
|
/// </summary>
|
2024-05-22 11:16:20 +00:00
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class FirelockComponent : Component
|
2020-08-19 12:23:42 +02:00
|
|
|
{
|
2024-05-22 11:16:20 +00:00
|
|
|
#region Settings
|
|
|
|
|
|
2021-08-02 04:57:06 -07:00
|
|
|
/// <summary>
|
|
|
|
|
/// Pry time modifier to be used when the firelock is currently closed due to fire or pressure.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2022-09-06 17:55:33 +12:00
|
|
|
[DataField("lockedPryTimeModifier"), ViewVariables(VVAccess.ReadWrite)]
|
2021-08-02 04:57:06 -07:00
|
|
|
public float LockedPryTimeModifier = 1.5f;
|
2020-08-19 12:23:42 +02:00
|
|
|
|
2022-09-06 17:55:33 +12:00
|
|
|
/// <summary>
|
|
|
|
|
/// Maximum pressure difference before the firelock will refuse to open, in kPa.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("pressureThreshold"), ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public float PressureThreshold = 20;
|
2020-11-20 16:58:06 +02:00
|
|
|
|
2022-11-09 08:55:45 +13:00
|
|
|
/// <summary>
|
|
|
|
|
/// Maximum temperature difference before the firelock will refuse to open, in k.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("temperatureThreshold"), ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public float TemperatureThreshold = 330;
|
|
|
|
|
// this used to check for hot-spots, but because accessing that data is a a mess this now just checks
|
|
|
|
|
// temperature. This does mean a cold room will trigger hot-air pop-ups
|
|
|
|
|
|
2022-09-06 17:55:33 +12:00
|
|
|
/// <summary>
|
|
|
|
|
/// If true, and if this door has an <see cref="AtmosAlarmableComponent"/>, then it will only auto-close if the
|
|
|
|
|
/// alarm is set to danger.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("alarmAutoClose"), ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public bool AlarmAutoClose = true;
|
2024-05-22 11:16:20 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The cooldown duration before a firelock can automatically close due to a hazardous environment after it has
|
|
|
|
|
/// been pried open. Measured in seconds.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public TimeSpan EmergencyCloseCooldownDuration = TimeSpan.FromSeconds(2);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Set by system
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// When the firelock will be allowed to automatically close again due to a hazardous environment.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public TimeSpan? EmergencyCloseCooldown;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the firelock can open, or is locked due to its environment.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsLocked => Pressure || Temperature;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the firelock is holding back a hazardous pressure.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool Pressure;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the firelock is holding back extreme temperatures.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool Temperature;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the airlock is powered.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool Powered;
|
|
|
|
|
|
|
|
|
|
#endregion
|
2020-08-19 12:23:42 +02:00
|
|
|
}
|
|
|
|
|
}
|