Atmos scaling cvar changes (#22501)

This commit is contained in:
Leon Friedrich
2023-12-15 17:02:21 -05:00
committed by GitHub
parent a88730fcfa
commit 477327f952
16 changed files with 76 additions and 40 deletions

View File

@@ -43,11 +43,22 @@ namespace Content.Server.Atmos.EntitySystems
/// <summary>
/// Calculates the heat capacity for a gas mixture.
/// </summary>
public float GetHeatCapacity(GasMixture mixture)
/// <param name="mixture">The mixture whose heat capacity should be calculated</param>
/// <param name="applyScaling"> Whether the internal heat capacity scaling should be applied. This should not be
/// used outside of atmospheric related heat transfer.</param>
/// <returns></returns>
public float GetHeatCapacity(GasMixture mixture, bool applyScaling)
{
return GetHeatCapacityCalculation(mixture.Moles, mixture.Immutable);
var scale = GetHeatCapacityCalculation(mixture.Moles, mixture.Immutable);
// By default GetHeatCapacityCalculation() has the heat-scale divisor pre-applied.
// So if we want the un-scaled heat capacity, we have to multiply by the scale.
return applyScaling ? scale : scale * HeatScale;
}
private float GetHeatCapacity(GasMixture mixture)
=> GetHeatCapacityCalculation(mixture.Moles, mixture.Immutable);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private float GetHeatCapacityCalculation(float[] moles, bool space)
{
@@ -320,7 +331,9 @@ namespace Content.Server.Atmos.EntitySystems
var req = prototype.MinimumRequirements[i];
if (!(mixture.GetMoles(i) < req)) continue;
if (!(mixture.GetMoles(i) < req))
continue;
doReaction = false;
break;
}
@@ -328,7 +341,7 @@ namespace Content.Server.Atmos.EntitySystems
if (!doReaction)
continue;
reaction = prototype.React(mixture, holder, this);
reaction = prototype.React(mixture, holder, this, HeatScale);
if(reaction.HasFlag(ReactionResult.StopReactions))
break;
}