namespace Content.Server.AlertLevel;
///
/// Alert level component. This is the component given to a station to
/// signify its alert level state.
///
[RegisterComponent]
public sealed class AlertLevelComponent : Component
{
///
/// The current set of alert levels on the station.
///
[ViewVariables]
public AlertLevelPrototype? AlertLevels;
// Once stations are a prototype, this should be used.
[DataField("alertLevelPrototype")]
public string AlertLevelPrototype = default!;
///
/// The current level on the station.
///
[ViewVariables(VVAccess.ReadWrite)] public string CurrentLevel = string.Empty;
///
/// Is current station level can be changed by crew.
///
[ViewVariables(VVAccess.ReadWrite)] public bool IsLevelLocked = false;
[ViewVariables] public const float Delay = 30;
[ViewVariables] public float CurrentDelay = 0;
[ViewVariables] public bool ActiveDelay;
///
/// If the level can be selected on the station.
///
[ViewVariables]
public bool IsSelectable
{
get
{
if (AlertLevels == null
|| !AlertLevels.Levels.TryGetValue(CurrentLevel, out var level))
{
return false;
}
return level.Selectable && !level.DisableSelection && !IsLevelLocked;
}
}
}