diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs index a8b8ea5d32..c153e782c6 100644 --- a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs @@ -379,6 +379,50 @@ namespace Content.Server.Atmos.Monitor.Systems SetData(uid, address, devData); } + private void OnAtmosAlarm(EntityUid uid, AirAlarmComponent component, NetworkPayload args) + { + if (component.ActivePlayers.Count != 0) + { + SyncAllDevices(uid); + SendAirData(uid); + } + + string addr = string.Empty; + if (TryComp(uid, out DeviceNetworkComponent? netConn)) + { + addr = netConn.Address; + } + + if (!args.TryGetValue(AtmosMonitorSystem.AtmosMonitorAlarmNetMax, out AtmosMonitorAlarmType? highestNetworkType)) + { + return; + } + + // set this air alarm's visuals to match the highest network alarm + if (TryComp(uid, out AppearanceComponent? appearanceComponent)) + { + appearanceComponent.SetData(AtmosMonitorVisuals.AlarmType, highestNetworkType); + } + + if (highestNetworkType == AtmosMonitorAlarmType.Danger) + { + SetMode(uid, addr, AirAlarmMode.None, true); + // set mode to off to mimic the vents/scrubbers being turned off + // update UI + // + // no, the mode isn't processed here - it's literally just + // set to what mimics 'off' + } + else if (highestNetworkType == AtmosMonitorAlarmType.Normal) + { + // if the mode is still set to off, set it to filtering instead + // alternatively, set it to the last saved mode + // + // no, this still doesn't execute the mode + SetMode(uid, addr, AirAlarmMode.Filtering, true); + } + } + private void OnPacketRecv(EntityUid uid, AirAlarmComponent controller, DeviceNetworkPacketEvent args) { if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd)) @@ -388,8 +432,8 @@ namespace Content.Server.Atmos.Monitor.Systems { case AirAlarmSyncData: if (!args.Data.TryGetValue(AirAlarmSyncData, out IAtmosDeviceData? data) - || data == null - || !controller.CanSync) break; + || !controller.CanSync) + break; // Save into component. // Sync data to interface. @@ -402,7 +446,8 @@ namespace Content.Server.Atmos.Monitor.Systems return; case AirAlarmSetDataStatus: - if (!args.Data.TryGetValue(AirAlarmSetDataStatus, out bool dataStatus)) break; + if (!args.Data.TryGetValue(AirAlarmSetDataStatus, out bool dataStatus)) + break; // Sync data to interface. // This should say if the result diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs index c3f3300d11..b7f11ba996 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs @@ -111,8 +111,10 @@ namespace Content.Server.Atmos.Monitor.Systems public override void Update(float frameTime) { + /* NOPE foreach (var uid in _checkPos) OpenAirOrReposition(uid); + */ } private void OpenAirOrReposition(EntityUid uid, AtmosMonitorComponent? component = null, AppearanceComponent? appearance = null) diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index 2963e17f6f..bdddfa018f 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -31,9 +31,28 @@ receiveFrequencyId: AtmosMonitor transmitFrequencyId: AtmosMonitor prefix: device-address-prefix-vent + sendBroadcastAttemptEvent: true + - type: DeviceList + - type: WiredNetworkConnection - type: AtmosAlarmable alarmedBy: - - AirAlarm + - GasVentPump # TODO: No + - type: AtmosDevice + - type: AtmosMonitor + temperatureThreshold: stationTemperature + pressureThreshold: stationPressure + gasThresholds: + Oxygen: stationOxygen + Nitrogen: ignore + CarbonDioxide: stationCO2 + Plasma: danger # everything below is usually bad + Tritium: danger + WaterVapor: danger + Miasma: danger + NitrousOxide: danger + Frezon: danger + - type: AccessReader + access: [ [ "Atmospherics" ] ] - type: Sprite netsync: false drawdepth: FloorObjects diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml index 1b82ae3696..0860acdea2 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml @@ -16,21 +16,8 @@ sendBroadcastAttemptEvent: true - type: WiredNetworkConnection - type: DeviceList - - type: AtmosMonitor - temperatureThreshold: stationTemperature - pressureThreshold: stationPressure - gasThresholds: - Oxygen: stationOxygen - Nitrogen: ignore - CarbonDioxide: stationCO2 - Plasma: danger # everything below is usually bad - Tritium: danger - WaterVapor: danger - Miasma: danger - NitrousOxide: danger - Frezon: danger - type: AtmosAlarmable - alarmedBy: ["AirAlarm"] + alarmedBy: ["GasVentPump"] - type: AtmosDevice - type: AirAlarm - type: Clickable