From 0bb8c222bde06dad37ec8445e7f62c8757eb8593 Mon Sep 17 00:00:00 2001 From: daerSeebaer <61566539+daerSeebaer@users.noreply.github.com> Date: Sat, 30 Sep 2023 05:35:23 +0200 Subject: [PATCH] Added blocked visuals to volumetric pump (#20610) --- .../Components/GasVolumePumpComponent.cs | 3 +++ .../EntitySystems/GasVolumePumpSystem.cs | 22 ++++++++++++++++-- .../Binary/Visuals/GasVolumePumpVisuals.cs | 18 ++++++++++++++ .../Structures/Piping/Atmospherics/binary.yml | 7 +++--- .../Piping/Atmospherics/pump.rsi/meta.json | 5 ++++ .../pump.rsi/pumpVolumeBlocked.png | Bin 0 -> 5060 bytes 6 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 Content.Shared/Atmos/Piping/Binary/Visuals/GasVolumePumpVisuals.cs create mode 100644 Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/pumpVolumeBlocked.png diff --git a/Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs b/Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs index bdd85524a8..36ced3887d 100644 --- a/Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs +++ b/Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs @@ -9,6 +9,9 @@ namespace Content.Server.Atmos.Piping.Binary.Components [DataField("enabled")] public bool Enabled { get; set; } = true; + [DataField("blocked")] + public bool Blocked { get; set; } = false; + [ViewVariables(VVAccess.ReadWrite)] public bool Overclocked { get; set; } = false; diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index aa171ce6ba..5b8035681e 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -12,6 +12,7 @@ using Content.Server.NodeContainer.Nodes; using Content.Shared.Atmos.Piping; using Content.Shared.Atmos.Piping.Binary.Components; using Content.Shared.Atmos.Piping.Unary.Components; +using Content.Shared.Atmos.Visuals; using Content.Shared.Audio; using Content.Shared.Database; using Content.Shared.Examine; @@ -83,12 +84,24 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems var inputStartingPressure = inlet.Air.Pressure; var outputStartingPressure = outlet.Air.Pressure; + var previouslyBlocked = pump.Blocked; + pump.Blocked = false; + // Pump mechanism won't do anything if the pressure is too high/too low unless you overclock it. if ((inputStartingPressure < pump.LowerThreshold) || (outputStartingPressure > pump.HigherThreshold) && !pump.Overclocked) - return; + { + pump.Blocked = true; + } // Overclocked pumps can only force gas a certain amount. if ((outputStartingPressure - inputStartingPressure > pump.OverclockThreshold) && pump.Overclocked) + { + pump.Blocked = true; + } + + if (previouslyBlocked != pump.Blocked) + UpdateAppearance(uid, pump); + if (pump.Blocked) return; // We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters. @@ -172,7 +185,12 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!Resolve(uid, ref pump, ref appearance, false)) return; - _appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance); + if (!pump.Enabled) + _appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.Off, appearance); + else if (pump.Blocked) + _appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.Blocked, appearance); + else + _appearance.SetData(uid, GasVolumePumpVisuals.State, GasVolumePumpState.On, appearance); } private void OnPacketRecv(EntityUid uid, GasVolumePumpComponent component, DeviceNetworkPacketEvent args) diff --git a/Content.Shared/Atmos/Piping/Binary/Visuals/GasVolumePumpVisuals.cs b/Content.Shared/Atmos/Piping/Binary/Visuals/GasVolumePumpVisuals.cs new file mode 100644 index 0000000000..1cc73e9038 --- /dev/null +++ b/Content.Shared/Atmos/Piping/Binary/Visuals/GasVolumePumpVisuals.cs @@ -0,0 +1,18 @@ +using Robust.Shared.Serialization; + +namespace Content.Shared.Atmos.Visuals +{ + [Serializable, NetSerializable] + public enum GasVolumePumpVisuals : byte + { + State, + } + + [Serializable, NetSerializable] + public enum GasVolumePumpState : byte + { + Off, + On, + Blocked, + } +} diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml index f5c1f2015f..b99b88483c 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml @@ -82,10 +82,11 @@ - type: Appearance - type: GenericVisualizer visuals: - enum.PumpVisuals.Enabled: + enum.GasVolumePumpVisuals.State: enabled: - True: { state: pumpVolumeOn } - False: { state: pumpVolume } + On: { state: pumpVolumeOn } + Off: { state: pumpVolume } + Blocked: { state: pumpVolumeBlocked } - type: PipeColorVisuals - type: GasVolumePump enabled: false diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/meta.json b/Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/meta.json index d3d3ce6ba9..14a5a244bf 100644 --- a/Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/meta.json +++ b/Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/meta.json @@ -52,6 +52,11 @@ "name":"pumpVolumeOn", "directions":4, "delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 ], [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 ], [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 ], [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 ] ] + }, + { + "name":"pumpVolumeBlocked", + "directions":4, + "delays":[ [ 1.0, 1.0 ], [ 1.0, 1.0 ], [ 1.0, 1.0 ], [ 1.0, 1.0 ] ] } ] } diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/pumpVolumeBlocked.png b/Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/pumpVolumeBlocked.png new file mode 100644 index 0000000000000000000000000000000000000000..27bb092f470b0b30826c979c9a6c701b8bbe641a GIT binary patch literal 5060 zcmeHKc~leE8lQj=L=hAoAZ{VFS}aM1B!py2Km-(&Xh2-Bs7#Vcm`WBh0|}@oZYWj| zv5GuI&?nUL#HB6|M5`6V4N)tiV(Py1Q3RoaO2Bs$P~p6u^N#1d{^vbsGI#F%zTf@6 z-?yCH_2L;*?QGp_AqcVy3k{A0?^x4gV-0>Ea$pJTem1(KK4M9FNCnWU>aM zVR~E+LHgTDapUkaw4q&!j7(@Ng)t-g`*G&WU&YzKfo@CnMy5__pmnBsb=bmB?+glgrf8NABILk<_2Aj-E@M8|Yw! z5)u<4$?Oqtw>izP(rfNy={m>iTA-qZ@*i#ur$p7VHy`{y_k3B#g8k1B7!H${yQ%``Y;k%(JP2FG3^krh zy!F`kvQ@fO!AS14^T`ir2j|5}%Qr?}6|YyU3(EK*;^d};==+t`(Tus#?FGg)Y57Mt zKR{|Dst&B?k8p6`oiXCV0f*w*9@W8{J9dxl8D6uKwk^DDgsZ?=oMwCe#j3ZbTU52i zKeqhcX`RIm*3oY7VPvz##ysWnag9k22ek%R&Ygd8(Oyep=RX?e&wpm~?5;Jl?CZQr zYRq%!%*+Z|Xy&65&qwX2x<)RWpSbULPv!&GY(EN_88z=GKj>`s3}fcksf0n+b$HwyzPkq8M^OA}4zg#`=grt=Y*T8hgM^Ar}yIZ~Na z!jSSX4uk9M>%%~~Ts}jF`TD}Bw~x$6#_tCerXomGCB;lo0Gx>f9IiJ9^~E@Hh7VsV zWpGisfFa;;cnl20S<2_LF_bOu2QgENgRDg3`&(s#k^v}zFIOP&X3H1?Zyt}qg(W-& zpX)1N@cD9Bg88r|;3PAYOo~iVYn3PnC$2;l7)zs4m^Vy>BZ1;DA)U>HKdgx3QBn>R zKn>t3nOaAD*owlH*ent?@#)PI@L;wt%op(4d;#1~e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