]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix SSD indicator (#24589)
authorKot <1192090+koteq@users.noreply.github.com>
Thu, 1 Feb 2024 08:30:07 +0000 (12:30 +0400)
committerGitHub <noreply@github.com>
Thu, 1 Feb 2024 08:30:07 +0000 (19:30 +1100)
Fix ssd indicator

Content.Client/SSDIndicator/SSDIndicatorSystem.cs
Content.Shared/SSDIndicator/SSDIndicatorComponent.cs
Content.Shared/SSDIndicator/SSDIndicatorSystem.cs

index f30d56506131a09a84bbbf3866ba1e7025fb016f..587450a2f66bfce515a0a3e9175b6c39730283a8 100644 (file)
@@ -1,4 +1,7 @@
 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;
@@ -14,6 +17,7 @@ public sealed class SSDIndicatorSystem : EntitySystem
 {
     [Dependency] private readonly IPrototypeManager _prototype = default!;
     [Dependency] private readonly IConfigurationManager _cfg = default!;
+    [Dependency] private readonly MobStateSystem _mobState = default!;
 
     public override void Initialize()
     {
@@ -24,11 +28,15 @@ public sealed class SSDIndicatorSystem : EntitySystem
 
     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));
+        }
     }
 }
index 53e1f6a1406b93630c217ffdc625b516a3013f7a..66310505a1a42d45c3066d39453b424825350185 100644 (file)
@@ -13,7 +13,7 @@ public sealed partial class SSDIndicatorComponent : Component
 {
     [ViewVariables(VVAccess.ReadWrite)]
     [AutoNetworkedField]
-    public bool IsSSD = false;
+    public bool IsSSD = true;
 
     [ViewVariables(VVAccess.ReadWrite)]
     [DataField("icon", customTypeSerializer: typeof(PrototypeIdSerializer<StatusIconPrototype>))]
index 4fe726113a11a98fdd99d3b4c3f03b825b2197f4..7fc13d161e9c65e9da496665d2b9e6b3eab3d07e 100644 (file)
@@ -1,5 +1,4 @@
-using Content.Shared.Mind.Components;
-using Content.Shared.NPC;
+using Robust.Shared.Player;
 
 namespace Content.Shared.SSDIndicator;
 
@@ -10,30 +9,18 @@ public sealed class SSDIndicatorSystem : EntitySystem
 {
     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);
     }