]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add maximum atmos temperature limit (#22882)
authorKevin Zheng <kevinz5000@gmail.com>
Sun, 24 Dec 2023 15:05:42 +0000 (07:05 -0800)
committerGitHub <noreply@github.com>
Sun, 24 Dec 2023 15:05:42 +0000 (10:05 -0500)
* Add Tmax

* Increase Tmax

Content.Server/Atmos/GasMixture.cs
Content.Shared/Atmos/Atmospherics.cs

index d49d1b78c1fc1495083c434e6c5b756b75490720..0a2ef235a71ed67acd4f7cdeb82ec60427b96a5c 100644 (file)
@@ -4,6 +4,7 @@ using System.Runtime.CompilerServices;
 using Content.Server.Atmos.Reactions;
 using Content.Shared.Atmos;
 using Robust.Shared.Serialization;
+using Robust.Shared.Utility;
 
 namespace Content.Server.Atmos
 {
@@ -58,8 +59,9 @@ namespace Content.Server.Atmos
             get => _temperature;
             set
             {
+                DebugTools.Assert(!float.IsNaN(_temperature));
                 if (Immutable) return;
-                _temperature = MathF.Max(value, Atmospherics.TCMB);
+                _temperature = MathF.Min(MathF.Max(value, Atmospherics.TCMB), Atmospherics.Tmax);
             }
         }
 
index 2565ccd22844c30878c2c10a02b569449ec2b724..59754220e60cf311765fc83e56de9814b0fa06ca 100644 (file)
@@ -45,6 +45,15 @@ namespace Content.Shared.Atmos
         /// </summary>
         public const float T20C = 293.15f;
 
+        /// <summary>
+        ///     Do not allow any gas mixture temperatures to exceed this number. It is occasionally possible
+        ///     to have very small heat capacity (e.g. room that was just unspaced) and for large amounts of
+        ///     energy to be transferred to it, even for a brief moment. However, this messes up subsequent
+        ///     calculations and so cap it here. The physical interpretation is that at this temperature, any
+        ///     gas that you would have transforms into plasma.
+        /// </summary>
+        public const float Tmax = 200e3f;
+
         /// <summary>
         ///     Liters in a cell.
         /// </summary>