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]
public float LockedPryTimeModifier = 1.5f;
///
/// Maximum pressure difference before the firelock will refuse to open, in kPa.
///
[DataField, GuidebookData]
public float PressureThreshold = 20;
///
/// Maximum temperature difference before the firelock will refuse to open, in k.
///
[DataField, 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]
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
#region Client animation
///
/// The sprite state used to animate the airlock frame when the airlock opens.
///
[DataField]
public string? OpeningLightSpriteState = "opening_unlit";
///
/// The sprite state used to animate the airlock frame when the airlock closes.
///
[DataField]
public string? ClosingLightSpriteState = "closing_unlit";
///
/// Whether or not the maintenance panel on this door should be animated.
///
[DataField]
public bool AnimatePanel = true;
///
/// The sprite state used to animate the airlock panel when the airlock opens.
///
[DataField]
public string? OpeningPanelSpriteState = "panel_opening";
///
/// The sprite state used to draw when the door is closed, but the panel is open.
///
[DataField]
public string? OpenPanelSpriteState = "panel_open";
///
/// The sprite state used to animate the airlock panel when the airlock closes.
///
[DataField]
public string? ClosingPanelSpriteState = "panel_closing";
///
/// The sprite state used for the closed airlock lights.
///
[DataField]
public string? WarningLightSpriteState = "closed_unlit";
///
/// The sprite state used for the 'access denied' lights animation.
///
[DataField]
public string? DenySpriteState = "deny_unlit";
#endregion
}