Files
Delta-v/Content.Shared/SSDIndicator/SSDIndicatorComponent.cs
T
ed1fa64a6e feat: Recent SSD indicator, SSD time in admin overlay (#5699)
* feat: Recent SSD indicator, SSD time in admin overlay

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* tweak: remove colon from ssd time loc string

* feat: add another stage

* feat: ssd examine text

* apply suggestion: make ssdstage serializable, use proper doc comments

Co-authored-by: pathetic meowmeow <uhhadd@gmail.com>
Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me>

* apply suggestion: more compact switch, throw instead of logging if invalid stage

Co-authored-by: pathetic meowmeow <uhhadd@gmail.com>
Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me>

* apply suggestion: missing DeltaV comment

Co-authored-by: Sir Warock <67167466+SirWarock@users.noreply.github.com>
Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me>

* fix: add missing import

* refactor: remove unnecessary state-keeping

i don't remember why i did it like that

* chore: remove unused import

* refactor: don't separate comp from ent

---------

Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pathetic meowmeow <uhhadd@gmail.com>
Co-authored-by: Sir Warock <67167466+SirWarock@users.noreply.github.com>
2026-06-06 19:14:03 +00:00

94 lines
3.0 KiB
C#

using Content.Shared.CCVar;
using Content.Shared.StatusIcon;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.SSDIndicator;
/// <summary>
/// Shows status icon when an entity is SSD, based on if a player is attached or not.
/// </summary>
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState, AutoGenerateComponentPause]
public sealed partial class SSDIndicatorComponent : Component
{
/// <summary>
/// Whether or not the entity is SSD.
/// </summary>
[AutoNetworkedField]
[DataField, ViewVariables(VVAccess.ReadOnly)]
public bool IsSSD = true;
/// <summary>
/// The icon displayed next to the associated entity when it is SSD.
/// </summary>
[DataField]
public ProtoId<SsdIconPrototype> Icon = "SSDIcon";
/// <summary>
/// The time at which the entity will fall asleep, if <see cref="CCVars.ICSSDSleep"/> is true.
/// </summary>
[AutoNetworkedField, AutoPausedField]
[Access(typeof(SSDIndicatorSystem))]
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan FallAsleepTime = TimeSpan.Zero;
/// <summary>
/// The next time this component will be updated.
/// </summary>
[AutoNetworkedField, AutoPausedField]
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextUpdate = TimeSpan.Zero;
/// <summary>
/// The time between updates checking if the entity should be force slept.
/// </summary>
[DataField]
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1);
// DeltaV - SSD Recency Additions START
/// <summary>
/// The time at which the Entity became SSD.
/// </summary>
[AutoNetworkedField, AutoPausedField]
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan SsdSince = TimeSpan.Zero;
/// <summary>
/// The icon displayed next to the associated entity when it is recently SSD (stage 2).
/// </summary>
[DataField]
public ProtoId<SsdIconPrototype> RecentIcon = "RecentSSDIcon";
/// <summary>
/// The icon displayed next to the associated entity when it is very recently SSD (stage 1).
/// </summary>
[DataField]
public ProtoId<SsdIconPrototype> VeryRecentIcon = "VeryRecentSSDIcon";
// DeltaV END
}
// DeltaV - SSD Recency START
// If you change this enum, remember to update `Resources/Locale/en-US/_DV/ssdIndicator/examine.ftl`
public enum SsdStage : byte
{
/// <summary>
/// Stage 1: SSD Indicator is red. They might just be recovering from a crash/timeout.
/// </summary>
VeryRecent,
/// <summary>
/// Stage 2: SSD Indicator is yellow. They've been gone for a bit, but they shouldn't be moved to cryo yet.
/// </summary>
Recent,
/// <summary>
/// Stage 3: SSD Indicator is green/default. They've been gone for a long time, they can be moved to cryo.
/// </summary>
Cryoable,
}
// DeltaV END