diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs index 24c03e399e..78205ef201 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs @@ -37,23 +37,23 @@ namespace Content.Server.Atmos.Piping.Binary.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? inlet) + if (!vent.Enabled + || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !nodeContainer.TryGetNode(vent.InletName, out PipeNode? inlet) || !nodeContainer.TryGetNode(vent.OutletName, out PipeNode? outlet)) + { + 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) { diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index dc38b4da76..3d2b9ca2ae 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -25,22 +25,23 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceUpdateEvent args) { var appearance = pump.Owner.GetComponentOrNull(); - appearance?.SetData(PressurePumpVisuals.Enabled, false); - if (!pump.Enabled) - return; - - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) - return; - - if (!nodeContainer.TryGetNode(pump.InletName, out PipeNode? inlet) + if (!pump.Enabled + || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !nodeContainer.TryGetNode(pump.InletName, out PipeNode? inlet) || !nodeContainer.TryGetNode(pump.OutletName, out PipeNode? outlet)) + { + appearance?.SetData(PressurePumpVisuals.Enabled, false); return; + } var outputStartingPressure = outlet.Air.Pressure; if (MathHelper.CloseTo(pump.TargetPressure, outputStartingPressure)) + { + appearance?.SetData(PressurePumpVisuals.Enabled, false); return; // No need to pump gas if target has been reached. + } if (inlet.Air.TotalMoles > 0 && inlet.Air.Temperature > 0) { diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs index f48aa149f5..8706a22156 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs @@ -27,16 +27,14 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, AtmosDeviceUpdateEvent args) { var appearance = thermoMachine.Owner.GetComponentOrNull(); - appearance?.SetData(ThermoMachineVisuals.Enabled, false); - if (!thermoMachine.Enabled) - return; - - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) - return; - - if (!nodeContainer.TryGetNode(thermoMachine.InletName, out PipeNode? inlet)) + if (!thermoMachine.Enabled + || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !nodeContainer.TryGetNode(thermoMachine.InletName, out PipeNode? inlet)) + { + appearance?.SetData(ThermoMachineVisuals.Enabled, false); return; + } var airHeatCapacity = _atmosphereSystem.GetHeatCapacity(inlet.Air); var combinedHeatCapacity = airHeatCapacity + thermoMachine.HeatCapacity; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index f9af0231f6..a008cde4ca 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -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) { diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs index 190fd86228..9b6722411d 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs @@ -37,16 +37,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems return; } - appearance?.SetData(ScrubberVisuals.State, ScrubberState.Off); - - if (!scrubber.Enabled) - return; - - if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)) - return; - - if (!nodeContainer.TryGetNode(scrubber.OutletName, out PipeNode? outlet)) + if (!scrubber.Enabled + || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) + || !nodeContainer.TryGetNode(scrubber.OutletName, out PipeNode? outlet)) + { + appearance?.SetData(ScrubberVisuals.State, ScrubberState.Off); return; + } var environment = _atmosphereSystem.GetTileMixture(scrubber.Owner.Transform.Coordinates, true); @@ -72,12 +69,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void Scrub(AtmosphereSystem atmosphereSystem, GasVentScrubberComponent scrubber, AppearanceComponent? appearance, GasMixture? tile, PipeNode outlet) { // Cannot scrub if tile is null or air-blocked. - if (tile == null) - return; - - // Cannot scrub if pressure too high. - if (outlet.Air.Pressure >= 50 * Atmospherics.OneAtmosphere) + if (tile == null + || outlet.Air.Pressure >= 50 * Atmospherics.OneAtmosphere) // Cannot scrub if pressure too high. + { + appearance?.SetData(ScrubberVisuals.State, ScrubberState.Off); return; + } if (scrubber.PumpDirection == ScrubberPumpDirection.Scrubbing) {