Split up atmos speedup from heat scaling (#22372)

This commit is contained in:
Kevin Zheng
2023-12-11 23:49:20 -08:00
committed by GitHub
parent 223a2587ef
commit 405e569cd5
6 changed files with 18 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ namespace Content.Server.Atmos.EntitySystems
public float AtmosMaxProcessTime { get; private set; } public float AtmosMaxProcessTime { get; private set; }
public float AtmosTickRate { get; private set; } public float AtmosTickRate { get; private set; }
public float Speedup { get; private set; } public float Speedup { get; private set; }
public float HeatScale { get; private set; }
/// <summary> /// <summary>
/// Time between each atmos sub-update. If you are writing an atmos device, use AtmosDeviceUpdateEvent.dt /// Time between each atmos sub-update. If you are writing an atmos device, use AtmosDeviceUpdateEvent.dt
@@ -51,6 +52,7 @@ namespace Content.Server.Atmos.EntitySystems
_cfg.OnValueChanged(CCVars.AtmosMaxProcessTime, value => AtmosMaxProcessTime = value, true); _cfg.OnValueChanged(CCVars.AtmosMaxProcessTime, value => AtmosMaxProcessTime = value, true);
_cfg.OnValueChanged(CCVars.AtmosTickRate, value => AtmosTickRate = value, true); _cfg.OnValueChanged(CCVars.AtmosTickRate, value => AtmosTickRate = value, true);
_cfg.OnValueChanged(CCVars.AtmosSpeedup, value => Speedup = value, true); _cfg.OnValueChanged(CCVars.AtmosSpeedup, value => Speedup = value, true);
_cfg.OnValueChanged(CCVars.AtmosHeatScale, value => HeatScale = value, true);
_cfg.OnValueChanged(CCVars.ExcitedGroups, value => ExcitedGroups = value, true); _cfg.OnValueChanged(CCVars.ExcitedGroups, value => ExcitedGroups = value, true);
_cfg.OnValueChanged(CCVars.ExcitedGroupsSpaceIsAllConsuming, value => ExcitedGroupsSpaceIsAllConsuming = value, true); _cfg.OnValueChanged(CCVars.ExcitedGroupsSpaceIsAllConsuming, value => ExcitedGroupsSpaceIsAllConsuming = value, true);
} }

View File

@@ -61,7 +61,7 @@ namespace Content.Server.Atmos.EntitySystems
NumericsHelpers.Multiply(moles, GasSpecificHeats, tmp); NumericsHelpers.Multiply(moles, GasSpecificHeats, tmp);
// Adjust heat capacity by speedup, because this is primarily what // Adjust heat capacity by speedup, because this is primarily what
// determines how quickly gases heat up/cool. // determines how quickly gases heat up/cool.
return MathF.Max(NumericsHelpers.HorizontalAdd(tmp), Atmospherics.MinimumHeatCapacity) / Speedup; return MathF.Max(NumericsHelpers.HorizontalAdd(tmp), Atmospherics.MinimumHeatCapacity) / HeatScale;
} }
/// <summary> /// <summary>
@@ -69,7 +69,7 @@ namespace Content.Server.Atmos.EntitySystems
/// </summary> /// </summary>
public float PumpSpeedup() public float PumpSpeedup()
{ {
return MathF.Sqrt(Speedup); return Speedup;
} }
/// <summary> /// <summary>

View File

@@ -45,7 +45,7 @@ public sealed partial class FrezonCoolantReaction : IGasReactionEffect
energyReleased = burnRate * Atmospherics.FrezonCoolEnergyReleased * energyModifier; energyReleased = burnRate * Atmospherics.FrezonCoolEnergyReleased * energyModifier;
} }
energyReleased /= atmosphereSystem.Speedup; // adjust energy to make sure speedup doesn't cause mega temperature rise energyReleased /= atmosphereSystem.HeatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
if (energyReleased >= 0f) if (energyReleased >= 0f)
return ReactionResult.NoReaction; return ReactionResult.NoReaction;

View File

@@ -56,7 +56,7 @@ namespace Content.Server.Atmos.Reactions
mixture.AdjustMoles(Gas.CarbonDioxide, plasmaBurnRate * (1.0f - supersaturation)); mixture.AdjustMoles(Gas.CarbonDioxide, plasmaBurnRate * (1.0f - supersaturation));
energyReleased += Atmospherics.FirePlasmaEnergyReleased * plasmaBurnRate; energyReleased += Atmospherics.FirePlasmaEnergyReleased * plasmaBurnRate;
energyReleased /= atmosphereSystem.Speedup; // adjust energy to make sure speedup doesn't cause mega temperature rise energyReleased /= atmosphereSystem.HeatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
mixture.ReactionResults[GasReaction.Fire] += plasmaBurnRate * (1 + oxygenBurnRate); mixture.ReactionResults[GasReaction.Fire] += plasmaBurnRate * (1 + oxygenBurnRate);
} }
} }

View File

@@ -47,7 +47,7 @@ namespace Content.Server.Atmos.Reactions
mixture.ReactionResults[GasReaction.Fire] += burnedFuel; mixture.ReactionResults[GasReaction.Fire] += burnedFuel;
} }
energyReleased /= atmosphereSystem.Speedup; // adjust energy to make sure speedup doesn't cause mega temperature rise energyReleased /= atmosphereSystem.HeatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
if (energyReleased > 0) if (energyReleased > 0)
{ {
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture); var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);

View File

@@ -1046,12 +1046,19 @@ namespace Content.Shared.CCVar
/// <summary> /// <summary>
/// Scale factor for how fast things happen in our atmosphere /// Scale factor for how fast things happen in our atmosphere
/// simulation compared to real life. 1x means that a room takes as /// simulation compared to real life. 1x means pumps run at 1x
/// long to heat up in game as real life. Players typically expect /// speed. Players typically expect things to happen faster
/// things to happen faster in-game. /// in-game.
/// </summary> /// </summary>
public static readonly CVarDef<float> AtmosSpeedup = public static readonly CVarDef<float> AtmosSpeedup =
CVarDef.Create("atmos.speedup", 64f, CVar.SERVERONLY); CVarDef.Create("atmos.speedup", 8f, CVar.SERVERONLY);
/// <summary>
/// Like atmos.speedup, but only for gas and reaction heat values. 64x means
/// gases heat up and cool down 64x faster than real life.
/// </summary>
public static readonly CVarDef<float> AtmosHeatScale =
CVarDef.Create("atmos.heat_scale", 64f, CVar.SERVERONLY);
/* /*
* MIDI instruments * MIDI instruments