From d3244b604926ec89563c9d6eb05740dde7de36a4 Mon Sep 17 00:00:00 2001 From: Ilya246 <57039557+Ilya246@users.noreply.github.com> Date: Wed, 9 Aug 2023 22:20:19 +0400 Subject: [PATCH] copy-settings-to-all-similar for scrubbers and vents in air alarms (#18363) --- .../Monitor/UI/AirAlarmBoundUserInterface.cs | 6 +++++ .../Atmos/Monitor/UI/AirAlarmWindow.xaml.cs | 3 +++ .../Atmos/Monitor/UI/Widgets/PumpControl.xaml | 5 +++- .../Monitor/UI/Widgets/PumpControl.xaml.cs | 7 +++++ .../Monitor/UI/Widgets/ScrubberControl.xaml | 5 +++- .../UI/Widgets/ScrubberControl.xaml.cs | 7 +++++ .../Atmos/Monitor/Systems/AirAlarmSystem.cs | 27 +++++++++++++++++++ .../Components/SharedAirAlarmComponent.cs | 11 ++++++++ Resources/Locale/en-US/atmos/air-alarm-ui.ftl | 2 ++ 9 files changed, 71 insertions(+), 2 deletions(-) diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs index aea0ce41e8..3f7f1e73ee 100644 --- a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs +++ b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs @@ -31,6 +31,7 @@ public sealed class AirAlarmBoundUserInterface : BoundUserInterface _window.OnClose += Close; _window.AtmosDeviceDataChanged += OnDeviceDataChanged; + _window.AtmosDeviceDataCopied += OnDeviceDataCopied; _window.AtmosAlarmThresholdChanged += OnThresholdChanged; _window.AirAlarmModeChanged += OnAirAlarmModeChanged; _window.AutoModeChanged += OnAutoModeChanged; @@ -47,6 +48,11 @@ public sealed class AirAlarmBoundUserInterface : BoundUserInterface { SendMessage(new AirAlarmUpdateDeviceDataMessage(address, data)); } + + private void OnDeviceDataCopied(IAtmosDeviceData data) + { + SendMessage(new AirAlarmCopyDeviceDataMessage(data)); + } private void OnAirAlarmModeChanged(AirAlarmMode mode) { diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs index 105394b648..de26eb5f19 100644 --- a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs +++ b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs @@ -18,6 +18,7 @@ namespace Content.Client.Atmos.Monitor.UI; public sealed partial class AirAlarmWindow : FancyWindow { public event Action? AtmosDeviceDataChanged; + public event Action? AtmosDeviceDataCopied; public event Action? AtmosAlarmThresholdChanged; public event Action? AirAlarmModeChanged; public event Action? AutoModeChanged; @@ -137,6 +138,7 @@ public sealed partial class AirAlarmWindow : FancyWindow { var control= new PumpControl(pump, addr); control.PumpDataChanged += AtmosDeviceDataChanged!.Invoke; + control.PumpDataCopied += AtmosDeviceDataCopied!.Invoke; _pumps.Add(addr, control); CVentContainer.AddChild(control); } @@ -151,6 +153,7 @@ public sealed partial class AirAlarmWindow : FancyWindow { var control = new ScrubberControl(scrubber, addr); control.ScrubberDataChanged += AtmosDeviceDataChanged!.Invoke; + control.ScrubberDataCopied += AtmosDeviceDataCopied!.Invoke; _scrubbers.Add(addr, control); CScrubberContainer.AddChild(control); } diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml b/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml index ad0e31fbfd..632e44a458 100644 --- a/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml +++ b/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml @@ -19,7 +19,7 @@ - + + +