Blast door/shutter, timer and or gate device linking fixes (#16347)

This commit is contained in:
Julian Giebel
2023-05-12 00:16:02 +02:00
committed by GitHub
parent 59176df425
commit 5e0a96dfc7
16 changed files with 255 additions and 123 deletions

View File

@@ -1,8 +1,6 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceNetwork;
using Content.Server.Doors.Systems;
using Content.Server.MachineLinking.Events;
using Content.Server.MachineLinking.System;
using Content.Shared.Doors.Components;
using Content.Shared.Doors;
using JetBrains.Annotations;
@@ -17,8 +15,6 @@ namespace Content.Server.DeviceLinking.Systems
[Dependency] private readonly DoorSystem _doorSystem = default!;
[Dependency] private readonly DeviceLinkSystem _signalSystem = default!;
private const string DoorSignalState = "DoorState";
public override void Initialize()
{
base.Initialize();
@@ -40,7 +36,7 @@ namespace Content.Server.DeviceLinking.Systems
return;
var state = SignalState.Momentary;
args.Data?.TryGetValue(DoorSignalState, out state);
args.Data?.TryGetValue(DeviceNetworkConstants.LogicState, out state);
if (args.Port == component.OpenPort)
@@ -85,12 +81,12 @@ namespace Content.Server.DeviceLinking.Systems
{
var data = new NetworkPayload()
{
{ DoorSignalState, SignalState.Momentary }
{ DeviceNetworkConstants.LogicState, SignalState.Momentary }
};
if (args.State == DoorState.Closed)
{
data[DoorSignalState] = SignalState.Low;
data[DeviceNetworkConstants.LogicState] = SignalState.Low;
_signalSystem.InvokePort(uid, door.OutOpen, data);
}
else if (args.State == DoorState.Open
@@ -98,7 +94,7 @@ namespace Content.Server.DeviceLinking.Systems
|| args.State == DoorState.Closing
|| args.State == DoorState.Emagging)
{
data[DoorSignalState] = SignalState.High;
data[DeviceNetworkConstants.LogicState] = SignalState.High;
_signalSystem.InvokePort(uid, door.OutOpen, data);
}
}