diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs index dd3ec5c949..c05245c81d 100644 --- a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs @@ -33,6 +33,7 @@ namespace Content.Server.Atmos.Monitor.Systems; public sealed class AirAlarmSystem : EntitySystem { [Dependency] private readonly DeviceNetworkSystem _deviceNet = default!; + [Dependency] private readonly DeviceListSystem _deviceListSystem = default!; [Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNetSystem = default!; [Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; @@ -290,10 +291,15 @@ public sealed class AirAlarmSystem : EntitySystem private void OnUpdateDeviceData(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateDeviceDataMessage args) { - if (AccessCheck(uid, args.Session.AttachedEntity, component)) + if (AccessCheck(uid, args.Session.AttachedEntity, component) + && _deviceListSystem.ExistsInDeviceList(uid, args.Address)) + { SetDeviceData(uid, args.Address, args.Data); + } else + { UpdateUI(uid, component); + } } private bool AccessCheck(EntityUid uid, EntityUid? user, AirAlarmComponent? component = null) diff --git a/Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs b/Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs index 1869db2998..f3d1231b0f 100644 --- a/Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs @@ -61,6 +61,19 @@ public sealed class DeviceListSystem : SharedDeviceListSystem return devices; } + /// + /// Checks if the given address is present in a device list + /// + /// The entity uid that has the device list that should be checked for the address + /// The address to check for + /// The device list component + /// True if the address is present. False if not + public bool ExistsInDeviceList(EntityUid uid, string address, DeviceListComponent? deviceList = null) + { + var addresses = GetDeviceList(uid).Keys; + return addresses.Contains(address); + } + protected override void UpdateShutdownSubscription(EntityUid uid, List newDevices, List oldDevices) { foreach (var device in newDevices)