Optimize atmos devices' appearance updating.

This commit is contained in:
Vera Aguilera Puerto
2021-07-30 14:00:14 +02:00
parent f4769c00d7
commit e256cb7bb0
5 changed files with 44 additions and 48 deletions

View File

@@ -36,22 +36,22 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
return;
}
appearance?.SetData(VentPumpVisuals.State, VentPumpState.Off);
if (!vent.Enabled)
return;
if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
return;
if (!nodeContainer.TryGetNode(vent.InletName, out PipeNode? pipe))
if (!vent.Enabled
|| !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|| !nodeContainer.TryGetNode(vent.InletName, out PipeNode? pipe))
{
appearance?.SetData(VentPumpVisuals.State, VentPumpState.Off);
return;
}
var environment = _atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
// We're in an air-blocked tile... Do nothing.
if (environment == null)
{
appearance?.SetData(VentPumpVisuals.State, VentPumpState.Off);
return;
}
if (vent.PumpDirection == VentPumpDirection.Releasing)
{