diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs index 2ae1518835..d9e94e373b 100644 --- a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs +++ b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs @@ -30,7 +30,6 @@ public sealed class AirAlarmBoundUserInterface : BoundUserInterface _window.AirAlarmModeChanged += OnAirAlarmModeChanged; _window.AutoModeChanged += OnAutoModeChanged; _window.ResyncAllRequested += ResyncAllDevices; - _window.AirAlarmTabChange += OnTabChanged; } private void ResyncAllDevices() @@ -63,11 +62,6 @@ public sealed class AirAlarmBoundUserInterface : BoundUserInterface SendMessage(new AirAlarmUpdateAlarmThresholdMessage(address, type, threshold, gas)); } - private void OnTabChanged(AirAlarmTab tab) - { - SendMessage(new AirAlarmTabSetMessage(tab)); - } - protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs index eeec11c766..e1425ac491 100644 --- a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs +++ b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs @@ -23,7 +23,6 @@ public sealed partial class AirAlarmWindow : FancyWindow public event Action? AirAlarmModeChanged; public event Action? AutoModeChanged; public event Action? ResyncAllRequested; - public event Action? AirAlarmTabChange; private RichTextLabel _address => CDeviceAddress; private RichTextLabel _deviceTotal => CDeviceTotal; @@ -80,11 +79,6 @@ public sealed partial class AirAlarmWindow : FancyWindow _tabContainer.SetTabTitle(1, Loc.GetString("air-alarm-ui-window-tab-scrubbers")); _tabContainer.SetTabTitle(2, Loc.GetString("air-alarm-ui-window-tab-sensors")); - _tabContainer.OnTabChanged += idx => - { - AirAlarmTabChange!((AirAlarmTab) idx); - }; - _resyncDevices.OnPressed += _ => { _ventDevices.RemoveAllChildren(); @@ -117,8 +111,6 @@ public sealed partial class AirAlarmWindow : FancyWindow { UpdateDeviceData(addr, dev); } - - _tabContainer.CurrentTab = (int) state.Tab; } public void UpdateModeSelector(AirAlarmMode mode) diff --git a/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs b/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs index 643b0ce782..a4e83594f2 100644 --- a/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs +++ b/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs @@ -17,8 +17,6 @@ public sealed partial class AirAlarmComponent : Component // Remember to null this afterwards. [ViewVariables] public IAirAlarmModeUpdate? CurrentModeUpdater { get; set; } - [ViewVariables] public AirAlarmTab CurrentTab { get; set; } - public readonly HashSet KnownDevices = new(); public readonly Dictionary VentData = new(); public readonly Dictionary ScrubberData = new(); diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs index f4650861db..7212865baa 100644 --- a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs @@ -173,7 +173,6 @@ public sealed class AirAlarmSystem : EntitySystem subs.Event(OnUpdateThreshold); subs.Event(OnUpdateDeviceData); subs.Event(OnCopyDeviceData); - subs.Event(OnTabChange); }); } @@ -200,12 +199,6 @@ public sealed class AirAlarmSystem : EntitySystem SyncRegisterAllDevices(uid); } - private void OnTabChange(EntityUid uid, AirAlarmComponent component, AirAlarmTabSetMessage msg) - { - component.CurrentTab = msg.Tab; - UpdateUI(uid, component); - } - private void OnPowerChanged(EntityUid uid, AirAlarmComponent component, ref PowerChangedEvent args) { if (args.Powered) @@ -598,34 +591,19 @@ public sealed class AirAlarmSystem : EntitySystem var pressure = CalculatePressureAverage(alarm); var temperature = CalculateTemperatureAverage(alarm); - var dataToSend = new Dictionary(); + var dataToSend = new List<(string, IAtmosDeviceData)>(); - if (alarm.CurrentTab != AirAlarmTab.Settings) + foreach (var (addr, data) in alarm.VentData) { - switch (alarm.CurrentTab) - { - case AirAlarmTab.Vent: - foreach (var (addr, data) in alarm.VentData) - { - dataToSend.Add(addr, data); - } - - break; - case AirAlarmTab.Scrubber: - foreach (var (addr, data) in alarm.ScrubberData) - { - dataToSend.Add(addr, data); - } - - break; - case AirAlarmTab.Sensors: - foreach (var (addr, data) in alarm.SensorData) - { - dataToSend.Add(addr, data); - } - - break; - } + dataToSend.Add((addr, data)); + } + foreach (var (addr, data) in alarm.ScrubberData) + { + dataToSend.Add((addr, data)); + } + foreach (var (addr, data) in alarm.SensorData) + { + dataToSend.Add((addr, data)); } var deviceCount = alarm.KnownDevices.Count; @@ -638,7 +616,7 @@ public sealed class AirAlarmSystem : EntitySystem _ui.SetUiState( uid, SharedAirAlarmInterfaceKey.Key, - new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, highestAlarm.Value, alarm.AutoMode)); + new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, highestAlarm.Value, alarm.AutoMode)); } private const float Delay = 8f; diff --git a/Content.Shared/Atmos/Monitor/Components/SharedAirAlarmComponent.cs b/Content.Shared/Atmos/Monitor/Components/SharedAirAlarmComponent.cs index e40099dc72..ce3f00094a 100644 --- a/Content.Shared/Atmos/Monitor/Components/SharedAirAlarmComponent.cs +++ b/Content.Shared/Atmos/Monitor/Components/SharedAirAlarmComponent.cs @@ -37,7 +37,7 @@ public interface IAtmosDeviceData [Serializable, NetSerializable] public sealed class AirAlarmUIState : BoundUserInterfaceState { - public AirAlarmUIState(string address, int deviceCount, float pressureAverage, float temperatureAverage, Dictionary deviceData, AirAlarmMode mode, AirAlarmTab tab, AtmosAlarmType alarmType, bool autoMode) + public AirAlarmUIState(string address, int deviceCount, float pressureAverage, float temperatureAverage, List<(string, IAtmosDeviceData)> deviceData, AirAlarmMode mode, AtmosAlarmType alarmType, bool autoMode) { Address = address; DeviceCount = deviceCount; @@ -45,7 +45,6 @@ public sealed class AirAlarmUIState : BoundUserInterfaceState TemperatureAverage = temperatureAverage; DeviceData = deviceData; Mode = mode; - Tab = tab; AlarmType = alarmType; AutoMode = autoMode; } @@ -57,27 +56,16 @@ public sealed class AirAlarmUIState : BoundUserInterfaceState /// /// Every single device data that can be seen from this /// air alarm. This includes vents, scrubbers, and sensors. - /// The device data you get, however, depends on the current - /// selected tab. + /// Each entry is a tuple of device address and the device + /// data. The same address may appear multiple times, if + /// that device provides multiple functions. /// - public Dictionary DeviceData { get; } + public List<(string, IAtmosDeviceData)> DeviceData { get; } public AirAlarmMode Mode { get; } - public AirAlarmTab Tab { get; } public AtmosAlarmType AlarmType { get; } public bool AutoMode { get; } } -[Serializable, NetSerializable] -public sealed class AirAlarmTabSetMessage : BoundUserInterfaceMessage -{ - public AirAlarmTabSetMessage(AirAlarmTab tab) - { - Tab = tab; - } - - public AirAlarmTab Tab { get; } -} - [Serializable, NetSerializable] public sealed class AirAlarmResyncAllDevicesMessage : BoundUserInterfaceMessage {} @@ -144,11 +132,3 @@ public sealed class AirAlarmUpdateAlarmThresholdMessage : BoundUserInterfaceMess Gas = gas; } } - -public enum AirAlarmTab -{ - Vent, - Scrubber, - Sensors, - Settings -}