From 912b23e41437ebf4b8b6236a6719bb77cd30cfe4 Mon Sep 17 00:00:00 2001 From: vulppine Date: Mon, 22 Aug 2022 10:05:39 -0700 Subject: [PATCH] fire alarms (and anything that uses Reset/ForceAlert) should now update their appearance and play noises --- .../Monitor/Systems/AtmosAlarmableSystem.cs | 17 +++++++++-------- .../Structures/Wallmounts/fire_alarm.yml | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs index 05efccbb01..3a14caa528 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs @@ -132,17 +132,21 @@ namespace Content.Server.Atmos.Monitor.Systems } } - private void TryUpdateAlert(EntityUid uid, AtmosMonitorAlarmType type, AtmosAlarmableComponent alarmable) + private void TryUpdateAlert(EntityUid uid, AtmosMonitorAlarmType type, AtmosAlarmableComponent alarmable, bool sync = true) { if (alarmable.LastAlarmState == type) { return; } + if (sync) + { + SyncAlertsToNetwork(uid, null, alarmable); + } + alarmable.LastAlarmState = type; UpdateAppearance(uid, type); PlayAlertSound(uid, type, alarmable); - SyncAlertsToNetwork(uid, null, alarmable); RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(type, type), true); } @@ -178,9 +182,7 @@ namespace Content.Server.Atmos.Monitor.Systems return; } - alarmable.LastAlarmState = alarmType; - - RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(alarmType, alarmType)); + TryUpdateAlert(uid, alarmType, alarmable, false); if (alarmable.ReceiveOnly) { @@ -214,10 +216,9 @@ namespace Content.Server.Atmos.Monitor.Systems return; } - alarmable.LastAlarmState = AtmosMonitorAlarmType.Normal; - alarmable.NetworkAlarmStates.Clear(); + TryUpdateAlert(uid, AtmosMonitorAlarmType.Normal, alarmable, false); - RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(AtmosMonitorAlarmType.Normal, AtmosMonitorAlarmType.Normal)); + alarmable.NetworkAlarmStates.Clear(); } public void ResetAllOnNetwork(EntityUid uid, AtmosAlarmableComponent? alarmable = null, TagComponent? tags = null) diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml index 73b2b80189..7c63eee826 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml @@ -15,7 +15,7 @@ transmitFrequencyId: AtmosMonitor sendBroadcastAttemptEvent: true - type: DeviceList - - type: ApcNetworkConnection + - type: WiredNetworkConnection - type: AtmosMonitor monitorFire: true displayMaxAlarmInNet: true