Split Door Bolt functionality out of AirlockDoor (#16354)

This commit is contained in:
Tom Leys
2023-06-01 02:23:35 +12:00
committed by GitHub
parent f419c20c49
commit a196756124
26 changed files with 283 additions and 161 deletions

View File

@@ -11,7 +11,7 @@ namespace Content.Server.DeviceLinking.Systems
[UsedImplicitly]
public sealed class DoorSignalControlSystem : EntitySystem
{
[Dependency] private readonly AirlockSystem _airlockSystem = default!;
[Dependency] private readonly DoorBoltSystem _bolts = default!;
[Dependency] private readonly DoorSystem _doorSystem = default!;
[Dependency] private readonly DeviceLinkSystem _signalSystem = default!;
@@ -67,18 +67,18 @@ namespace Content.Server.DeviceLinking.Systems
{
if (state == SignalState.High)
{
if(TryComp<AirlockComponent>(uid, out var airlockComponent))
_airlockSystem.SetBoltsWithAudio(uid, airlockComponent, true);
if(TryComp<DoorBoltComponent>(uid, out var bolts))
_bolts.SetBoltsWithAudio(uid, bolts, true);
}
else if (state == SignalState.Momentary)
{
if (TryComp<AirlockComponent>(uid, out var airlockComponent))
_airlockSystem.SetBoltsWithAudio(uid, airlockComponent, newBolts: !airlockComponent.BoltsDown);
if (TryComp<DoorBoltComponent>(uid, out var bolts))
_bolts.SetBoltsWithAudio(uid, bolts, newBolts: !bolts.BoltsDown);
}
else
{
if(TryComp<AirlockComponent>(uid, out var airlockComponent))
_airlockSystem.SetBoltsWithAudio(uid, airlockComponent, false);
if(TryComp<DoorBoltComponent>(uid, out var bolts))
_bolts.SetBoltsWithAudio(uid, bolts, false);
}
}
}