Wires patches (#7993)

* door bolts now set if power is off and wire is pulsed, makes WiresSystem get a new random every time the round restarts

* ??? what's shuffle doing in the interface ???

* oops
This commit is contained in:
Flipp Syder
2022-05-08 21:51:06 -07:00
committed by GitHub
parent ed429682ea
commit 7d5c109383
2 changed files with 13 additions and 4 deletions

View File

@@ -55,10 +55,17 @@ public class DoorBoltWireAction : BaseWireAction
public override bool Pulse(EntityUid user, Wire wire)
{
if (IsPowered(wire.Owner)
&& EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
{
door.SetBoltsWithAudio(!door.BoltsDown);
if (IsPowered(wire.Owner))
{
door.SetBoltsWithAudio(!door.BoltsDown);
}
else if (!door.BoltsDown)
{
door.SetBoltsWithAudio(true);
}
}
return true;

View File

@@ -23,7 +23,6 @@ namespace Content.Server.Wires;
public sealed class WiresSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
@@ -33,6 +32,8 @@ public sealed class WiresSystem : EntitySystem
[Dependency] private readonly HandsSystem _handsSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!;
private IRobustRandom _random = new RobustRandom();
// This is where all the wire layouts are stored.
[ViewVariables] private readonly Dictionary<string, WireLayout> _layouts = new();
@@ -824,6 +825,7 @@ public sealed class WiresSystem : EntitySystem
private void Reset(RoundRestartCleanupEvent args)
{
_layouts.Clear();
_random = new RobustRandom();
}
#endregion