Air alarm patches (#11004)
This commit is contained in:
@@ -31,7 +31,7 @@ public sealed class AtmosAlarmableComponent : Component
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public readonly Dictionary<string, AtmosAlarmType> NetworkAlarmStates = new();
|
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;
|
[ViewVariables] public bool IgnoreAlarms { get; set; } = false;
|
||||||
|
|
||||||
|
|||||||
@@ -178,8 +178,11 @@ public sealed class AirAlarmSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnPowerChanged(EntityUid uid, AirAlarmComponent component, PowerChangedEvent args)
|
private void OnPowerChanged(EntityUid uid, AirAlarmComponent component, PowerChangedEvent args)
|
||||||
{
|
{
|
||||||
if (!args.Powered)
|
if (args.Powered)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ForceCloseAllInterfaces(uid);
|
ForceCloseAllInterfaces(uid);
|
||||||
component.CurrentModeUpdater = null;
|
component.CurrentModeUpdater = null;
|
||||||
component.KnownDevices.Clear();
|
component.KnownDevices.Clear();
|
||||||
@@ -187,11 +190,6 @@ public sealed class AirAlarmSystem : EntitySystem
|
|||||||
component.SensorData.Clear();
|
component.SensorData.Clear();
|
||||||
component.VentData.Clear();
|
component.VentData.Clear();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SyncAllDevices(uid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnClose(EntityUid uid, AirAlarmComponent component, BoundUIClosedEvent args)
|
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 AppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly AudioSystem _audioSystem = default!;
|
[Dependency] private readonly AudioSystem _audioSystem = default!;
|
||||||
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
|
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
|
||||||
|
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNetSystem = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An alarm. Has three valid states: Normal, Warning, Danger.
|
/// An alarm. Has three valid states: Normal, Warning, Danger.
|
||||||
@@ -41,12 +42,12 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<AtmosAlarmableComponent, ComponentInit>(OnInit);
|
SubscribeLocalEvent<AtmosAlarmableComponent, MapInitEvent>(OnMapInit);
|
||||||
SubscribeLocalEvent<AtmosAlarmableComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
|
SubscribeLocalEvent<AtmosAlarmableComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
|
||||||
SubscribeLocalEvent<AtmosAlarmableComponent, PowerChangedEvent>(OnPowerChange);
|
SubscribeLocalEvent<AtmosAlarmableComponent, PowerChangedEvent>(OnPowerChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInit(EntityUid uid, AtmosAlarmableComponent component, ComponentInit args)
|
private void OnMapInit(EntityUid uid, AtmosAlarmableComponent component, MapInitEvent args)
|
||||||
{
|
{
|
||||||
TryUpdateAlert(
|
TryUpdateAlert(
|
||||||
uid,
|
uid,
|
||||||
@@ -63,6 +64,10 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// sussy
|
||||||
|
_atmosDevNetSystem.Register(uid, null);
|
||||||
|
_atmosDevNetSystem.Sync(uid, null);
|
||||||
|
|
||||||
TryUpdateAlert(
|
TryUpdateAlert(
|
||||||
uid,
|
uid,
|
||||||
TryGetHighestAlert(uid, out var alarm) ? alarm.Value : AtmosAlarmType.Normal,
|
TryGetHighestAlert(uid, out var alarm) ? alarm.Value : AtmosAlarmType.Normal,
|
||||||
|
|||||||
@@ -258,6 +258,11 @@ namespace Content.Server.DeviceNetwork.Systems
|
|||||||
|
|
||||||
private void SendToConnections(ReadOnlySpan<DeviceNetworkComponent> connections, DeviceNetworkPacketEvent packet)
|
private void SendToConnections(ReadOnlySpan<DeviceNetworkComponent> connections, DeviceNetworkPacketEvent packet)
|
||||||
{
|
{
|
||||||
|
if (Deleted(packet.Sender))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var xform = Transform(packet.Sender);
|
var xform = Transform(packet.Sender);
|
||||||
|
|
||||||
BeforePacketSentEvent beforeEv = new(packet.Sender, xform, _transformSystem.GetWorldPosition(xform));
|
BeforePacketSentEvent beforeEv = new(packet.Sender, xform, _transformSystem.GetWorldPosition(xform));
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ namespace Content.Shared.Atmos.Monitor;
|
|||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum AtmosAlarmType : sbyte
|
public enum AtmosAlarmType : sbyte
|
||||||
{
|
{
|
||||||
Normal = 0,
|
Invalid = 0,
|
||||||
Warning = 1,
|
Normal = 1,
|
||||||
Danger = 2, // 1 << 1 is the exact same thing and we're not really doing **bitmasking** are we?
|
Warning = 2,
|
||||||
Emagged = 3,
|
Danger = 3,
|
||||||
|
Emagged = 4,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,8 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: AirAlarm
|
graph: AirAlarm
|
||||||
node: assembly
|
node: assembly
|
||||||
|
- type: Transform
|
||||||
|
anchored: true
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
snap:
|
snap:
|
||||||
|
|||||||
@@ -91,6 +91,8 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: FireAlarm
|
graph: FireAlarm
|
||||||
node: assembly
|
node: assembly
|
||||||
|
- type: Transform
|
||||||
|
anchored: true
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
snap:
|
snap:
|
||||||
|
|||||||
Reference in New Issue
Block a user