renames AtmosMonitorAlarmEvent to AtmosAlarmEvent

This commit is contained in:
vulppine
2022-08-23 10:42:03 -07:00
parent 0e43f73ba1
commit df25715ed3
7 changed files with 28 additions and 30 deletions

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Atmos.Monitor.Components
//
// AtmosMonitor -> AtmosDeviceUpdateEvent
// -> Threshold calculation
// -> AtmosMonitorAlarmEvent
// -> AtmosAlarmEvent
// -> Everything linked to that monitor (targetted)
/// <summary>

View File

@@ -152,7 +152,7 @@ namespace Content.Server.Atmos.Monitor.Systems
{
SubscribeLocalEvent<AirAlarmComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
SubscribeLocalEvent<AirAlarmComponent, AtmosDeviceUpdateEvent>(OnAtmosUpdate);
SubscribeLocalEvent<AirAlarmComponent, AtmosMonitorAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<AirAlarmComponent, AtmosAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<AirAlarmComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<AirAlarmComponent, AirAlarmResyncAllDevicesMessage>(OnResyncAll);
SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateAlarmModeMessage>(OnUpdateAlarmMode);
@@ -283,7 +283,7 @@ namespace Content.Server.Atmos.Monitor.Systems
return true;
}
private void OnAtmosAlarm(EntityUid uid, AirAlarmComponent component, AtmosMonitorAlarmEvent args)
private void OnAtmosAlarm(EntityUid uid, AirAlarmComponent component, AtmosAlarmEvent args)
{
if (component.ActivePlayers.Count != 0)
{
@@ -294,11 +294,11 @@ namespace Content.Server.Atmos.Monitor.Systems
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) addr = netConn.Address;
if (args.HighestNetworkType == AtmosMonitorAlarmType.Danger)
if (args.AlarmType == AtmosMonitorAlarmType.Danger)
{
SetMode(uid, addr, AirAlarmMode.None, true, false);
}
else if (args.HighestNetworkType == AtmosMonitorAlarmType.Normal)
else if (args.AlarmType == AtmosMonitorAlarmType.Normal)
{
SetMode(uid, addr, AirAlarmMode.Filtering, true, false);
}

View File

@@ -164,7 +164,7 @@ namespace Content.Server.Atmos.Monitor.Systems
alarmable.LastAlarmState = type;
UpdateAppearance(uid, type);
PlayAlertSound(uid, type, alarmable);
RaiseLocalEvent(uid, new AtmosMonitorAlarmEvent(type, type), true);
RaiseLocalEvent(uid, new AtmosAlarmEvent(type), true);
}
public void SyncAlertsToNetwork(EntityUid uid, string? address = null, AtmosAlarmableComponent? alarmable = null, TagComponent? tags = null)
@@ -294,4 +294,14 @@ namespace Content.Server.Atmos.Monitor.Systems
_appearance.SetData(uid, AtmosMonitorVisuals.AlarmType, alarm);
}
}
public sealed class AtmosAlarmEvent : EntityEventArgs
{
public AtmosMonitorAlarmType AlarmType { get; }
public AtmosAlarmEvent(AtmosMonitorAlarmType netMax)
{
AlarmType = netMax;
}
}
}

View File

@@ -380,16 +380,4 @@ namespace Content.Server.Atmos.Monitor.Systems
}
}
public sealed class AtmosMonitorAlarmEvent : EntityEventArgs
{
public AtmosMonitorAlarmType Type { get; }
public AtmosMonitorAlarmType HighestNetworkType { get; }
public AtmosMonitorAlarmEvent(AtmosMonitorAlarmType type, AtmosMonitorAlarmType netMax)
{
Type = type;
HighestNetworkType = netMax;
}
}
}

View File

@@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
SubscribeLocalEvent<GasVentPumpComponent, AtmosDeviceUpdateEvent>(OnGasVentPumpUpdated);
SubscribeLocalEvent<GasVentPumpComponent, AtmosDeviceDisabledEvent>(OnGasVentPumpLeaveAtmosphere);
SubscribeLocalEvent<GasVentPumpComponent, AtmosDeviceEnabledEvent>(OnGasVentPumpEnterAtmosphere);
SubscribeLocalEvent<GasVentPumpComponent, AtmosMonitorAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<GasVentPumpComponent, AtmosAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<GasVentPumpComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<GasVentPumpComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
SubscribeLocalEvent<GasVentPumpComponent, ComponentInit>(OnInit);
@@ -158,13 +158,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
UpdateState(uid, component);
}
private void OnAtmosAlarm(EntityUid uid, GasVentPumpComponent component, AtmosMonitorAlarmEvent args)
private void OnAtmosAlarm(EntityUid uid, GasVentPumpComponent component, AtmosAlarmEvent args)
{
if (args.HighestNetworkType == AtmosMonitorAlarmType.Danger)
if (args.AlarmType == AtmosMonitorAlarmType.Danger)
{
component.Enabled = false;
}
else if (args.HighestNetworkType == AtmosMonitorAlarmType.Normal)
else if (args.AlarmType == AtmosMonitorAlarmType.Normal)
{
component.Enabled = true;
}

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
SubscribeLocalEvent<GasVentScrubberComponent, AtmosDeviceUpdateEvent>(OnVentScrubberUpdated);
SubscribeLocalEvent<GasVentScrubberComponent, AtmosDeviceEnabledEvent>(OnVentScrubberEnterAtmosphere);
SubscribeLocalEvent<GasVentScrubberComponent, AtmosDeviceDisabledEvent>(OnVentScrubberLeaveAtmosphere);
SubscribeLocalEvent<GasVentScrubberComponent, AtmosMonitorAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<GasVentScrubberComponent, AtmosAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<GasVentScrubberComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<GasVentScrubberComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
}
@@ -124,13 +124,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
return true;
}
private void OnAtmosAlarm(EntityUid uid, GasVentScrubberComponent component, AtmosMonitorAlarmEvent args)
private void OnAtmosAlarm(EntityUid uid, GasVentScrubberComponent component, AtmosAlarmEvent args)
{
if (args.HighestNetworkType == AtmosMonitorAlarmType.Danger)
if (args.AlarmType == AtmosMonitorAlarmType.Danger)
{
component.Enabled = false;
}
else if (args.HighestNetworkType == AtmosMonitorAlarmType.Normal)
else if (args.AlarmType == AtmosMonitorAlarmType.Normal)
{
component.Enabled = true;
}

View File

@@ -26,7 +26,7 @@ namespace Content.Server.Doors.Systems
SubscribeLocalEvent<FirelockComponent, DoorStateChangedEvent>(OnUpdateState);
SubscribeLocalEvent<FirelockComponent, BeforeDoorAutoCloseEvent>(OnBeforeDoorAutoclose);
SubscribeLocalEvent<FirelockComponent, AtmosMonitorAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<FirelockComponent, AtmosAlarmEvent>(OnAtmosAlarm);
}
private void OnBeforeDoorOpened(EntityUid uid, FirelockComponent component, BeforeDoorOpenedEvent args)
@@ -87,16 +87,16 @@ namespace Content.Server.Doors.Systems
args.Cancel();
}
private void OnAtmosAlarm(EntityUid uid, FirelockComponent component, AtmosMonitorAlarmEvent args)
private void OnAtmosAlarm(EntityUid uid, FirelockComponent component, AtmosAlarmEvent args)
{
if (!TryComp<DoorComponent>(uid, out var doorComponent)) return;
if (args.HighestNetworkType == AtmosMonitorAlarmType.Normal)
if (args.AlarmType == AtmosMonitorAlarmType.Normal)
{
if (doorComponent.State == DoorState.Closed)
_doorSystem.TryOpen(uid);
}
else if (args.HighestNetworkType == AtmosMonitorAlarmType.Danger)
else if (args.AlarmType == AtmosMonitorAlarmType.Danger)
{
component.EmergencyPressureStop();
}