Skip to content

Commit

Permalink
Add maximum atmos temperature limit (space-wizards#22882)
Browse files Browse the repository at this point in the history
* Add Tmax

* Increase Tmax
  • Loading branch information
Partmedia authored and qwerltaz committed Dec 26, 2023
1 parent f04e3bf commit 74892fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Content.Server/Atmos/GasMixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Server.Atmos.Reactions;
using Content.Shared.Atmos;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;

namespace Content.Server.Atmos
{
Expand Down Expand Up @@ -58,8 +59,9 @@ public float Temperature
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);
}
}

Expand Down
9 changes: 9 additions & 0 deletions Content.Shared/Atmos/Atmospherics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ static Atmospherics()
/// </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>
Expand Down

0 comments on commit 74892fa

Please sign in to comment.