]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add method for real atmos tick rate (#19861)
authorKevin Zheng <kevinz5000@gmail.com>
Sat, 9 Sep 2023 18:48:34 +0000 (10:48 -0800)
committerGitHub <noreply@github.com>
Sat, 9 Sep 2023 18:48:34 +0000 (10:48 -0800)
Atmos takes a variable number of atmos sub-ticks to complete processing depending on the configuration options.

Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs

index ea25874db7f0c08d5546962868d13c3ce74c137a..38b66a73fafa9a61d9d773ab4bb57a6c79ba3e09 100644 (file)
@@ -327,6 +327,23 @@ namespace Content.Server.Atmos.EntitySystems
             return true;
         }
 
+        /**
+         * UpdateProcessing() takes a different number of calls to go through all of atmos
+         * processing depending on what options are enabled. This returns the actual effective time
+         * between atmos updates that devices actually experience.
+         */
+        public float RealAtmosTime()
+        {
+            int num = (int)AtmosphereProcessingState.NumStates;
+            if (!MonstermosEqualization)
+                num--;
+            if (!ExcitedGroups)
+                num--;
+            if (!Superconduction)
+                num--;
+            return num * AtmosTime;
+        }
+
         private bool ProcessAtmosDevices(GridAtmosphereComponent atmosphere)
         {
             if(!atmosphere.ProcessingPaused)
@@ -336,7 +353,7 @@ namespace Content.Server.Atmos.EntitySystems
             var number = 0;
             while (atmosphere.CurrentRunAtmosDevices.TryDequeue(out var device))
             {
-                RaiseLocalEvent(device.Owner, new AtmosDeviceUpdateEvent(AtmosTime * (int)AtmosphereProcessingState.NumStates), false);
+                RaiseLocalEvent(device.Owner, new AtmosDeviceUpdateEvent(RealAtmosTime()), false);
                 device.LastProcess = time;
 
                 if (number++ < LagCheckIterations) continue;