using Content.Shared.CCVar;
+using Content.Shared.Mind.Components;
+using Content.Shared.Mobs.Systems;
+using Content.Shared.NPC;
using Content.Shared.SSDIndicator;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
+ [Dependency] private readonly MobStateSystem _mobState = default!;
public override void Initialize()
{
private void OnGetStatusIcon(EntityUid uid, SSDIndicatorComponent component, ref GetStatusIconsEvent args)
{
- if (!component.IsSSD ||
- !_cfg.GetCVar(CCVars.ICShowSSDIndicator) ||
- args.InContainer)
- return;
-
- args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon));
+ if (component.IsSSD &&
+ _cfg.GetCVar(CCVars.ICShowSSDIndicator) &&
+ !args.InContainer &&
+ !_mobState.IsDead(uid) &&
+ !HasComp<ActiveNPCComponent>(uid) &&
+ TryComp<MindContainerComponent>(uid, out var mindContainer) &&
+ mindContainer.ShowExamineInfo)
+ {
+ args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon));
+ }
}
}
{
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
- public bool IsSSD = false;
+ public bool IsSSD = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("icon", customTypeSerializer: typeof(PrototypeIdSerializer<StatusIconPrototype>))]
-using Content.Shared.Mind.Components;
-using Content.Shared.NPC;
+using Robust.Shared.Player;
namespace Content.Shared.SSDIndicator;
{
public override void Initialize()
{
- SubscribeLocalEvent<SSDIndicatorComponent, ComponentInit>(OnInit);
- SubscribeLocalEvent<SSDIndicatorComponent, MindAddedMessage>(OnMindAdded);
- SubscribeLocalEvent<SSDIndicatorComponent, MindRemovedMessage>(OnMindRemoved);
+ SubscribeLocalEvent<SSDIndicatorComponent, PlayerAttachedEvent>(OnPlayerAttached);
+ SubscribeLocalEvent<SSDIndicatorComponent, PlayerDetachedEvent>(OnPlayerDetached);
}
- 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)
+ private void OnPlayerAttached(EntityUid uid, SSDIndicatorComponent component, PlayerAttachedEvent args)
{
component.IsSSD = false;
Dirty(uid, component);
}
- private void OnMindRemoved(EntityUid uid, SSDIndicatorComponent component, MindRemovedMessage args)
+ private void OnPlayerDetached(EntityUid uid, SSDIndicatorComponent component, PlayerDetachedEvent args)
{
- if (HasComp<ActiveNPCComponent>(uid))
- return;
-
component.IsSSD = true;
Dirty(uid, component);
}