Fix air alarm system keeping deleted entity UIDs around. (#6307)
This commit is contained in:
committed by
GitHub
parent
bd69210710
commit
f917c18ff8
@@ -166,6 +166,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateAlarmThresholdMessage>(OnUpdateThreshold);
|
SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateAlarmThresholdMessage>(OnUpdateThreshold);
|
||||||
SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateDeviceDataMessage>(OnUpdateDeviceData);
|
SubscribeLocalEvent<AirAlarmComponent, AirAlarmUpdateDeviceDataMessage>(OnUpdateDeviceData);
|
||||||
SubscribeLocalEvent<AirAlarmComponent, BoundUIClosedEvent>(OnClose);
|
SubscribeLocalEvent<AirAlarmComponent, BoundUIClosedEvent>(OnClose);
|
||||||
|
SubscribeLocalEvent<AirAlarmComponent, ComponentShutdown>(OnShutdown);
|
||||||
SubscribeLocalEvent<AirAlarmComponent, InteractHandEvent>(OnInteract);
|
SubscribeLocalEvent<AirAlarmComponent, InteractHandEvent>(OnInteract);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,6 +187,11 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
RemoveActiveInterface(uid);
|
RemoveActiveInterface(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnShutdown(EntityUid uid, AirAlarmComponent component, ComponentShutdown args)
|
||||||
|
{
|
||||||
|
_activeUserInterfaces.Remove(uid);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnInteract(EntityUid uid, AirAlarmComponent component, InteractHandEvent args)
|
private void OnInteract(EntityUid uid, AirAlarmComponent component, InteractHandEvent args)
|
||||||
{
|
{
|
||||||
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target))
|
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target))
|
||||||
@@ -310,6 +316,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
|
|
||||||
_atmosMonitorSystem.SetThreshold(uid, type, threshold, gas);
|
_atmosMonitorSystem.SetThreshold(uid, type, threshold, gas);
|
||||||
|
|
||||||
|
// TODO: Use BUI states instead...
|
||||||
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAlarmThresholdMessage(type, threshold, gas));
|
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAlarmThresholdMessage(type, threshold, gas));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,6 +360,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
controller.CurrentModeUpdater = null;
|
controller.CurrentModeUpdater = null;
|
||||||
|
|
||||||
// controller.SendMessage(new AirAlarmUpdateAlarmModeMessage(mode));
|
// controller.SendMessage(new AirAlarmUpdateAlarmModeMessage(mode));
|
||||||
|
// TODO: Use BUI states instead...
|
||||||
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAlarmModeMessage(mode));
|
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAlarmModeMessage(mode));
|
||||||
|
|
||||||
|
|
||||||
@@ -444,6 +452,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
{
|
{
|
||||||
if (!Resolve(uid, ref netConn)) return;
|
if (!Resolve(uid, ref netConn)) return;
|
||||||
|
|
||||||
|
// TODO: Use BUI states instead...
|
||||||
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmSetAddressMessage(netConn.Address));
|
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmSetAddressMessage(netConn.Address));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,6 +477,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
|
|
||||||
var airData = new AirAlarmAirData(monitor.TileGas.Pressure, monitor.TileGas.Temperature, monitor.TileGas.TotalMoles, monitor.LastAlarmState, gases);
|
var airData = new AirAlarmAirData(monitor.TileGas.Pressure, monitor.TileGas.Temperature, monitor.TileGas.TotalMoles, monitor.LastAlarmState, gases);
|
||||||
|
|
||||||
|
// TODO: Use BUI states instead...
|
||||||
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAirDataMessage(airData));
|
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAirDataMessage(airData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -480,6 +490,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
if (!Resolve(uid, ref monitor, ref power, ref controller)
|
if (!Resolve(uid, ref monitor, ref power, ref controller)
|
||||||
|| !power.Powered) return;
|
|| !power.Powered) return;
|
||||||
|
|
||||||
|
// TODO: Use BUI states instead...
|
||||||
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAlarmModeMessage(controller.CurrentMode));
|
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAlarmModeMessage(controller.CurrentMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,6 +507,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
&& monitor.GasThresholds == null)
|
&& monitor.GasThresholds == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// TODO: Use BUI states instead...
|
||||||
if (monitor.PressureThreshold != null)
|
if (monitor.PressureThreshold != null)
|
||||||
{
|
{
|
||||||
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAlarmThresholdMessage(AtmosMonitorThresholdType.Pressure, monitor.PressureThreshold));
|
_uiSystem.TrySendUiMessage(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUpdateAlarmThresholdMessage(AtmosMonitorThresholdType.Pressure, monitor.PressureThreshold));
|
||||||
@@ -530,6 +542,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
_timer = 0f;
|
_timer = 0f;
|
||||||
foreach (var uid in _activeUserInterfaces)
|
foreach (var uid in _activeUserInterfaces)
|
||||||
{
|
{
|
||||||
|
// TODO: Awful idea, use BUI states instead...
|
||||||
SendAirData(uid);
|
SendAirData(uid);
|
||||||
_uiSystem.TrySetUiState(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUIState());
|
_uiSystem.TrySetUiState(uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUIState());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user