using Content.Shared.Guidebook;
using Robust.Shared.GameStates;
namespace Content.Shared.Doors.Components
{
///
/// Companion component to that handles firelock-specific behavior, including
/// auto-closing on depressurization, air/fire alarm interactions, and preventing normal door functions when
/// retaining pressure..
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class FirelockComponent : Component
{
#region Settings
///
/// Pry time modifier to be used when the firelock is currently closed due to fire or pressure.
///
///
[DataField("lockedPryTimeModifier"), ViewVariables(VVAccess.ReadWrite)]
public float LockedPryTimeModifier = 1.5f;
///
/// Maximum pressure difference before the firelock will refuse to open, in kPa.
///
[DataField("pressureThreshold"), ViewVariables(VVAccess.ReadWrite)]
[GuidebookData]
public float PressureThreshold = 20;
///
/// Maximum temperature difference before the firelock will refuse to open, in k.
///
[DataField("temperatureThreshold"), ViewVariables(VVAccess.ReadWrite)]
[GuidebookData]
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
///
/// If true, and if this door has an , then it will only auto-close if the
/// alarm is set to danger.
///
[DataField("alarmAutoClose"), ViewVariables(VVAccess.ReadWrite)]
public bool AlarmAutoClose = true;
///
/// The cooldown duration before a firelock can automatically close due to a hazardous environment after it has
/// been pried open. Measured in seconds.
///
[DataField]
public TimeSpan EmergencyCloseCooldownDuration = TimeSpan.FromSeconds(2);
#endregion
#region Set by system
///
/// When the firelock will be allowed to automatically close again due to a hazardous environment.
///
[DataField]
public TimeSpan? EmergencyCloseCooldown;
///
/// Whether the firelock can open, or is locked due to its environment.
///
public bool IsLocked => Pressure || Temperature;
///
/// Whether the firelock is holding back a hazardous pressure.
///
[DataField, AutoNetworkedField]
public bool Pressure;
///
/// Whether the firelock is holding back extreme temperatures.
///
[DataField, AutoNetworkedField]
public bool Temperature;
///
/// Whether the airlock is powered.
///
[DataField, AutoNetworkedField]
public bool Powered;
#endregion
}
}