Paradox Clones spawn with their suit sensors off (#35909)
* 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>
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
using Content.Server.Antag;
|
using Content.Server.Antag;
|
||||||
using Content.Server.Cloning;
|
using Content.Server.Cloning;
|
||||||
using Content.Server.GameTicking.Rules.Components;
|
using Content.Server.GameTicking.Rules.Components;
|
||||||
|
using Content.Server.Medical.SuitSensors;
|
||||||
using Content.Server.Objectives.Components;
|
using Content.Server.Objectives.Components;
|
||||||
using Content.Shared.GameTicking.Components;
|
using Content.Shared.GameTicking.Components;
|
||||||
using Content.Shared.Gibbing.Components;
|
using Content.Shared.Gibbing.Components;
|
||||||
|
using Content.Shared.Medical.SuitSensor;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.GameTicking.Rules;
|
namespace Content.Server.GameTicking.Rules;
|
||||||
@@ -16,6 +17,7 @@ public sealed class ParadoxCloneRuleSystem : GameRuleSystem<ParadoxCloneRuleComp
|
|||||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly CloningSystem _cloning = default!;
|
[Dependency] private readonly CloningSystem _cloning = default!;
|
||||||
|
[Dependency] private readonly SuitSensorSystem _sensor = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -72,6 +74,9 @@ public sealed class ParadoxCloneRuleSystem : GameRuleSystem<ParadoxCloneRuleComp
|
|||||||
gibComp.SpawnProto = ent.Comp.GibProto;
|
gibComp.SpawnProto = ent.Comp.GibProto;
|
||||||
gibComp.PreventGibbingObjectives = new() { "ParadoxCloneKillObjective" }; // don't gib them if they killed the original.
|
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;
|
args.Entity = clone;
|
||||||
ent.Comp.Original = playerToClone.Owner;
|
ent.Comp.Original = playerToClone.Owner;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.DoAfter;
|
|||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Medical.SuitSensor;
|
using Content.Shared.Medical.SuitSensor;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
@@ -44,6 +45,7 @@ public sealed class SuitSensorSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||||
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||||
|
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
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)
|
public SuitSensorStatus? GetSensorState(EntityUid uid, SuitSensorComponent? sensor = null, TransformComponent? transform = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref sensor, ref transform))
|
if (!Resolve(uid, ref sensor, ref transform))
|
||||||
|
|||||||
Reference in New Issue
Block a user