diff --git a/Content.Server/Atmos/Monitor/Components/AtmosAlarmableComponent.cs b/Content.Server/Atmos/Monitor/Components/AtmosAlarmableComponent.cs index 23f25ad4de..1f62b6fd26 100644 --- a/Content.Server/Atmos/Monitor/Components/AtmosAlarmableComponent.cs +++ b/Content.Server/Atmos/Monitor/Components/AtmosAlarmableComponent.cs @@ -48,6 +48,9 @@ namespace Content.Server.Atmos.Monitor.Components [DataField("syncWith", customTypeSerializer: typeof(PrototypeIdHashSetSerializer))] public HashSet SyncWithTags { get; } = new(); + [DataField("monitorAlertTypes")] + public HashSet MonitorAlertTypes { get; } = new(); + /// /// If this device should receive only. If it can only /// receive, that means that attempting to sync outwards diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs index 3a14caa528..11272d74fd 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Linq; using Content.Server.Atmos.Monitor.Components; using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork.Components; @@ -27,6 +28,8 @@ namespace Content.Server.Atmos.Monitor.Systems public const string AlertSource = "atmos_alarm_source"; + public const string AlertTypes = "atmos_alarm_types"; + /// /// Syncs alerts from this alarm receiver to other alarm receivers. /// Creates a network effect as a result. Note: if the alert receiver @@ -63,15 +66,7 @@ namespace Content.Server.Atmos.Monitor.Systems return; } - var isValid = false; - foreach (var source in sourceTags) - { - if (component.SyncWithTags.Contains(source)) - { - isValid = true; - break; - } - } + var isValid = sourceTags.Any(source => component.SyncWithTags.Contains(source)); if (!isValid) { @@ -88,6 +83,16 @@ namespace Content.Server.Atmos.Monitor.Systems return; } + if (args.Data.TryGetValue(AlertTypes, out HashSet? types)) + { + isValid = types.Any(type => component.MonitorAlertTypes.Contains(type)); + + if (!isValid) + { + break; + } + } + if (!component.NetworkAlarmStates.ContainsKey(args.SenderAddress)) { component.NetworkAlarmStates.Add(args.SenderAddress, state); diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs index 8fd43fe745..2b9b36656b 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs @@ -1,3 +1,4 @@ +using System.Linq; using Content.Server.Atmos.Monitor.Components; using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.Piping.EntitySystems; @@ -31,8 +32,8 @@ namespace Content.Server.Atmos.Monitor.Systems // Commands public const string AtmosMonitorSetThresholdCmd = "atmos_monitor_set_threshold"; - // Packet data + public const string AlertTypes = "atmos_monitor_alert_types"; public const string AtmosMonitorThresholdData = "atmos_monitor_threshold_data"; @@ -315,6 +316,11 @@ namespace Content.Server.Atmos.Monitor.Systems [AtmosAlarmableSystem.AlertSource] = tags.Tags }; + if (alarms != null) + { + payload.Add(AtmosAlarmableSystem.AlertTypes, alarms.ToHashSet()); + } + foreach (var addr in monitor.RegisteredDevices) { _deviceNetSystem.QueuePacket(monitor.Owner, addr, payload); diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml index aa70eb4197..fbad7ef8ff 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml @@ -23,6 +23,8 @@ - AirSensor - GasVent - GasScrubber + monitorAlertTypes: + - Temperature - type: Tag tags: - FireAlarm