* Update StationSpawningSystem.cs Web-edit to allow feeding in an existing entity. * Update StationSpawningSystem.cs value type moment * Update StationSpawningSystem.cs * Oh goddamnit this is a refactor now. * awawawa * aaaaaaaaaaa * ee * forgot records. * no records? no records. * What's in a name? * Sloth forcing me to do the refactor properly smh. * e * optional evac in test. * tests pls work * awa --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
namespace Content.Server.AlertLevel;
|
|
|
|
/// <summary>
|
|
/// Alert level component. This is the component given to a station to
|
|
/// signify its alert level state.
|
|
/// </summary>
|
|
[RegisterComponent]
|
|
public sealed class AlertLevelComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// The current set of alert levels on the station.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public AlertLevelPrototype? AlertLevels;
|
|
|
|
// Once stations are a prototype, this should be used.
|
|
[DataField("alertLevelPrototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<AlertLevelPrototype>))]
|
|
public string AlertLevelPrototype = default!;
|
|
|
|
/// <summary>
|
|
/// The current level on the station.
|
|
/// </summary>
|
|
[ViewVariables(VVAccess.ReadWrite)] public string CurrentLevel = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Is current station level can be changed by crew.
|
|
/// </summary>
|
|
[ViewVariables(VVAccess.ReadWrite)] public bool IsLevelLocked = false;
|
|
|
|
[ViewVariables] public const float Delay = 30;
|
|
|
|
[ViewVariables] public float CurrentDelay = 0;
|
|
[ViewVariables] public bool ActiveDelay;
|
|
|
|
/// <summary>
|
|
/// If the level can be selected on the station.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public bool IsSelectable
|
|
{
|
|
get
|
|
{
|
|
if (AlertLevels == null
|
|
|| !AlertLevels.Levels.TryGetValue(CurrentLevel, out var level))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return level.Selectable && !level.DisableSelection && !IsLevelLocked;
|
|
}
|
|
}
|
|
}
|