diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs index d0d0246989..2368b17890 100644 --- a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs @@ -143,6 +143,21 @@ namespace Content.Server.Atmos.Monitor.Systems } } + /// + /// Reset a single sensor's state. + /// + /// + /// + private void ResetSensor(EntityUid uid, string address) + { + var payload = new NetworkPayload + { + [DeviceNetworkConstants.Command] = AtmosMonitorSystem.AtmosMonitorAlarmResetCmd, + }; + + _deviceNet.QueuePacket(uid, address, payload); + } + /// /// Sync this air alarm's mode with the rest of the network. /// diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs index 1b192c4ca8..b99e2f040b 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs @@ -39,12 +39,17 @@ namespace Content.Server.Atmos.Monitor.Systems /// public const string AtmosMonitorAlarmSyncCmd = "atmos_monitor_alarm_sync"; + /// + /// Command to reset a single alarm. + /// + public const string AtmosMonitorAlarmResetCmd = "atmos_monitor_alarm_reset"; + /// /// Command to reset all alarms on a network. /// public const string AtmosMonitorAlarmResetAllCmd = "atmos_monitor_alarm_reset_all"; - public const string AtmosMonitorSetThresholdData = "atmos_monitor_set_threshold"; + public const string AtmosMonitorSetThresholdCmd = "atmos_monitor_set_threshold"; // Packet data /// @@ -69,6 +74,10 @@ namespace Content.Server.Atmos.Monitor.Systems public const string AtmosMonitorThresholdData = "atmos_monitor_threshold_data"; + public const string AtmosMonitorThresholdDataType = "atmos_monitor_threshold_type"; + + public const string AtmosMonitorThresholdGasType = "atmos_monitor_threshold_gas"; + public override void Initialize() { SubscribeLocalEvent(OnAtmosMonitorInit); @@ -190,6 +199,10 @@ namespace Content.Server.Atmos.Monitor.Systems && !component.NetworkAlarmStates.TryAdd(args.SenderAddress, state)) component.NetworkAlarmStates[args.SenderAddress] = state; break; + case AtmosMonitorAlarmResetCmd: + Reset(uid); + // Don't clear alarm states here. + break; case AtmosMonitorAlarmResetAllCmd: if (args.Data.TryGetValue(AtmosMonitorAlarmSrc, out string? resetSrc) && alarmable.AlarmedByPrototypes.Contains(resetSrc)) @@ -197,6 +210,15 @@ namespace Content.Server.Atmos.Monitor.Systems component.LastAlarmState = AtmosMonitorAlarmType.Normal; component.NetworkAlarmStates.Clear(); } + break; + case AtmosMonitorSetThresholdCmd: + if (args.Data.TryGetValue(AtmosMonitorThresholdData, out AtmosAlarmThreshold? thresholdData) + && args.Data.TryGetValue(AtmosMonitorThresholdDataType, out AtmosMonitorThresholdType? thresholdType)) + { + args.Data.TryGetValue(AtmosMonitorThresholdGasType, out Gas? gas); + SetThreshold(uid, thresholdType.Value, thresholdData, gas); + } + break; case AirAlarmSystem.AirAlarmSyncCmd: var payload = new NetworkPayload(); @@ -213,9 +235,8 @@ namespace Content.Server.Atmos.Monitor.Systems component.TileGas.Pressure, component.TileGas.Temperature, component.TileGas.TotalMoles, - component.HighestAlarmInNetwork, + component.LastAlarmState, gases, - false, component.PressureThreshold ?? new(), component.TemperatureThreshold ?? new(), component.GasThresholds ?? new() @@ -225,15 +246,6 @@ namespace Content.Server.Atmos.Monitor.Systems _deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload); break; } - - /* - if (component.DisplayMaxAlarmInNet) - { - if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) - appearanceComponent.SetData(AtmosMonitorVisuals.AlarmType, component.HighestAlarmInNetwork); - - } - */ } private void OnPowerChangedEvent(EntityUid uid, AtmosMonitorComponent component, PowerChangedEvent args) @@ -262,9 +274,6 @@ namespace Content.Server.Atmos.Monitor.Systems } } } - - if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) - appearanceComponent.SetData(AtmosMonitorVisuals.AlarmType, component.LastAlarmState); } private void OnFireEvent(EntityUid uid, AtmosMonitorComponent component, ref TileFireEvent args) diff --git a/Content.Shared/Atmos/Monitor/AtmosSensorData.cs b/Content.Shared/Atmos/Monitor/AtmosSensorData.cs index 3cb2f09be5..0410d025f0 100644 --- a/Content.Shared/Atmos/Monitor/AtmosSensorData.cs +++ b/Content.Shared/Atmos/Monitor/AtmosSensorData.cs @@ -4,14 +4,13 @@ namespace Content.Shared.Atmos.Monitor; public sealed class AtmosSensorData : IAtmosDeviceData { - public AtmosSensorData(float pressure, float temperature, float totalMoles, AtmosMonitorAlarmType alarmState, Dictionary gases, bool onFire, AtmosAlarmThreshold pressureThreshold, AtmosAlarmThreshold temperatureThreshold, Dictionary gasThresholds) + public AtmosSensorData(float pressure, float temperature, float totalMoles, AtmosMonitorAlarmType alarmState, Dictionary gases, AtmosAlarmThreshold pressureThreshold, AtmosAlarmThreshold temperatureThreshold, Dictionary gasThresholds) { Pressure = pressure; Temperature = temperature; TotalMoles = totalMoles; AlarmState = alarmState; Gases = gases; - OnFire = onFire; PressureThreshold = pressureThreshold; TemperatureThreshold = temperatureThreshold; GasThresholds = gasThresholds; @@ -43,10 +42,6 @@ public sealed class AtmosSensorData : IAtmosDeviceData /// Current number of gases on this sensor. /// public Dictionary Gases { get; } - /// - /// If this sensor is currently detecting a fire. - /// - public bool OnFire { get; } public AtmosAlarmThreshold PressureThreshold { get; } public AtmosAlarmThreshold TemperatureThreshold { get; }