From: Partmedia Date: Sun, 15 Sep 2024 01:58:10 +0000 (-0800) Subject: Make pressure and volume pumps require power (#28995) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=30c5fbb0be7269accc58644c300f5c5372b5f181;p=space-station-14.git Make pressure and volume pumps require power (#28995) --- diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index 871c84e058..56359a85af 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -5,6 +5,7 @@ using Content.Server.Atmos.Piping.Components; using Content.Server.NodeContainer; using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.Nodes; +using Content.Server.Power.Components; using Content.Shared.Atmos; using Content.Shared.Atmos.Piping; using Content.Shared.Atmos.Piping.Binary.Components; @@ -39,6 +40,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems SubscribeLocalEvent(OnPumpLeaveAtmosphere); SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnPumpActivate); + SubscribeLocalEvent(OnPowerChanged); // Bound UI subscriptions SubscribeLocalEvent(OnOutputPressureChangeMessage); SubscribeLocalEvent(OnToggleStatusMessage); @@ -63,9 +65,15 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems } } + private void OnPowerChanged(EntityUid uid, GasPressurePumpComponent component, ref PowerChangedEvent args) + { + UpdateAppearance(uid, component); + } + private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceUpdateEvent args) { if (!pump.Enabled + || (TryComp(uid, out var power) && !power.Powered) || !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet)) { _ambientSoundSystem.SetAmbience(uid, false); @@ -154,7 +162,8 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!Resolve(uid, ref pump, ref appearance, false)) return; - _appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance); + bool pumpOn = pump.Enabled && (TryComp(uid, out var power) && power.Powered); + _appearance.SetData(uid, PumpVisuals.Enabled, pumpOn, appearance); } } } diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index d9fbeb474e..d112792051 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -9,6 +9,7 @@ using Content.Server.DeviceNetwork.Systems; using Content.Server.NodeContainer; using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.Nodes; +using Content.Server.Power.Components; using Content.Shared.Atmos.Piping.Binary.Components; using Content.Shared.Atmos.Visuals; using Content.Shared.Audio; @@ -45,6 +46,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems SubscribeLocalEvent(OnVolumePumpLeaveAtmosphere); SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnPumpActivate); + SubscribeLocalEvent(OnPowerChanged); // Bound UI subscriptions SubscribeLocalEvent(OnTransferRateChangeMessage); SubscribeLocalEvent(OnToggleStatusMessage); @@ -69,9 +71,15 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems args.PushMarkup(str); } + private void OnPowerChanged(EntityUid uid, GasVolumePumpComponent component, ref PowerChangedEvent args) + { + UpdateAppearance(uid, component); + } + private void OnVolumePumpUpdated(EntityUid uid, GasVolumePumpComponent pump, ref AtmosDeviceUpdateEvent args) { if (!pump.Enabled || + (TryComp(uid, out var power) && !power.Powered) || !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet)) { _ambientSoundSystem.SetAmbience(uid, false); @@ -183,7 +191,8 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!Resolve(uid, ref pump, ref appearance, false)) return; - if (!pump.Enabled) + bool pumpOn = pump.Enabled && (TryComp(uid, out var power) && power.Powered); + if (!pumpOn) _appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.Off, appearance); else if (pump.Blocked) _appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.Blocked, appearance); diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml index 24a8cb58da..ba86ca65a0 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml @@ -24,13 +24,18 @@ pipeDirection: South - type: entity - parent: GasBinaryBase + parent: [BaseMachinePowered, GasBinaryBase] id: GasPressurePump name: gas pump description: A pump that moves gas by pressure. placement: mode: SnapgridCenter components: + - type: ApcPowerReceiver + powerLoad: 200 + - type: Rotatable + - type: Transform + noRot: false - type: Sprite sprite: Structures/Piping/Atmospherics/pump.rsi layers: @@ -64,13 +69,18 @@ path: /Audio/Ambience/Objects/gas_pump.ogg - type: entity - parent: GasBinaryBase + parent: [BaseMachinePowered, GasBinaryBase] id: GasVolumePump name: volumetric gas pump description: A pump that moves gas by volume. placement: mode: SnapgridCenter components: + - type: ApcPowerReceiver + powerLoad: 200 + - type: Rotatable + - type: Transform + noRot: false - type: Sprite sprite: Structures/Piping/Atmospherics/pump.rsi layers: