2023-09-11 08:52:56 +03:00
|
|
|
|
using Content.Shared.Mind.Components;
|
2023-09-15 05:15:26 +03:00
|
|
|
|
using Content.Shared.NPC;
|
2023-09-11 08:52:56 +03:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.SSDIndicator;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Handle changing player SSD indicator status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public sealed class SSDIndicatorSystem : EntitySystem
|
|
|
|
|
|
{
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
2023-09-15 05:15:26 +03:00
|
|
|
|
SubscribeLocalEvent<SSDIndicatorComponent, ComponentInit>(OnInit);
|
2023-09-11 08:52:56 +03:00
|
|
|
|
SubscribeLocalEvent<SSDIndicatorComponent, MindAddedMessage>(OnMindAdded);
|
|
|
|
|
|
SubscribeLocalEvent<SSDIndicatorComponent, MindRemovedMessage>(OnMindRemoved);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-15 05:15:26 +03:00
|
|
|
|
private void OnInit(EntityUid uid, SSDIndicatorComponent component, ComponentInit args)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (HasComp<ActiveNPCComponent>(uid))
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
component.IsSSD = !HasComp<MindContainerComponent>(uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-11 08:52:56 +03:00
|
|
|
|
private void OnMindAdded(EntityUid uid, SSDIndicatorComponent component, MindAddedMessage args)
|
|
|
|
|
|
{
|
|
|
|
|
|
component.IsSSD = false;
|
|
|
|
|
|
Dirty(uid, component);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnMindRemoved(EntityUid uid, SSDIndicatorComponent component, MindRemovedMessage args)
|
|
|
|
|
|
{
|
2023-09-15 05:15:26 +03:00
|
|
|
|
if (HasComp<ActiveNPCComponent>(uid))
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2023-09-11 08:52:56 +03:00
|
|
|
|
component.IsSSD = true;
|
|
|
|
|
|
Dirty(uid, component);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|