Make pressure and volume pumps require power (#28995)
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Server.Atmos.Piping.Components;
|
|||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.NodeContainer.EntitySystems;
|
using Content.Server.NodeContainer.EntitySystems;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Atmos.Piping;
|
using Content.Shared.Atmos.Piping;
|
||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
using Content.Shared.Atmos.Piping.Binary.Components;
|
||||||
@@ -39,6 +40,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceDisabledEvent>(OnPumpLeaveAtmosphere);
|
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceDisabledEvent>(OnPumpLeaveAtmosphere);
|
||||||
SubscribeLocalEvent<GasPressurePumpComponent, ExaminedEvent>(OnExamined);
|
SubscribeLocalEvent<GasPressurePumpComponent, ExaminedEvent>(OnExamined);
|
||||||
SubscribeLocalEvent<GasPressurePumpComponent, ActivateInWorldEvent>(OnPumpActivate);
|
SubscribeLocalEvent<GasPressurePumpComponent, ActivateInWorldEvent>(OnPumpActivate);
|
||||||
|
SubscribeLocalEvent<GasPressurePumpComponent, PowerChangedEvent>(OnPowerChanged);
|
||||||
// Bound UI subscriptions
|
// Bound UI subscriptions
|
||||||
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpChangeOutputPressureMessage>(OnOutputPressureChangeMessage);
|
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpChangeOutputPressureMessage>(OnOutputPressureChangeMessage);
|
||||||
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpToggleStatusMessage>(OnToggleStatusMessage);
|
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpToggleStatusMessage>(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)
|
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!pump.Enabled
|
if (!pump.Enabled
|
||||||
|
|| (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
|
||||||
|| !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet))
|
|| !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet))
|
||||||
{
|
{
|
||||||
_ambientSoundSystem.SetAmbience(uid, false);
|
_ambientSoundSystem.SetAmbience(uid, false);
|
||||||
@@ -154,7 +162,8 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
if (!Resolve(uid, ref pump, ref appearance, false))
|
if (!Resolve(uid, ref pump, ref appearance, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance);
|
bool pumpOn = pump.Enabled && (TryComp<ApcPowerReceiverComponent>(uid, out var power) && power.Powered);
|
||||||
|
_appearance.SetData(uid, PumpVisuals.Enabled, pumpOn, appearance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Server.DeviceNetwork.Systems;
|
|||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.NodeContainer.EntitySystems;
|
using Content.Server.NodeContainer.EntitySystems;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
using Content.Shared.Atmos.Piping.Binary.Components;
|
||||||
using Content.Shared.Atmos.Visuals;
|
using Content.Shared.Atmos.Visuals;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
@@ -45,6 +46,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasVolumePumpComponent, AtmosDeviceDisabledEvent>(OnVolumePumpLeaveAtmosphere);
|
SubscribeLocalEvent<GasVolumePumpComponent, AtmosDeviceDisabledEvent>(OnVolumePumpLeaveAtmosphere);
|
||||||
SubscribeLocalEvent<GasVolumePumpComponent, ExaminedEvent>(OnExamined);
|
SubscribeLocalEvent<GasVolumePumpComponent, ExaminedEvent>(OnExamined);
|
||||||
SubscribeLocalEvent<GasVolumePumpComponent, ActivateInWorldEvent>(OnPumpActivate);
|
SubscribeLocalEvent<GasVolumePumpComponent, ActivateInWorldEvent>(OnPumpActivate);
|
||||||
|
SubscribeLocalEvent<GasVolumePumpComponent, PowerChangedEvent>(OnPowerChanged);
|
||||||
// Bound UI subscriptions
|
// Bound UI subscriptions
|
||||||
SubscribeLocalEvent<GasVolumePumpComponent, GasVolumePumpChangeTransferRateMessage>(OnTransferRateChangeMessage);
|
SubscribeLocalEvent<GasVolumePumpComponent, GasVolumePumpChangeTransferRateMessage>(OnTransferRateChangeMessage);
|
||||||
SubscribeLocalEvent<GasVolumePumpComponent, GasVolumePumpToggleStatusMessage>(OnToggleStatusMessage);
|
SubscribeLocalEvent<GasVolumePumpComponent, GasVolumePumpToggleStatusMessage>(OnToggleStatusMessage);
|
||||||
@@ -69,9 +71,15 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
args.PushMarkup(str);
|
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)
|
private void OnVolumePumpUpdated(EntityUid uid, GasVolumePumpComponent pump, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!pump.Enabled ||
|
if (!pump.Enabled ||
|
||||||
|
(TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered) ||
|
||||||
!_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet))
|
!_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet))
|
||||||
{
|
{
|
||||||
_ambientSoundSystem.SetAmbience(uid, false);
|
_ambientSoundSystem.SetAmbience(uid, false);
|
||||||
@@ -183,7 +191,8 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
if (!Resolve(uid, ref pump, ref appearance, false))
|
if (!Resolve(uid, ref pump, ref appearance, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pump.Enabled)
|
bool pumpOn = pump.Enabled && (TryComp<ApcPowerReceiverComponent>(uid, out var power) && power.Powered);
|
||||||
|
if (!pumpOn)
|
||||||
_appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.Off, appearance);
|
_appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.Off, appearance);
|
||||||
else if (pump.Blocked)
|
else if (pump.Blocked)
|
||||||
_appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.Blocked, appearance);
|
_appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.Blocked, appearance);
|
||||||
|
|||||||
@@ -24,13 +24,18 @@
|
|||||||
pipeDirection: South
|
pipeDirection: South
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: GasBinaryBase
|
parent: [BaseMachinePowered, GasBinaryBase]
|
||||||
id: GasPressurePump
|
id: GasPressurePump
|
||||||
name: gas pump
|
name: gas pump
|
||||||
description: A pump that moves gas by pressure.
|
description: A pump that moves gas by pressure.
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
components:
|
components:
|
||||||
|
- type: ApcPowerReceiver
|
||||||
|
powerLoad: 200
|
||||||
|
- type: Rotatable
|
||||||
|
- type: Transform
|
||||||
|
noRot: false
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Piping/Atmospherics/pump.rsi
|
sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
layers:
|
layers:
|
||||||
@@ -64,13 +69,18 @@
|
|||||||
path: /Audio/Ambience/Objects/gas_pump.ogg
|
path: /Audio/Ambience/Objects/gas_pump.ogg
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: GasBinaryBase
|
parent: [BaseMachinePowered, GasBinaryBase]
|
||||||
id: GasVolumePump
|
id: GasVolumePump
|
||||||
name: volumetric gas pump
|
name: volumetric gas pump
|
||||||
description: A pump that moves gas by volume.
|
description: A pump that moves gas by volume.
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
components:
|
components:
|
||||||
|
- type: ApcPowerReceiver
|
||||||
|
powerLoad: 200
|
||||||
|
- type: Rotatable
|
||||||
|
- type: Transform
|
||||||
|
noRot: false
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Piping/Atmospherics/pump.rsi
|
sprite: Structures/Piping/Atmospherics/pump.rsi
|
||||||
layers:
|
layers:
|
||||||
|
|||||||
Reference in New Issue
Block a user