ECS airlocks (#13500)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Server.Doors.Systems;
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Doors;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Wires;
|
||||
|
||||
namespace Content.Server.Doors;
|
||||
@@ -21,7 +23,7 @@ public sealed class DoorBoltLightWireAction : BaseWireAction
|
||||
|
||||
public override StatusLightData? GetStatusLightData(Wire wire)
|
||||
{
|
||||
StatusLightState lightState = StatusLightState.Off;
|
||||
var lightState = StatusLightState.Off;
|
||||
if (IsPowered(wire.Owner) && EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
lightState = door.BoltLightsEnabled
|
||||
@@ -42,7 +44,7 @@ public sealed class DoorBoltLightWireAction : BaseWireAction
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.BoltLightsVisible = false;
|
||||
EntityManager.System<AirlockSystem>().SetBoltLightsEnabled(wire.Owner, door, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -53,7 +55,7 @@ public sealed class DoorBoltLightWireAction : BaseWireAction
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.BoltLightsVisible = true;
|
||||
EntityManager.System<AirlockSystem>().SetBoltLightsEnabled(wire.Owner, door, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -64,7 +66,7 @@ public sealed class DoorBoltLightWireAction : BaseWireAction
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.BoltLightsVisible = !door.BoltLightsEnabled;
|
||||
EntityManager.System<AirlockSystem>().SetBoltLightsEnabled(wire.Owner, door, !door.BoltLightsEnabled);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Server.Doors.Systems;
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Doors;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Doors.Systems;
|
||||
using Content.Shared.Wires;
|
||||
|
||||
namespace Content.Server.Doors;
|
||||
@@ -42,11 +45,11 @@ public sealed class DoorBoltWireAction : BaseWireAction
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var airlock))
|
||||
{
|
||||
door.BoltWireCut = true;
|
||||
if (!door.BoltsDown && IsPowered(wire.Owner))
|
||||
door.SetBoltsWithAudio(true);
|
||||
EntityManager.System<SharedAirlockSystem>().SetBoltWireCut(airlock, true);
|
||||
if (!airlock.BoltsDown && IsPowered(wire.Owner))
|
||||
EntityManager.System<AirlockSystem>().SetBoltsWithAudio(wire.Owner, airlock, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -56,7 +59,7 @@ public sealed class DoorBoltWireAction : BaseWireAction
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
door.BoltWireCut = false;
|
||||
EntityManager.System<SharedAirlockSystem>().SetBoltWireCut(door, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -68,11 +71,11 @@ public sealed class DoorBoltWireAction : BaseWireAction
|
||||
{
|
||||
if (IsPowered(wire.Owner))
|
||||
{
|
||||
door.SetBoltsWithAudio(!door.BoltsDown);
|
||||
EntityManager.System<AirlockSystem>().SetBoltsWithAudio(wire.Owner, door, !door.BoltsDown);
|
||||
}
|
||||
else if (!door.BoltsDown)
|
||||
{
|
||||
door.SetBoltsWithAudio(true);
|
||||
EntityManager.System<AirlockSystem>().SetBoltsWithAudio(wire.Owner, door, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Doors;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Doors.Systems;
|
||||
using Content.Shared.Wires;
|
||||
|
||||
namespace Content.Server.Doors;
|
||||
@@ -47,7 +49,7 @@ public sealed class DoorSafetyWireAction : BaseWireAction
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key);
|
||||
door.Safety = false;
|
||||
EntityManager.System<SharedAirlockSystem>().SetSafety(door, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -58,7 +60,7 @@ public sealed class DoorSafetyWireAction : BaseWireAction
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.Safety = true;
|
||||
EntityManager.System<SharedAirlockSystem>().SetSafety(door, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -69,7 +71,7 @@ public sealed class DoorSafetyWireAction : BaseWireAction
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.Safety = false;
|
||||
EntityManager.System<SharedAirlockSystem>().SetSafety(door, false);
|
||||
WiresSystem.StartWireAction(wire.Owner, _timeout, PulseTimeoutKey.Key, new TimedWireEvent(AwaitSafetyTimerFinish, wire));
|
||||
}
|
||||
|
||||
@@ -90,7 +92,7 @@ public sealed class DoorSafetyWireAction : BaseWireAction
|
||||
{
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.Safety = true;
|
||||
EntityManager.System<SharedAirlockSystem>().SetSafety(door, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Doors;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Doors.Systems;
|
||||
using Content.Shared.Wires;
|
||||
|
||||
namespace Content.Server.Doors;
|
||||
@@ -56,7 +58,7 @@ public sealed class DoorTimingWireAction : BaseWireAction
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key);
|
||||
door.AutoCloseDelayModifier = 0.01f;
|
||||
EntityManager.System<SharedAirlockSystem>().SetAutoCloseDelayModifier(door, 0.01f);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -67,7 +69,7 @@ public sealed class DoorTimingWireAction : BaseWireAction
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.AutoCloseDelayModifier = 1f;
|
||||
EntityManager.System<SharedAirlockSystem>().SetAutoCloseDelayModifier(door, 1f);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -78,7 +80,7 @@ public sealed class DoorTimingWireAction : BaseWireAction
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.AutoCloseDelayModifier = 0.5f;
|
||||
EntityManager.System<SharedAirlockSystem>().SetAutoCloseDelayModifier(door, 0.5f);
|
||||
WiresSystem.StartWireAction(wire.Owner, _timeout, PulseTimeoutKey.Key, new TimedWireEvent(AwaitTimingTimerFinish, wire));
|
||||
}
|
||||
|
||||
@@ -101,7 +103,7 @@ public sealed class DoorTimingWireAction : BaseWireAction
|
||||
{
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.AutoCloseDelayModifier = 1f;
|
||||
EntityManager.System<SharedAirlockSystem>().SetAutoCloseDelayModifier(door, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user