Rejig Device networks (#7380)

This commit is contained in:
Leon Friedrich
2022-04-09 00:27:10 +12:00
committed by GitHub
parent 44649e7fed
commit a4d55235cc
33 changed files with 671 additions and 247 deletions

View File

@@ -62,11 +62,6 @@ namespace Content.Server.Atmos.Monitor.Systems
/// </summary>
public const string AtmosMonitorAlarmNetMax = "atmos_monitor_alarm_net_max";
/// <summary>
/// Frequency (all prototypes that use AtmosMonitor should use this)
/// </summary>
public const int AtmosMonitorApcFreq = 1621;
public override void Initialize()
{
SubscribeLocalEvent<AtmosMonitorComponent, ComponentInit>(OnAtmosMonitorInit);
@@ -76,7 +71,7 @@ namespace Content.Server.Atmos.Monitor.Systems
SubscribeLocalEvent<AtmosMonitorComponent, TileFireEvent>(OnFireEvent);
SubscribeLocalEvent<AtmosMonitorComponent, PowerChangedEvent>(OnPowerChangedEvent);
SubscribeLocalEvent<AtmosMonitorComponent, BeforePacketSentEvent>(BeforePacketRecv);
SubscribeLocalEvent<AtmosMonitorComponent, PacketSentEvent>(OnPacketRecv);
SubscribeLocalEvent<AtmosMonitorComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
}
private void OnAtmosMonitorInit(EntityUid uid, AtmosMonitorComponent component, ComponentInit args)
@@ -158,7 +153,7 @@ namespace Content.Server.Atmos.Monitor.Systems
if (!component.NetEnabled) args.Cancel();
}
private void OnPacketRecv(EntityUid uid, AtmosMonitorComponent component, PacketSentEvent args)
private void OnPacketRecv(EntityUid uid, AtmosMonitorComponent component, DeviceNetworkPacketEvent args)
{
// sync the internal 'last alarm state' from
// the other alarms, so that we can calculate
@@ -389,7 +384,7 @@ namespace Content.Server.Atmos.Monitor.Systems
[AtmosMonitorAlarmSrc] = prototype != null ? prototype.ID : string.Empty
};
_deviceNetSystem.QueuePacket(monitor.Owner, string.Empty, AtmosMonitorApcFreq, payload, true);
_deviceNetSystem.QueuePacket(monitor.Owner, null, payload);
monitor.NetworkAlarmStates.Clear();
Alert(uid, AtmosMonitorAlarmType.Normal, null, monitor);
@@ -411,7 +406,7 @@ namespace Content.Server.Atmos.Monitor.Systems
[AtmosMonitorAlarmSrc] = prototype != null ? prototype.ID : string.Empty
};
_deviceNetSystem.QueuePacket(monitor.Owner, string.Empty, AtmosMonitorApcFreq, payload, true);
_deviceNetSystem.QueuePacket(monitor.Owner, null, payload);
}
/// <summary>
@@ -445,7 +440,7 @@ namespace Content.Server.Atmos.Monitor.Systems
[AtmosMonitorAlarmSrc] = source
};
_deviceNetSystem.QueuePacket(monitor.Owner, string.Empty, AtmosMonitorApcFreq, payload, true);
_deviceNetSystem.QueuePacket(monitor.Owner, null, payload);
}
/// <summary>