]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Disable SSD indicator for NPC (#20027)
authorMorb <14136326+Morb0@users.noreply.github.com>
Fri, 15 Sep 2023 02:15:26 +0000 (05:15 +0300)
committerGitHub <noreply@github.com>
Fri, 15 Sep 2023 02:15:26 +0000 (22:15 -0400)
* Make ActiveNPCComponent shared

* Check if entity have ActiveNPC component

* Make networked

* Fix path

* fix

Content.Server/NPC/HTN/HTNSystem.cs
Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs
Content.Server/NPC/Systems/NPCSteeringSystem.cs
Content.Server/NPC/Systems/NPCSystem.cs
Content.Shared/NPC/ActiveNPCComponent.cs [moved from Content.Server/NPC/Components/ActiveNPCComponent.cs with 58% similarity]
Content.Shared/SSDIndicator/SSDIndicatorComponent.cs
Content.Shared/SSDIndicator/SSDIndicatorSystem.cs

index 6fa9af0ccdf72f1e4f791ce3594d219bd1196aef..2c1dadb12797e913a186086651118590a3ceaf75 100644 (file)
@@ -10,6 +10,7 @@ using Content.Server.NPC.Systems;
 using Content.Shared.Administration;
 using Content.Shared.Mobs;
 using Content.Shared.NPC;
+using Content.Shared.NPC;
 using JetBrains.Annotations;
 using Robust.Server.GameObjects;
 using Robust.Server.Player;
index 1b7bf19198a693bf5d1864de2964c2780c234c26..11ba4d102b101e45d9d369c0ed61954351b9c27a 100644 (file)
@@ -3,6 +3,7 @@ using Content.Server.NPC.Components;
 using Content.Server.NPC.Events;
 using Content.Shared.CombatMode;
 using Content.Shared.NPC;
+using Content.Shared.NPC;
 using Content.Shared.Weapons.Melee;
 using Robust.Shared.Map;
 using Robust.Shared.Physics.Components;
index 62fd13fc9fb749470842bd7debc70bbfde27104d..cbc2ba6d2c4937d23c028ecc10b87c7afe2ea243 100644 (file)
@@ -15,6 +15,7 @@ using Content.Shared.Interaction;
 using Content.Shared.Movement.Components;
 using Content.Shared.Movement.Systems;
 using Content.Shared.NPC;
+using Content.Shared.NPC;
 using Content.Shared.NPC.Events;
 using Content.Shared.Physics;
 using Content.Shared.Weapons.Melee;
index 40b8e26897a5e9f4ea1a6bafe7820d2da3374dc3..02dc4ceea6c0f2d688e0e00bf91627954deacd65 100644 (file)
@@ -4,6 +4,7 @@ using Content.Server.NPC.HTN;
 using Content.Shared.CCVar;
 using Content.Shared.Mobs;
 using Content.Shared.Mobs.Systems;
+using Content.Shared.NPC;
 using Robust.Server.GameObjects;
 using Robust.Shared.Configuration;
 
similarity index 58%
rename from Content.Server/NPC/Components/ActiveNPCComponent.cs
rename to Content.Shared/NPC/ActiveNPCComponent.cs
index 75491ee1c8532458744520524c16fd16f9ea1967..08ea65feb53091e66afb05a5cd09b82dbf41a88c 100644 (file)
@@ -1,7 +1,9 @@
-namespace Content.Server.NPC.Components;
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.NPC;
 
 /// <summary>
 /// Added to NPCs that are actively being updated.
 /// </summary>
-[RegisterComponent]
+[RegisterComponent, NetworkedComponent]
 public sealed partial class ActiveNPCComponent : Component {}
index 66310505a1a42d45c3066d39453b424825350185..53e1f6a1406b93630c217ffdc625b516a3013f7a 100644 (file)
@@ -13,7 +13,7 @@ public sealed partial class SSDIndicatorComponent : Component
 {
     [ViewVariables(VVAccess.ReadWrite)]
     [AutoNetworkedField]
-    public bool IsSSD = true;
+    public bool IsSSD = false;
 
     [ViewVariables(VVAccess.ReadWrite)]
     [DataField("icon", customTypeSerializer: typeof(PrototypeIdSerializer<StatusIconPrototype>))]
index d6db56be9ccde654b3f5ee963c2cabaef9ebdc50..4fe726113a11a98fdd99d3b4c3f03b825b2197f4 100644 (file)
@@ -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);
     }