tag sync, replaces monitor references with alarmable references
This commit is contained in:
@@ -33,40 +33,19 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
|
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
|
||||||
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNetSystem = default!;
|
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNetSystem = default!;
|
||||||
|
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
[Dependency] private readonly AccessReaderSystem _accessSystem = default!;
|
[Dependency] private readonly AccessReaderSystem _accessSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
|
|
||||||
#region Device Network API
|
#region Device Network API
|
||||||
/// <summary>
|
|
||||||
/// Command to set device data within the air alarm's network.
|
|
||||||
/// </summary>
|
|
||||||
public const string AirAlarmSetData = "air_alarm_set_device_data";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Command to request a sync from devices in an air alarm's network.
|
|
||||||
/// </summary>
|
|
||||||
public const string AirAlarmSyncCmd = "air_alarm_sync_devices";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Command to set an air alarm's mode.
|
/// Command to set an air alarm's mode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string AirAlarmSetMode = "air_alarm_set_mode";
|
public const string AirAlarmSetMode = "air_alarm_set_mode";
|
||||||
|
|
||||||
// -- Packet Data --
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Data response to an AirAlarmSetData command.
|
|
||||||
/// </summary>
|
|
||||||
public const string AirAlarmSetDataStatus = "air_alarm_set_device_data_status";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Data response to an AirAlarmSync command. Contains
|
|
||||||
/// IAtmosDeviceData in this system's implementation.
|
|
||||||
/// </summary>
|
|
||||||
public const string AirAlarmSyncData = "air_alarm_device_sync_data";
|
|
||||||
|
|
||||||
// -- API --
|
// -- API --
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -408,7 +387,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case AtmosDeviceNetworkSystem.SyncData:
|
case AtmosDeviceNetworkSystem.SyncData:
|
||||||
if (!args.Data.TryGetValue(AirAlarmSyncData, out IAtmosDeviceData? data)
|
if (!args.Data.TryGetValue(AtmosDeviceNetworkSystem.SyncData, out IAtmosDeviceData? data)
|
||||||
|| !controller.CanSync)
|
|| !controller.CanSync)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -532,10 +511,15 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
|
|
||||||
var deviceCount = alarm.VentData.Count + alarm.ScrubberData.Count + alarm.SensorData.Count;
|
var deviceCount = alarm.VentData.Count + alarm.ScrubberData.Count + alarm.SensorData.Count;
|
||||||
|
|
||||||
|
if (!_atmosAlarmable.TryGetHighestAlert(uid, out var highestAlarm))
|
||||||
|
{
|
||||||
|
highestAlarm = AtmosMonitorAlarmType.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
_uiSystem.TrySetUiState(
|
_uiSystem.TrySetUiState(
|
||||||
uid,
|
uid,
|
||||||
SharedAirAlarmInterfaceKey.Key,
|
SharedAirAlarmInterfaceKey.Key,
|
||||||
new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, alarmable.HighestNetworkState));
|
new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, highestAlarm.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
private const float _delay = 8f;
|
private const float _delay = 8f;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.DeviceNetwork.Components;
|
|||||||
using Content.Server.DeviceNetwork.Systems;
|
using Content.Server.DeviceNetwork.Systems;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.Atmos.Monitor;
|
using Content.Shared.Atmos.Monitor;
|
||||||
|
using Content.Shared.Tag;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -57,7 +58,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd)
|
if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd)
|
||||||
|| !args.Data.TryGetValue(AlertSource, out List<string>? sourceTags))
|
|| !args.Data.TryGetValue(AlertSource, out HashSet<string>? sourceTags))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -101,11 +102,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
netMax = AtmosMonitorAlarmType.Normal;
|
netMax = AtmosMonitorAlarmType.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
component.LastAlarmState = netMax.Value;
|
TryUpdateAlert(uid, netMax.Value, component);
|
||||||
|
|
||||||
UpdateAppearance(uid, netMax.Value);
|
|
||||||
PlayAlertSound(uid, netMax.Value, component);
|
|
||||||
RaiseLocalEvent(component.Owner, new AtmosMonitorAlarmEvent(state, netMax.Value), true);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ResetAll:
|
case ResetAll:
|
||||||
@@ -128,20 +125,32 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TryGetHighestAlert(uid, out var maxAlert, component)
|
if (TryGetHighestAlert(uid, out var maxAlert, component))
|
||||||
&& component.LastAlarmState < maxAlert)
|
|
||||||
{
|
{
|
||||||
component.LastAlarmState = maxAlert.Value;
|
TryUpdateAlert(uid, maxAlert.Value, component);
|
||||||
RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(maxAlert.Value, maxAlert.Value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SyncAlertsToNetwork(EntityUid uid, string? address = null, AtmosAlarmableComponent? alarmable = null)
|
private void TryUpdateAlert(EntityUid uid, AtmosMonitorAlarmType type, AtmosAlarmableComponent alarmable)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref alarmable) || alarmable.ReceiveOnly)
|
if (alarmable.LastAlarmState == type)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
alarmable.LastAlarmState = type;
|
||||||
|
UpdateAppearance(uid, type);
|
||||||
|
PlayAlertSound(uid, type, alarmable);
|
||||||
|
SyncAlertsToNetwork(uid, null, alarmable);
|
||||||
|
RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(type, type), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SyncAlertsToNetwork(EntityUid uid, string? address = null, AtmosAlarmableComponent? alarmable = null, TagComponent? tags = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref alarmable, ref tags) || alarmable.ReceiveOnly)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -150,7 +159,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
{
|
{
|
||||||
[DeviceNetworkConstants.Command] = SyncAlerts,
|
[DeviceNetworkConstants.Command] = SyncAlerts,
|
||||||
[SyncAlerts] = alarmable.NetworkAlarmStates,
|
[SyncAlerts] = alarmable.NetworkAlarmStates,
|
||||||
[AlertSource] = alarmable.SyncWithTags
|
[AlertSource] = tags.Tags
|
||||||
};
|
};
|
||||||
|
|
||||||
_deviceNet.QueuePacket(uid, address, payload);
|
_deviceNet.QueuePacket(uid, address, payload);
|
||||||
@@ -158,22 +167,28 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Forces this alarmable to have a specific alert. This will not be reset until the alarmable
|
/// Forces this alarmable to have a specific alert. This will not be reset until the alarmable
|
||||||
/// is manually reset. This will store the alarmable as a device in its network states, and sync
|
/// is manually reset. This will store the alarmable as a device in its network states.
|
||||||
/// it to the rest of the network.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uid"></param>
|
/// <param name="uid"></param>
|
||||||
/// <param name="alarmType"></param>
|
/// <param name="alarmType"></param>
|
||||||
/// <param name="alarmable"></param>
|
/// <param name="alarmable"></param>
|
||||||
public void ForceAlert(EntityUid uid, AtmosMonitorAlarmType alarmType,
|
public void ForceAlert(EntityUid uid, AtmosMonitorAlarmType alarmType,
|
||||||
AtmosAlarmableComponent? alarmable = null, DeviceNetworkComponent? devNet = null)
|
AtmosAlarmableComponent? alarmable = null, DeviceNetworkComponent? devNet = null, TagComponent? tags = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref alarmable, ref devNet))
|
if (!Resolve(uid, ref alarmable, ref devNet, ref tags))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
alarmable.LastAlarmState = alarmType;
|
alarmable.LastAlarmState = alarmType;
|
||||||
|
|
||||||
|
RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(alarmType, alarmType));
|
||||||
|
|
||||||
|
if (alarmable.ReceiveOnly)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!alarmable.NetworkAlarmStates.TryAdd(devNet.Address, alarmType))
|
if (!alarmable.NetworkAlarmStates.TryAdd(devNet.Address, alarmType))
|
||||||
{
|
{
|
||||||
alarmable.NetworkAlarmStates[devNet.Address] = alarmType;
|
alarmable.NetworkAlarmStates[devNet.Address] = alarmType;
|
||||||
@@ -183,12 +198,10 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
{
|
{
|
||||||
[DeviceNetworkConstants.Command] = AlertCmd,
|
[DeviceNetworkConstants.Command] = AlertCmd,
|
||||||
[DeviceNetworkConstants.CmdSetState] = alarmType,
|
[DeviceNetworkConstants.CmdSetState] = alarmType,
|
||||||
[AlertSource] = alarmable.SyncWithTags
|
[AlertSource] = tags.Tags
|
||||||
};
|
};
|
||||||
|
|
||||||
_deviceNet.QueuePacket(uid, null, payload);
|
_deviceNet.QueuePacket(uid, null, payload);
|
||||||
|
|
||||||
RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(alarmType, alarmType));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -206,24 +219,22 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
alarmable.LastAlarmState = AtmosMonitorAlarmType.Normal;
|
alarmable.LastAlarmState = AtmosMonitorAlarmType.Normal;
|
||||||
alarmable.NetworkAlarmStates.Clear();
|
alarmable.NetworkAlarmStates.Clear();
|
||||||
|
|
||||||
SyncAlertsToNetwork(uid);
|
|
||||||
RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(AtmosMonitorAlarmType.Normal, AtmosMonitorAlarmType.Normal));
|
RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(AtmosMonitorAlarmType.Normal, AtmosMonitorAlarmType.Normal));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetAllOnNetwork(EntityUid uid, AtmosAlarmableComponent? alarmable = null)
|
public void ResetAllOnNetwork(EntityUid uid, AtmosAlarmableComponent? alarmable = null, TagComponent? tags = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref alarmable))
|
if (!Resolve(uid, ref alarmable, ref tags) || alarmable.ReceiveOnly)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
alarmable.LastAlarmState = AtmosMonitorAlarmType.Normal;
|
Reset(uid, alarmable);
|
||||||
alarmable.NetworkAlarmStates.Clear();
|
|
||||||
|
|
||||||
var payload = new NetworkPayload
|
var payload = new NetworkPayload
|
||||||
{
|
{
|
||||||
[DeviceNetworkConstants.Command] = ResetAll,
|
[DeviceNetworkConstants.Command] = ResetAll,
|
||||||
[AlertSource] = alarmable.SyncWithTags
|
[AlertSource] = tags.Tags
|
||||||
};
|
};
|
||||||
|
|
||||||
_deviceNet.QueuePacket(uid, null, payload);
|
_deviceNet.QueuePacket(uid, null, payload);
|
||||||
|
|||||||
@@ -343,10 +343,12 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
string source = string.Empty;
|
string source = string.Empty;
|
||||||
if (alarms == null) alarms = new List<AtmosMonitorThresholdType>();
|
if (alarms == null) alarms = new List<AtmosMonitorThresholdType>();
|
||||||
var prototype = Prototype(monitor.Owner);
|
var prototype = Prototype(monitor.Owner);
|
||||||
if (prototype != null) source = prototype.ID;
|
if (prototype != null) source = prototype.ID;
|
||||||
|
*/
|
||||||
|
|
||||||
var payload = new NetworkPayload
|
var payload = new NetworkPayload
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
{
|
{
|
||||||
public sealed class FireAlarmSystem : EntitySystem
|
public sealed class FireAlarmSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly AtmosMonitorSystem _monitorSystem = default!;
|
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -26,17 +26,20 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target))
|
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent(args.User, out ActorComponent? actor)
|
if (this.IsPowered(uid, EntityManager))
|
||||||
&& EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
|
||||||
&& this.IsPowered(uid, EntityManager))
|
|
||||||
{
|
{
|
||||||
if (monitor.HighestAlarmInNetwork == AtmosMonitorAlarmType.Normal)
|
if (!_atmosAlarmable.TryGetHighestAlert(uid, out var alarm))
|
||||||
{
|
{
|
||||||
_monitorSystem.Alert(uid, AtmosMonitorAlarmType.Danger);
|
alarm = AtmosMonitorAlarmType.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alarm == AtmosMonitorAlarmType.Normal)
|
||||||
|
{
|
||||||
|
_atmosAlarmable.ForceAlert(uid, AtmosMonitorAlarmType.Danger);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_monitorSystem.ResetAll(uid);
|
_atmosAlarmable.ResetAllOnNetwork(uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,7 +51,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
if (atmosMonitor?.MonitorFire == true)
|
if (atmosMonitor?.MonitorFire == true)
|
||||||
{
|
{
|
||||||
atmosMonitor.MonitorFire = false;
|
atmosMonitor.MonitorFire = false;
|
||||||
_monitorSystem.Alert(uid, AtmosMonitorAlarmType.Emagged);
|
_atmosAlarmable.ForceAlert(uid, AtmosMonitorAlarmType.Emagged);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
|||||||
private string _text = "NETW";
|
private string _text = "NETW";
|
||||||
private Color _color = Color.Orange;
|
private Color _color = Color.Orange;
|
||||||
|
|
||||||
private AtmosMonitorSystem _atmosMonitorSystem = default!;
|
private AtmosAlarmableSystem _atmosAlarmableSystem = default!;
|
||||||
|
|
||||||
public override object StatusKey { get; } = AtmosMonitorAlarmWireActionKeys.Network;
|
public override object StatusKey { get; } = AtmosMonitorAlarmWireActionKeys.Network;
|
||||||
|
|
||||||
@@ -27,7 +27,12 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
|||||||
|
|
||||||
if (IsPowered(wire.Owner) && EntityManager.TryGetComponent<AtmosMonitorComponent>(wire.Owner, out var monitor))
|
if (IsPowered(wire.Owner) && EntityManager.TryGetComponent<AtmosMonitorComponent>(wire.Owner, out var monitor))
|
||||||
{
|
{
|
||||||
lightState = monitor.HighestAlarmInNetwork == AtmosMonitorAlarmType.Danger
|
if (!_atmosAlarmableSystem.TryGetHighestAlert(wire.Owner, out var alarm))
|
||||||
|
{
|
||||||
|
alarm = AtmosMonitorAlarmType.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
lightState = alarm == AtmosMonitorAlarmType.Danger
|
||||||
? StatusLightState.BlinkingFast
|
? StatusLightState.BlinkingFast
|
||||||
: StatusLightState.On;
|
: StatusLightState.On;
|
||||||
}
|
}
|
||||||
@@ -42,7 +47,7 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_atmosMonitorSystem = EntitySystem.Get<AtmosMonitorSystem>();
|
_atmosAlarmableSystem = EntitySystem.Get<AtmosAlarmableSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Cut(EntityUid user, Wire wire)
|
public override bool Cut(EntityUid user, Wire wire)
|
||||||
@@ -69,7 +74,7 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
|||||||
{
|
{
|
||||||
if (_alarmOnPulse)
|
if (_alarmOnPulse)
|
||||||
{
|
{
|
||||||
_atmosMonitorSystem.Alert(wire.Owner, AtmosMonitorAlarmType.Danger);
|
_atmosAlarmableSystem.ForceAlert(wire.Owner, AtmosMonitorAlarmType.Danger);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -195,8 +195,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload, device: netConn);
|
_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload, device: netConn);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case AtmosDeviceNetworkSystem.SetState:
|
case DeviceNetworkConstants.CmdSetState:
|
||||||
if (!args.Data.TryGetValue(AtmosDeviceNetworkSystem.SetState, out GasVentPumpData? setData))
|
if (!args.Data.TryGetValue(DeviceNetworkConstants.CmdSetState, out GasVentPumpData? setData))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
component.FromAirAlarmData(setData);
|
component.FromAirAlarmData(setData);
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload, device: netConn);
|
_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload, device: netConn);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case AtmosDeviceNetworkSystem.SetState:
|
case DeviceNetworkConstants.CmdSetState:
|
||||||
if (!args.Data.TryGetValue(AtmosDeviceNetworkSystem.SetState, out GasVentScrubberData? setData))
|
if (!args.Data.TryGetValue(DeviceNetworkConstants.CmdSetState, out GasVentScrubberData? setData))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
component.FromAirAlarmData(setData);
|
component.FromAirAlarmData(setData);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Content.Server.Doors.Systems
|
|||||||
public sealed class FirelockSystem : EntitySystem
|
public sealed class FirelockSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
|
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
|
||||||
|
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -65,12 +66,7 @@ namespace Content.Server.Doors.Systems
|
|||||||
// Make firelocks autoclose, but only if the last alarm type it
|
// Make firelocks autoclose, but only if the last alarm type it
|
||||||
// remembers was a danger. This is to prevent people from
|
// remembers was a danger. This is to prevent people from
|
||||||
// flooding hallways with endless bad air/fire.
|
// flooding hallways with endless bad air/fire.
|
||||||
if (!EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable))
|
if (_atmosAlarmable.TryGetHighestAlert(uid, out var alarm) && alarm == AtmosMonitorAlarmType.Danger)
|
||||||
{
|
|
||||||
args.Cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (alarmable.HighestNetworkState != AtmosMonitorAlarmType.Danger)
|
|
||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user