fix: dirty SSD indicator comp on mapinit (#38891)

This commit is contained in:
Perry Fraser
2025-07-22 11:40:15 -04:00
committed by GitHub
parent 4033089c46
commit f16175a6e3
2 changed files with 41 additions and 17 deletions

View File

@@ -1,29 +1,49 @@
using Content.Shared.CCVar;
using Content.Shared.StatusIcon;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.SSDIndicator;
/// <summary>
/// Shows status icon when player in SSD
/// 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
{
[DataField, ViewVariables(VVAccess.ReadOnly)]
/// <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>
/// When the entity should fall asleep
/// The time at which the entity will fall asleep, if <see cref="CCVars.ICSSDSleep"/> is true.
/// </summary>
[DataField]
[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);
}