From bb7742e21ec570ff942befa925b796bd38d6d034 Mon Sep 17 00:00:00 2001 From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Sat, 10 May 2025 01:05:19 +0100 Subject: [PATCH] move SignalState to shared (#37303) Co-authored-by: deltanedas <@deltanedas:kde.org> --- .../DeviceLinking/Components/LogicGateComponent.cs | 12 +----------- .../DeviceLinking/Systems/DoorSignalControlSystem.cs | 1 + .../DeviceLinking/Systems/EdgeDetectorSystem.cs | 1 + Content.Shared/DeviceLinking/SharedLogicGate.cs | 12 ++++++++++++ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Content.Server/DeviceLinking/Components/LogicGateComponent.cs b/Content.Server/DeviceLinking/Components/LogicGateComponent.cs index 61f85934b4..c4f6dbd8be 100644 --- a/Content.Server/DeviceLinking/Components/LogicGateComponent.cs +++ b/Content.Server/DeviceLinking/Components/LogicGateComponent.cs @@ -49,7 +49,7 @@ public sealed partial class LogicGateComponent : Component [DataField, ViewVariables(VVAccess.ReadWrite)] public ProtoId OutputPort = "Output"; - // Initial state + // Initial state, used to not spam invoke ports [DataField] public SignalState StateA = SignalState.Low; @@ -59,13 +59,3 @@ public sealed partial class LogicGateComponent : Component [DataField] public bool LastOutput; } - -/// -/// Last state of a signal port, used to not spam invoking ports. -/// -public enum SignalState : byte -{ - Momentary, // Instantaneous pulse high, compatibility behavior - Low, - High -} diff --git a/Content.Server/DeviceLinking/Systems/DoorSignalControlSystem.cs b/Content.Server/DeviceLinking/Systems/DoorSignalControlSystem.cs index 107559826c..a708978058 100644 --- a/Content.Server/DeviceLinking/Systems/DoorSignalControlSystem.cs +++ b/Content.Server/DeviceLinking/Systems/DoorSignalControlSystem.cs @@ -1,6 +1,7 @@ using Content.Server.DeviceLinking.Components; using Content.Server.DeviceNetwork; using Content.Server.Doors.Systems; +using Content.Shared.DeviceLinking; using Content.Shared.DeviceLinking.Events; using Content.Shared.DeviceNetwork; using Content.Shared.Doors.Components; diff --git a/Content.Server/DeviceLinking/Systems/EdgeDetectorSystem.cs b/Content.Server/DeviceLinking/Systems/EdgeDetectorSystem.cs index a425122df4..16fc98e07d 100644 --- a/Content.Server/DeviceLinking/Systems/EdgeDetectorSystem.cs +++ b/Content.Server/DeviceLinking/Systems/EdgeDetectorSystem.cs @@ -1,4 +1,5 @@ using Content.Server.DeviceLinking.Components; +using Content.Shared.DeviceLinking; using Content.Shared.DeviceLinking.Events; using Content.Shared.DeviceNetwork; diff --git a/Content.Shared/DeviceLinking/SharedLogicGate.cs b/Content.Shared/DeviceLinking/SharedLogicGate.cs index 75f8cb4951..35d3f9e6f1 100644 --- a/Content.Shared/DeviceLinking/SharedLogicGate.cs +++ b/Content.Shared/DeviceLinking/SharedLogicGate.cs @@ -40,3 +40,15 @@ public enum LogicGateLayers : byte InputB, Output } + +/// +/// The possible states of a logic-capable signal. +/// Stored in network payload data of device network messages. +/// +[Serializable, NetSerializable] +public enum SignalState : byte +{ + Momentary, // Instantaneous pulse high, compatibility behavior + Low, + High +}