diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs
index 0bd310c57c..aea0ce41e8 100644
--- a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs
+++ b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs
@@ -33,6 +33,7 @@ public sealed class AirAlarmBoundUserInterface : BoundUserInterface
_window.AtmosDeviceDataChanged += OnDeviceDataChanged;
_window.AtmosAlarmThresholdChanged += OnThresholdChanged;
_window.AirAlarmModeChanged += OnAirAlarmModeChanged;
+ _window.AutoModeChanged += OnAutoModeChanged;
_window.ResyncAllRequested += ResyncAllDevices;
_window.AirAlarmTabChange += OnTabChanged;
}
@@ -52,6 +53,11 @@ public sealed class AirAlarmBoundUserInterface : BoundUserInterface
SendMessage(new AirAlarmUpdateAlarmModeMessage(mode));
}
+ private void OnAutoModeChanged(bool enabled)
+ {
+ SendMessage(new AirAlarmUpdateAutoModeMessage(enabled));
+ }
+
private void OnThresholdChanged(string address, AtmosMonitorThresholdType type, AtmosAlarmThreshold threshold, Gas? gas = null)
{
SendMessage(new AirAlarmUpdateAlarmThresholdMessage(address, type, threshold, gas));
diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml
index 3e43e4543f..1d87611949 100644
--- a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml
+++ b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml
@@ -75,6 +75,7 @@
+
diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
index bb3f0dcbfa..105394b648 100644
--- a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
+++ b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
@@ -20,6 +20,7 @@ public sealed partial class AirAlarmWindow : FancyWindow
public event Action? AtmosDeviceDataChanged;
public event Action? AtmosAlarmThresholdChanged;
public event Action? AirAlarmModeChanged;
+ public event Action? AutoModeChanged;
public event Action? ResyncDeviceRequested;
public event Action? ResyncAllRequested;
public event Action? AirAlarmTabChange;
@@ -44,6 +45,8 @@ public sealed partial class AirAlarmWindow : FancyWindow
private OptionButton _modes => CModeButton;
+ private CheckBox _autoMode => AutoModeCheckBox;
+
public AirAlarmWindow(BoundUserInterface owner)
{
RobustXamlLoader.Load(this);
@@ -68,6 +71,11 @@ public sealed partial class AirAlarmWindow : FancyWindow
AirAlarmModeChanged!.Invoke((AirAlarmMode) args.Id);
};
+ _autoMode.OnToggled += args =>
+ {
+ AutoModeChanged!.Invoke(_autoMode.Pressed);
+ };
+
_tabContainer.SetTabTitle(0, Loc.GetString("air-alarm-ui-window-tab-vents"));
_tabContainer.SetTabTitle(1, Loc.GetString("air-alarm-ui-window-tab-scrubbers"));
_tabContainer.SetTabTitle(2, Loc.GetString("air-alarm-ui-window-tab-sensors"));
@@ -101,6 +109,7 @@ public sealed partial class AirAlarmWindow : FancyWindow
("color", ColorForAlarm(state.AlarmType)),
("state", $"{state.AlarmType}")));
UpdateModeSelector(state.Mode);
+ UpdateAutoMode(state.AutoMode);
foreach (var (addr, dev) in state.DeviceData)
{
UpdateDeviceData(addr, dev);
@@ -114,6 +123,11 @@ public sealed partial class AirAlarmWindow : FancyWindow
_modes.SelectId((int) mode);
}
+ public void UpdateAutoMode(bool enabled)
+ {
+ _autoMode.Pressed = enabled;
+ }
+
public void UpdateDeviceData(string addr, IAtmosDeviceData device)
{
switch (device)
diff --git a/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs b/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs
index 67e18b8f9e..d0c1a3a86c 100644
--- a/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs
+++ b/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs
@@ -9,6 +9,7 @@ namespace Content.Server.Atmos.Monitor.Components;
public sealed class AirAlarmComponent : Component
{
[ViewVariables] public AirAlarmMode CurrentMode { get; set; } = AirAlarmMode.Filtering;
+ [ViewVariables] public bool AutoMode { get; set; } = true;
// Remember to null this afterwards.
[ViewVariables] public IAirAlarmModeUpdate? CurrentModeUpdater { get; set; }
diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs
index 7eedad2c37..dd3ec5c949 100644
--- a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs
+++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs
@@ -157,6 +157,7 @@ public sealed class AirAlarmSystem : EntitySystem
SubscribeLocalEvent(OnPowerChanged);
SubscribeLocalEvent(OnResyncAll);
SubscribeLocalEvent(OnUpdateAlarmMode);
+ SubscribeLocalEvent(OnUpdateAutoMode);
SubscribeLocalEvent(OnUpdateThreshold);
SubscribeLocalEvent(OnUpdateDeviceData);
SubscribeLocalEvent(OnTabChange);
@@ -273,6 +274,12 @@ public sealed class AirAlarmSystem : EntitySystem
UpdateUI(uid, component);
}
+ private void OnUpdateAutoMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAutoModeMessage args)
+ {
+ component.AutoMode = args.Enabled;
+ UpdateUI(uid, component);
+ }
+
private void OnUpdateThreshold(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmThresholdMessage args)
{
if (AccessCheck(uid, args.Session.AttachedEntity, component))
@@ -317,13 +324,16 @@ public sealed class AirAlarmSystem : EntitySystem
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn))
addr = netConn.Address;
- if (args.AlarmType == AtmosAlarmType.Danger)
+ if (component.AutoMode)
{
- SetMode(uid, addr, AirAlarmMode.WideFiltering, false);
- }
- else if (args.AlarmType == AtmosAlarmType.Normal || args.AlarmType == AtmosAlarmType.Warning)
- {
- SetMode(uid, addr, AirAlarmMode.Filtering, false);
+ if (args.AlarmType == AtmosAlarmType.Danger)
+ {
+ SetMode(uid, addr, AirAlarmMode.WideFiltering, false);
+ }
+ else if (args.AlarmType == AtmosAlarmType.Normal || args.AlarmType == AtmosAlarmType.Warning)
+ {
+ SetMode(uid, addr, AirAlarmMode.Filtering, false);
+ }
}
UpdateUI(uid, component);
@@ -545,7 +555,7 @@ public sealed class AirAlarmSystem : EntitySystem
_uiSystem.TrySetUiState(
uid,
SharedAirAlarmInterfaceKey.Key,
- new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, highestAlarm.Value));
+ new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, 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 5c50f85c17..a31b7624e2 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)
+ public AirAlarmUIState(string address, int deviceCount, float pressureAverage, float temperatureAverage, Dictionary deviceData, AirAlarmMode mode, AirAlarmTab tab, AtmosAlarmType alarmType, bool autoMode)
{
Address = address;
DeviceCount = deviceCount;
@@ -47,6 +47,7 @@ public sealed class AirAlarmUIState : BoundUserInterfaceState
Mode = mode;
Tab = tab;
AlarmType = alarmType;
+ AutoMode = autoMode;
}
public string Address { get; }
@@ -63,6 +64,7 @@ public sealed class AirAlarmUIState : BoundUserInterfaceState
public AirAlarmMode Mode { get; }
public AirAlarmTab Tab { get; }
public AtmosAlarmType AlarmType { get; }
+ public bool AutoMode { get; }
}
[Serializable, NetSerializable]
@@ -91,6 +93,17 @@ public sealed class AirAlarmUpdateAlarmModeMessage : BoundUserInterfaceMessage
}
}
+[Serializable, NetSerializable]
+public sealed class AirAlarmUpdateAutoModeMessage : BoundUserInterfaceMessage
+{
+ public bool Enabled { get; }
+
+ public AirAlarmUpdateAutoModeMessage(bool enabled)
+ {
+ Enabled = enabled;
+ }
+}
+
[Serializable, NetSerializable]
public sealed class AirAlarmUpdateDeviceDataMessage : BoundUserInterfaceMessage
{
diff --git a/Resources/Locale/en-US/atmos/air-alarm-ui.ftl b/Resources/Locale/en-US/atmos/air-alarm-ui.ftl
index 64bd51fd65..b4444f75a5 100644
--- a/Resources/Locale/en-US/atmos/air-alarm-ui.ftl
+++ b/Resources/Locale/en-US/atmos/air-alarm-ui.ftl
@@ -13,6 +13,7 @@ air-alarm-ui-window-device-count-label = Total Devices
air-alarm-ui-window-resync-devices-label = Resync
air-alarm-ui-window-mode-label = Mode
+air-alarm-ui-window-auto-mode-label = Auto mode
air-alarm-ui-window-pressure = {$pressure} kPa
air-alarm-ui-window-pressure-indicator = Pressure: [color={$color}]{$pressure} kPa[/color]