]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Paradox Clones spawn with their suit sensors off (#35909)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Tue, 18 Mar 2025 20:07:06 +0000 (21:07 +0100)
committerGitHub <noreply@github.com>
Tue, 18 Mar 2025 20:07:06 +0000 (16:07 -0400)
* sensors off

* remove import

* Update Content.Server/Medical/SuitSensors/SuitSensorSystem.cs

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
Content.Server/GameTicking/Rules/ParadoxCloneRuleSystem.cs
Content.Server/Medical/SuitSensors/SuitSensorSystem.cs

index 076479727f76895b5522cbca76900477be4a1828..8a5cab85b864e5769754b01c91bdde63e8320b1f 100644 (file)
@@ -1,11 +1,12 @@
 using Content.Server.Antag;
 using Content.Server.Cloning;
 using Content.Server.GameTicking.Rules.Components;
+using Content.Server.Medical.SuitSensors;
 using Content.Server.Objectives.Components;
 using Content.Shared.GameTicking.Components;
 using Content.Shared.Gibbing.Components;
+using Content.Shared.Medical.SuitSensor;
 using Content.Shared.Mind;
-using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 
 namespace Content.Server.GameTicking.Rules;
@@ -16,6 +17,7 @@ public sealed class ParadoxCloneRuleSystem : GameRuleSystem<ParadoxCloneRuleComp
     [Dependency] private readonly SharedMindSystem _mind = default!;
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly CloningSystem _cloning = default!;
+    [Dependency] private readonly SuitSensorSystem _sensor = default!;
 
     public override void Initialize()
     {
@@ -72,6 +74,9 @@ public sealed class ParadoxCloneRuleSystem : GameRuleSystem<ParadoxCloneRuleComp
         gibComp.SpawnProto = ent.Comp.GibProto;
         gibComp.PreventGibbingObjectives = new() { "ParadoxCloneKillObjective" }; // don't gib them if they killed the original.
 
+        // turn their suit sensors off so they don't immediately get noticed
+        _sensor.SetAllSensors(clone.Value, SuitSensorMode.SensorOff);
+
         args.Entity = clone;
         ent.Comp.Original = playerToClone.Owner;
     }
index b697a42d5132974a4732f18e4383db77d07bf42d..f6e46dd4f843b0afa8146941de213d48fed84464 100644 (file)
@@ -15,6 +15,7 @@ using Content.Shared.DoAfter;
 using Content.Shared.Examine;
 using Content.Shared.GameTicking;
 using Content.Shared.Interaction;
+using Content.Shared.Inventory;
 using Content.Shared.Medical.SuitSensor;
 using Content.Shared.Mobs;
 using Content.Shared.Mobs.Components;
@@ -44,6 +45,7 @@ public sealed class SuitSensorSystem : EntitySystem
     [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
     [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
     [Dependency] private readonly IPrototypeManager _proto = default!;
+    [Dependency] private readonly InventorySystem _inventory = default!;
 
     public override void Initialize()
     {
@@ -347,6 +349,20 @@ public sealed class SuitSensorSystem : EntitySystem
         }
     }
 
+    /// <summary>
+    ///     Set all suit sensors on the equipment someone is wearing to the specified mode.
+    /// </summary>
+    public void SetAllSensors(EntityUid target, SuitSensorMode mode, SlotFlags slots = SlotFlags.All )
+    {
+        // iterate over all inventory slots
+        var slotEnumerator = _inventory.GetSlotEnumerator(target, slots);
+        while (slotEnumerator.NextItem(out var item, out _))
+        {
+            if (TryComp<SuitSensorComponent>(item, out var sensorComp))
+                SetSensor((item, sensorComp), mode);
+        }
+    }
+
     public SuitSensorStatus? GetSensorState(EntityUid uid, SuitSensorComponent? sensor = null, TransformComponent? transform = null)
     {
         if (!Resolve(uid, ref sensor, ref transform))