diff --git a/Content.Server/Atmos/GasMixture.cs b/Content.Server/Atmos/GasMixture.cs
index d49d1b78c1..0a2ef235a7 100644
--- a/Content.Server/Atmos/GasMixture.cs
+++ b/Content.Server/Atmos/GasMixture.cs
@@ -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);
}
}
diff --git a/Content.Shared/Atmos/Atmospherics.cs b/Content.Shared/Atmos/Atmospherics.cs
index 2565ccd228..59754220e6 100644
--- a/Content.Shared/Atmos/Atmospherics.cs
+++ b/Content.Shared/Atmos/Atmospherics.cs
@@ -45,6 +45,15 @@ namespace Content.Shared.Atmos
///
public const float T20C = 293.15f;
+ ///
+ /// 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.
+ ///
+ public const float Tmax = 200e3f;
+
///
/// Liters in a cell.
///