number of things, fixing warnings, AtmosAlarmType instead of AtmosMonitorAlarmType
This commit is contained in:
@@ -29,9 +29,9 @@ namespace Content.Server.Atmos.Monitor.Components;
|
||||
public sealed class AtmosAlarmableComponent : Component
|
||||
{
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<string, AtmosMonitorAlarmType> NetworkAlarmStates = new();
|
||||
public readonly Dictionary<string, AtmosAlarmType> NetworkAlarmStates = new();
|
||||
|
||||
[ViewVariables] public AtmosMonitorAlarmType LastAlarmState = AtmosMonitorAlarmType.Normal;
|
||||
[ViewVariables] public AtmosAlarmType LastAlarmState = AtmosAlarmType.Normal;
|
||||
|
||||
[ViewVariables] public bool IgnoreAlarms { get; set; } = false;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public sealed class AtmosMonitorComponent : Component
|
||||
|
||||
// Stores the last alarm state of this alarm.
|
||||
[ViewVariables]
|
||||
public AtmosMonitorAlarmType LastAlarmState = AtmosMonitorAlarmType.Normal;
|
||||
public AtmosAlarmType LastAlarmState = AtmosAlarmType.Normal;
|
||||
|
||||
[ViewVariables] public HashSet<AtmosMonitorThresholdType> TrippedThresholds = new();
|
||||
|
||||
|
||||
@@ -62,14 +62,17 @@ public sealed class AirAlarmModeFactory
|
||||
|
||||
// still not a fan since ReplaceMode must have an allocation
|
||||
// but it's whatever
|
||||
public static IAirAlarmMode? ModeToExecutor(AirAlarmMode mode) => mode switch
|
||||
public static IAirAlarmMode? ModeToExecutor(AirAlarmMode mode)
|
||||
{
|
||||
AirAlarmMode.Filtering => _filterMode,
|
||||
AirAlarmMode.Fill => _fillMode,
|
||||
AirAlarmMode.Panic => _panicMode,
|
||||
AirAlarmMode.None => _noneMode,
|
||||
_ => null
|
||||
};
|
||||
return mode switch
|
||||
{
|
||||
AirAlarmMode.Filtering => _filterMode,
|
||||
AirAlarmMode.Fill => _fillMode,
|
||||
AirAlarmMode.Panic => _panicMode,
|
||||
AirAlarmMode.None => _noneMode,
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// like a tiny little EntitySystem
|
||||
|
||||
@@ -81,7 +81,7 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
/// on this network.
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
public void SyncRegisterAllDevices(EntityUid uid)
|
||||
private void SyncRegisterAllDevices(EntityUid uid)
|
||||
{
|
||||
_atmosDevNetSystem.Register(uid, null);
|
||||
_atmosDevNetSystem.Sync(uid, null);
|
||||
@@ -129,7 +129,7 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
/// Sync this air alarm's mode with the rest of the network.
|
||||
/// </summary>
|
||||
/// <param name="mode">The mode to sync with the rest of the network.</param>
|
||||
public void SyncMode(EntityUid uid, AirAlarmMode mode)
|
||||
private void SyncMode(EntityUid uid, AirAlarmMode mode)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
||||
&& !monitor.NetEnabled)
|
||||
@@ -231,20 +231,22 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
|
||||
private void OnResyncAll(EntityUid uid, AirAlarmComponent component, AirAlarmResyncAllDevicesMessage args)
|
||||
{
|
||||
if (AccessCheck(uid, args.Session.AttachedEntity, component))
|
||||
if (!AccessCheck(uid, args.Session.AttachedEntity, component))
|
||||
{
|
||||
component.KnownDevices.Clear();
|
||||
component.VentData.Clear();
|
||||
component.ScrubberData.Clear();
|
||||
component.SensorData.Clear();
|
||||
|
||||
SyncRegisterAllDevices(uid);
|
||||
return;
|
||||
}
|
||||
|
||||
component.KnownDevices.Clear();
|
||||
component.VentData.Clear();
|
||||
component.ScrubberData.Clear();
|
||||
component.SensorData.Clear();
|
||||
|
||||
SyncRegisterAllDevices(uid);
|
||||
}
|
||||
|
||||
private void OnUpdateAlarmMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmModeMessage args)
|
||||
{
|
||||
string addr = string.Empty;
|
||||
var addr = string.Empty;
|
||||
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) addr = netConn.Address;
|
||||
if (AccessCheck(uid, args.Session.AttachedEntity, component))
|
||||
SetMode(uid, addr, args.Mode, true, false);
|
||||
@@ -292,15 +294,15 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
SyncAllDevices(uid);
|
||||
}
|
||||
|
||||
string addr = string.Empty;
|
||||
var addr = string.Empty;
|
||||
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) addr = netConn.Address;
|
||||
|
||||
|
||||
if (args.AlarmType == AtmosMonitorAlarmType.Danger)
|
||||
if (args.AlarmType == AtmosAlarmType.Danger)
|
||||
{
|
||||
SetMode(uid, addr, AirAlarmMode.None, true, false);
|
||||
}
|
||||
else if (args.AlarmType == AtmosMonitorAlarmType.Normal)
|
||||
else if (args.AlarmType == AtmosAlarmType.Normal)
|
||||
{
|
||||
SetMode(uid, addr, AirAlarmMode.Filtering, true, false);
|
||||
}
|
||||
@@ -324,7 +326,7 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
if (!Resolve(uid, ref controller)) return;
|
||||
controller.CurrentMode = mode;
|
||||
|
||||
// setting it to UI only maans we don't have
|
||||
// setting it to UI only means we don't have
|
||||
// to deal with the issue of not-single-owner
|
||||
// alarm mode executors
|
||||
if (!uiOnly)
|
||||
@@ -344,12 +346,14 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
}
|
||||
// only one air alarm in a network can use an air alarm mode
|
||||
// that updates, so even if it's a ui-only change,
|
||||
// we have to invalidte the last mode's updater and
|
||||
// we have to invalidate the last mode's updater and
|
||||
// remove it because otherwise it'll execute a now
|
||||
// invalid mode
|
||||
else if (controller.CurrentModeUpdater != null
|
||||
&& controller.CurrentModeUpdater.NetOwner != origin)
|
||||
{
|
||||
controller.CurrentModeUpdater = null;
|
||||
}
|
||||
|
||||
UpdateUI(uid, controller);
|
||||
|
||||
@@ -364,9 +368,12 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
/// </summary>
|
||||
/// <param name="address">The address to send the new data to.</param>
|
||||
/// <param name="devData">The device data to be sent.</param>
|
||||
public void SetDeviceData(EntityUid uid, string address, IAtmosDeviceData devData, AirAlarmComponent? controller = null)
|
||||
private void SetDeviceData(EntityUid uid, string address, IAtmosDeviceData devData, AirAlarmComponent? controller = null)
|
||||
{
|
||||
if (!Resolve(uid, ref controller)) return;
|
||||
if (!Resolve(uid, ref controller))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
devData.Dirty = true;
|
||||
SetData(uid, address, devData);
|
||||
@@ -421,32 +428,35 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
#region UI
|
||||
|
||||
// List of active user interfaces.
|
||||
private HashSet<EntityUid> _activeUserInterfaces = new();
|
||||
private readonly HashSet<EntityUid> _activeUserInterfaces = new();
|
||||
|
||||
/// <summary>
|
||||
/// Adds an active interface to be updated.
|
||||
/// </summary>
|
||||
public void AddActiveInterface(EntityUid uid) =>
|
||||
private void AddActiveInterface(EntityUid uid)
|
||||
{
|
||||
_activeUserInterfaces.Add(uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes an active interface from the system update loop.
|
||||
/// </summary>
|
||||
public void RemoveActiveInterface(EntityUid uid) =>
|
||||
private void RemoveActiveInterface(EntityUid uid)
|
||||
{
|
||||
_activeUserInterfaces.Remove(uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Force closes all interfaces currently open related to this air alarm.
|
||||
/// </summary>
|
||||
public void ForceCloseAllInterfaces(EntityUid uid)
|
||||
private void ForceCloseAllInterfaces(EntityUid uid)
|
||||
{
|
||||
_uiSystem.TryCloseAll(uid, SharedAirAlarmInterfaceKey.Key);
|
||||
}
|
||||
|
||||
public void OnAtmosUpdate(EntityUid uid, AirAlarmComponent alarm, AtmosDeviceUpdateEvent args)
|
||||
private void OnAtmosUpdate(EntityUid uid, AirAlarmComponent alarm, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
if (alarm.CurrentModeUpdater != null)
|
||||
alarm.CurrentModeUpdater.Update(uid);
|
||||
alarm.CurrentModeUpdater?.Update(uid);
|
||||
}
|
||||
|
||||
public float CalculatePressureAverage(AirAlarmComponent alarm)
|
||||
@@ -506,7 +516,7 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
|
||||
if (!_atmosAlarmable.TryGetHighestAlert(uid, out var highestAlarm))
|
||||
{
|
||||
highestAlarm = AtmosMonitorAlarmType.Normal;
|
||||
highestAlarm = AtmosAlarmType.Normal;
|
||||
}
|
||||
|
||||
_uiSystem.TrySetUiState(
|
||||
@@ -515,13 +525,13 @@ public sealed class AirAlarmSystem : EntitySystem
|
||||
new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, highestAlarm.Value));
|
||||
}
|
||||
|
||||
private const float _delay = 8f;
|
||||
private float _timer = 0f;
|
||||
private const float Delay = 8f;
|
||||
private float _timer;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
_timer += frameTime;
|
||||
if (_timer >= _delay)
|
||||
if (_timer >= Delay)
|
||||
{
|
||||
_timer = 0f;
|
||||
foreach (var uid in _activeUserInterfaces)
|
||||
|
||||
@@ -55,7 +55,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
{
|
||||
TryUpdateAlert(
|
||||
uid,
|
||||
TryGetHighestAlert(uid, out var alarm) ? alarm.Value : AtmosMonitorAlarmType.Normal,
|
||||
TryGetHighestAlert(uid, out var alarm) ? alarm.Value : AtmosAlarmType.Normal,
|
||||
component,
|
||||
false);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
case AlertCmd:
|
||||
// Set the alert state, and then cache it so we can calculate
|
||||
// the maximum alarm state at all times.
|
||||
if (!args.Data.TryGetValue(DeviceNetworkConstants.CmdSetState, out AtmosMonitorAlarmType state))
|
||||
if (!args.Data.TryGetValue(DeviceNetworkConstants.CmdSetState, out AtmosAlarmType state))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -111,12 +111,12 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
// it may mean that the threshold we need to look at has
|
||||
// been removed from the threshold types passed:
|
||||
// basically, we need to reset this state to normal here.
|
||||
component.NetworkAlarmStates[args.SenderAddress] = isValid ? state : AtmosMonitorAlarmType.Normal;
|
||||
component.NetworkAlarmStates[args.SenderAddress] = isValid ? state : AtmosAlarmType.Normal;
|
||||
}
|
||||
|
||||
if (!TryGetHighestAlert(uid, out var netMax, component))
|
||||
{
|
||||
netMax = AtmosMonitorAlarmType.Normal;
|
||||
netMax = AtmosAlarmType.Normal;
|
||||
}
|
||||
|
||||
TryUpdateAlert(uid, netMax.Value, component);
|
||||
@@ -127,7 +127,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
break;
|
||||
case SyncAlerts:
|
||||
if (!args.Data.TryGetValue(SyncAlerts,
|
||||
out IReadOnlyDictionary<string, AtmosMonitorAlarmType>? alarms))
|
||||
out IReadOnlyDictionary<string, AtmosAlarmType>? alarms))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void TryUpdateAlert(EntityUid uid, AtmosMonitorAlarmType type, AtmosAlarmableComponent alarmable, bool sync = true)
|
||||
private void TryUpdateAlert(EntityUid uid, AtmosAlarmType type, AtmosAlarmableComponent alarmable, bool sync = true)
|
||||
{
|
||||
if (alarmable.LastAlarmState == type)
|
||||
{
|
||||
@@ -191,7 +191,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="alarmType"></param>
|
||||
/// <param name="alarmable"></param>
|
||||
public void ForceAlert(EntityUid uid, AtmosMonitorAlarmType alarmType,
|
||||
public void ForceAlert(EntityUid uid, AtmosAlarmType alarmType,
|
||||
AtmosAlarmableComponent? alarmable = null, DeviceNetworkComponent? devNet = null, TagComponent? tags = null)
|
||||
{
|
||||
if (!Resolve(uid, ref alarmable, ref devNet, ref tags))
|
||||
@@ -233,7 +233,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
TryUpdateAlert(uid, AtmosMonitorAlarmType.Normal, alarmable, false);
|
||||
TryUpdateAlert(uid, AtmosAlarmType.Normal, alarmable, false);
|
||||
|
||||
alarmable.NetworkAlarmStates.Clear();
|
||||
}
|
||||
@@ -263,7 +263,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
/// <param name="alarm"></param>
|
||||
/// <param name="alarmable"></param>
|
||||
/// <returns></returns>
|
||||
public bool TryGetHighestAlert(EntityUid uid, [NotNullWhen(true)] out AtmosMonitorAlarmType? alarm,
|
||||
public bool TryGetHighestAlert(EntityUid uid, [NotNullWhen(true)] out AtmosAlarmType? alarm,
|
||||
AtmosAlarmableComponent? alarmable = null)
|
||||
{
|
||||
alarm = null;
|
||||
@@ -281,15 +281,15 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
return alarm != null;
|
||||
}
|
||||
|
||||
private void PlayAlertSound(EntityUid uid, AtmosMonitorAlarmType alarm, AtmosAlarmableComponent alarmable)
|
||||
private void PlayAlertSound(EntityUid uid, AtmosAlarmType alarm, AtmosAlarmableComponent alarmable)
|
||||
{
|
||||
if (alarm == AtmosMonitorAlarmType.Danger)
|
||||
if (alarm == AtmosAlarmType.Danger)
|
||||
{
|
||||
_audioSystem.PlayPvs(alarmable.AlarmSound, uid, AudioParams.Default.WithVolume(alarmable.AlarmVolume));
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, AtmosMonitorAlarmType alarm)
|
||||
private void UpdateAppearance(EntityUid uid, AtmosAlarmType alarm)
|
||||
{
|
||||
_appearance.SetData(uid, AtmosMonitorVisuals.AlarmType, alarm);
|
||||
}
|
||||
@@ -297,9 +297,9 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
||||
|
||||
public sealed class AtmosAlarmEvent : EntityEventArgs
|
||||
{
|
||||
public AtmosMonitorAlarmType AlarmType { get; }
|
||||
public AtmosAlarmType AlarmType { get; }
|
||||
|
||||
public AtmosAlarmEvent(AtmosMonitorAlarmType netMax)
|
||||
public AtmosAlarmEvent(AtmosAlarmType netMax)
|
||||
{
|
||||
AlarmType = netMax;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,10 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
{
|
||||
component.GasThresholds = new();
|
||||
foreach (var (gas, id) in component.GasThresholdIds)
|
||||
{
|
||||
if (_prototypeManager.TryIndex<AtmosAlarmThreshold>(id, out var gasThreshold))
|
||||
component.GasThresholds.Add(gas, new(gasThreshold));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +75,6 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
&& TryComp<AtmosDeviceComponent>(uid, out var atmosDeviceComponent))
|
||||
{
|
||||
_atmosDeviceSystem.LeaveAtmosphere(atmosDeviceComponent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,10 +175,10 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
//
|
||||
// somebody else can reset it :sunglasses:
|
||||
if (component.MonitorFire
|
||||
&& component.LastAlarmState != AtmosMonitorAlarmType.Danger)
|
||||
&& component.LastAlarmState != AtmosAlarmType.Danger)
|
||||
{
|
||||
component.TrippedThresholds.Add(AtmosMonitorThresholdType.Temperature);
|
||||
Alert(uid, AtmosMonitorAlarmType.Danger, null, component); // technically???
|
||||
Alert(uid, AtmosAlarmType.Danger, null, component); // technically???
|
||||
}
|
||||
|
||||
// only monitor state elevation so that stuff gets alarmed quicker during a fire,
|
||||
@@ -188,7 +189,7 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
&& temperatureState > component.LastAlarmState)
|
||||
{
|
||||
component.TrippedThresholds.Add(AtmosMonitorThresholdType.Temperature);
|
||||
Alert(uid, AtmosMonitorAlarmType.Danger, null, component);
|
||||
Alert(uid, AtmosAlarmType.Danger, null, component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +228,7 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
|
||||
if (!Resolve(uid, ref monitor)) return;
|
||||
|
||||
AtmosMonitorAlarmType state = AtmosMonitorAlarmType.Normal;
|
||||
var state = AtmosAlarmType.Normal;
|
||||
HashSet<AtmosMonitorThresholdType> alarmTypes = new(monitor.TrippedThresholds);
|
||||
|
||||
if (monitor.TemperatureThreshold != null
|
||||
@@ -238,7 +239,7 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
state = temperatureState;
|
||||
alarmTypes.Add(AtmosMonitorThresholdType.Temperature);
|
||||
}
|
||||
else if (temperatureState == AtmosMonitorAlarmType.Normal)
|
||||
else if (temperatureState == AtmosAlarmType.Normal)
|
||||
{
|
||||
alarmTypes.Remove(AtmosMonitorThresholdType.Temperature);
|
||||
}
|
||||
@@ -253,7 +254,7 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
state = pressureState;
|
||||
alarmTypes.Add(AtmosMonitorThresholdType.Pressure);
|
||||
}
|
||||
else if (pressureState == AtmosMonitorAlarmType.Normal)
|
||||
else if (pressureState == AtmosAlarmType.Normal)
|
||||
{
|
||||
alarmTypes.Remove(AtmosMonitorThresholdType.Pressure);
|
||||
}
|
||||
@@ -296,7 +297,7 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
/// </summary>
|
||||
/// <param name="state">The alarm state to set this monitor to.</param>
|
||||
/// <param name="alarms">The alarms that caused this alarm state.</param>
|
||||
public void Alert(EntityUid uid, AtmosMonitorAlarmType state, HashSet<AtmosMonitorThresholdType>? alarms = null, AtmosMonitorComponent? monitor = null)
|
||||
public void Alert(EntityUid uid, AtmosAlarmType state, HashSet<AtmosMonitorThresholdType>? alarms = null, AtmosMonitorComponent? monitor = null)
|
||||
{
|
||||
if (!Resolve(uid, ref monitor)) return;
|
||||
|
||||
@@ -313,7 +314,7 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
||||
/// </summary>
|
||||
private void Reset(EntityUid uid)
|
||||
{
|
||||
Alert(uid, AtmosMonitorAlarmType.Normal);
|
||||
Alert(uid, AtmosAlarmType.Normal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -39,12 +39,12 @@ public sealed class FireAlarmSystem : EntitySystem
|
||||
{
|
||||
if (!_atmosAlarmable.TryGetHighestAlert(uid, out var alarm))
|
||||
{
|
||||
alarm = AtmosMonitorAlarmType.Normal;
|
||||
alarm = AtmosAlarmType.Normal;
|
||||
}
|
||||
|
||||
if (alarm == AtmosMonitorAlarmType.Normal)
|
||||
if (alarm == AtmosAlarmType.Normal)
|
||||
{
|
||||
_atmosAlarmable.ForceAlert(uid, AtmosMonitorAlarmType.Danger);
|
||||
_atmosAlarmable.ForceAlert(uid, AtmosAlarmType.Danger);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -58,7 +58,7 @@ public sealed class FireAlarmSystem : EntitySystem
|
||||
if (TryComp<AtmosAlarmableComponent>(uid, out var alarmable))
|
||||
{
|
||||
// Remove the atmos alarmable component permanently from this device.
|
||||
_atmosAlarmable.ForceAlert(uid, AtmosMonitorAlarmType.Emagged, alarmable);
|
||||
_atmosAlarmable.ForceAlert(uid, AtmosAlarmType.Emagged, alarmable);
|
||||
RemCompDeferred<AtmosAlarmableComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public sealed class AirAlarmPanicWire : BaseWireAction
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_airAlarmSystem = EntitySystem.Get<AirAlarmSystem>();
|
||||
_airAlarmSystem = EntityManager.System<AirAlarmSystem>();
|
||||
}
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
|
||||
@@ -29,10 +29,10 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
||||
{
|
||||
if (!_atmosAlarmableSystem.TryGetHighestAlert(wire.Owner, out var alarm))
|
||||
{
|
||||
alarm = AtmosMonitorAlarmType.Normal;
|
||||
alarm = AtmosAlarmType.Normal;
|
||||
}
|
||||
|
||||
lightState = alarm == AtmosMonitorAlarmType.Danger
|
||||
lightState = alarm == AtmosAlarmType.Danger
|
||||
? StatusLightState.BlinkingFast
|
||||
: StatusLightState.On;
|
||||
}
|
||||
@@ -47,14 +47,14 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_atmosAlarmableSystem = EntitySystem.Get<AtmosAlarmableSystem>();
|
||||
_atmosAlarmableSystem = EntityManager.System<AtmosAlarmableSystem>();
|
||||
}
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
if (EntityManager.TryGetComponent<AtmosMonitorComponent>(wire.Owner, out var monitor))
|
||||
if (EntityManager.TryGetComponent<AtmosAlarmableComponent>(wire.Owner, out var monitor))
|
||||
{
|
||||
monitor.NetEnabled = false;
|
||||
monitor.IgnoreAlarms = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -62,9 +62,9 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
if (EntityManager.TryGetComponent<AtmosMonitorComponent>(wire.Owner, out var monitor))
|
||||
if (EntityManager.TryGetComponent<AtmosAlarmableComponent>(wire.Owner, out var monitor))
|
||||
{
|
||||
monitor.NetEnabled = true;
|
||||
monitor.IgnoreAlarms = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -74,7 +74,7 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
||||
{
|
||||
if (_alarmOnPulse)
|
||||
{
|
||||
_atmosAlarmableSystem.ForceAlert(wire.Owner, AtmosMonitorAlarmType.Danger);
|
||||
_atmosAlarmableSystem.ForceAlert(wire.Owner, AtmosAlarmType.Danger);
|
||||
}
|
||||
|
||||
return true;
|
||||
Reference in New Issue
Block a user