]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Added blocked visuals to volumetric pump (#20610)
authordaerSeebaer <61566539+daerSeebaer@users.noreply.github.com>
Sat, 30 Sep 2023 03:35:23 +0000 (05:35 +0200)
committerGitHub <noreply@github.com>
Sat, 30 Sep 2023 03:35:23 +0000 (19:35 -0800)
Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs
Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs
Content.Shared/Atmos/Piping/Binary/Visuals/GasVolumePumpVisuals.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml
Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/meta.json
Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/pumpVolumeBlocked.png [new file with mode: 0644]

index bdd85524a8a03b7b30794ed5952433a35c835f41..36ced3887d2ddc0436e0ec2627a744c99ac1d831 100644 (file)
@@ -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;
 
index aa171ce6ba3111c80ed1608c59332c240853030f..5b8035681e0edb55bb303d974f52b84c2d9aa655 100644 (file)
@@ -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 (file)
index 0000000..1cc73e9
--- /dev/null
@@ -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,
+    }
+}
index f5c1f2015f90fb38f2f515567d9f31a86c92f6bf..b99b88483c20741cc788dcb23e1afbcc64fb7e0f 100644 (file)
     - 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
index d3d3ce6ba993e533051d9b4f5bb731da12d0caf1..14a5a244bf69b68586a0892a05552b7ee0fcd559 100644 (file)
          "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 (file)
index 0000000..27bb092
Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/pump.rsi/pumpVolumeBlocked.png differ