Air alarm patches (#11004)
This commit is contained in:
@@ -31,7 +31,7 @@ public sealed class AtmosAlarmableComponent : Component
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<string, AtmosAlarmType> NetworkAlarmStates = new();
|
||||
|
||||
[ViewVariables] public AtmosAlarmType LastAlarmState = AtmosAlarmType.Normal;
|
||||
[ViewVariables] public AtmosAlarmType LastAlarmState = AtmosAlarmType.Invalid;
|
||||
|
||||
[ViewVariables] public bool IgnoreAlarms { get; set; } = false;
|
||||
|
||||
|
||||
@@ -178,19 +178,17 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
|
||||
private void OnPowerChanged(EntityUid uid, AirAlarmComponent component, PowerChangedEvent args)
|
||||
{
|
||||
if (!args.Powered)
|
||||
if (args.Powered)
|
||||
{
|
||||
ForceCloseAllInterfaces(uid);
|
||||
component.CurrentModeUpdater = null;
|
||||
component.KnownDevices.Clear();
|
||||
component.ScrubberData.Clear();
|
||||
component.SensorData.Clear();
|
||||
component.VentData.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
SyncAllDevices(uid);
|
||||
return;
|
||||
}
|
||||
|
||||
ForceCloseAllInterfaces(uid);
|
||||
component.CurrentModeUpdater = null;
|
||||
component.KnownDevices.Clear();
|
||||
component.ScrubberData.Clear();
|
||||
component.SensorData.Clear();
|
||||
component.VentData.Clear();
|
||||
}
|
||||
|
||||
private void OnClose(EntityUid uid, AirAlarmComponent component, BoundUIClosedEvent args)
|
||||
|
||||
@@ -18,6 +18,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly AudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
|
||||
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNetSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// An alarm. Has three valid states: Normal, Warning, Danger.
|
||||
@@ -41,12 +42,12 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<AtmosAlarmableComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<AtmosAlarmableComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<AtmosAlarmableComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
|
||||
SubscribeLocalEvent<AtmosAlarmableComponent, PowerChangedEvent>(OnPowerChange);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, AtmosAlarmableComponent component, ComponentInit args)
|
||||
private void OnMapInit(EntityUid uid, AtmosAlarmableComponent component, MapInitEvent args)
|
||||
{
|
||||
TryUpdateAlert(
|
||||
uid,
|
||||
@@ -63,6 +64,10 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
}
|
||||
else
|
||||
{
|
||||
// sussy
|
||||
_atmosDevNetSystem.Register(uid, null);
|
||||
_atmosDevNetSystem.Sync(uid, null);
|
||||
|
||||
TryUpdateAlert(
|
||||
uid,
|
||||
TryGetHighestAlert(uid, out var alarm) ? alarm.Value : AtmosAlarmType.Normal,
|
||||
|
||||
Reference in New Issue
Block a user