Disable SSD indicator for NPC (#20027)
* Make ActiveNPCComponent shared * Check if entity have ActiveNPC component * Make networked * Fix path * fix
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.NPC;
|
||||
|
||||
namespace Content.Shared.SSDIndicator;
|
||||
|
||||
@@ -9,10 +10,19 @@ public sealed class SSDIndicatorSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<SSDIndicatorComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<SSDIndicatorComponent, MindAddedMessage>(OnMindAdded);
|
||||
SubscribeLocalEvent<SSDIndicatorComponent, MindRemovedMessage>(OnMindRemoved);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, SSDIndicatorComponent component, ComponentInit args)
|
||||
{
|
||||
if (HasComp<ActiveNPCComponent>(uid))
|
||||
return;
|
||||
|
||||
component.IsSSD = !HasComp<MindContainerComponent>(uid);
|
||||
}
|
||||
|
||||
private void OnMindAdded(EntityUid uid, SSDIndicatorComponent component, MindAddedMessage args)
|
||||
{
|
||||
component.IsSSD = false;
|
||||
@@ -21,6 +31,9 @@ public sealed class SSDIndicatorSystem : EntitySystem
|
||||
|
||||
private void OnMindRemoved(EntityUid uid, SSDIndicatorComponent component, MindRemovedMessage args)
|
||||
{
|
||||
if (HasComp<ActiveNPCComponent>(uid))
|
||||
return;
|
||||
|
||||
component.IsSSD = true;
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user