air sensor model (works well enough)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user