SSD Indicator (#19701)
This commit is contained in:
21
Content.Shared/SSDIndicator/SSDIndicatorComponent.cs
Normal file
21
Content.Shared/SSDIndicator/SSDIndicatorComponent.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Content.Shared.StatusIcon;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.SSDIndicator;
|
||||
|
||||
/// <summary>
|
||||
/// Shows status icon when player in SSD
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[AutoGenerateComponentState]
|
||||
public sealed partial class SSDIndicatorComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[AutoNetworkedField]
|
||||
public bool IsSSD = true;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("icon", customTypeSerializer: typeof(PrototypeIdSerializer<StatusIconPrototype>))]
|
||||
public string Icon = "SSDIcon";
|
||||
}
|
||||
27
Content.Shared/SSDIndicator/SSDIndicatorSystem.cs
Normal file
27
Content.Shared/SSDIndicator/SSDIndicatorSystem.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Content.Shared.Mind.Components;
|
||||
|
||||
namespace Content.Shared.SSDIndicator;
|
||||
|
||||
/// <summary>
|
||||
/// Handle changing player SSD indicator status
|
||||
/// </summary>
|
||||
public sealed class SSDIndicatorSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<SSDIndicatorComponent, MindAddedMessage>(OnMindAdded);
|
||||
SubscribeLocalEvent<SSDIndicatorComponent, MindRemovedMessage>(OnMindRemoved);
|
||||
}
|
||||
|
||||
private void OnMindAdded(EntityUid uid, SSDIndicatorComponent component, MindAddedMessage args)
|
||||
{
|
||||
component.IsSSD = false;
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private void OnMindRemoved(EntityUid uid, SSDIndicatorComponent component, MindRemovedMessage args)
|
||||
{
|
||||
component.IsSSD = true;
|
||||
Dirty(uid, component);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user