Atmos scaling cvar changes (#22501)
This commit is contained in:
@@ -10,9 +10,9 @@ namespace Content.Server.Atmos.Reactions;
|
||||
[UsedImplicitly]
|
||||
public sealed partial class FrezonCoolantReaction : IGasReactionEffect
|
||||
{
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
|
||||
{
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
var temperature = mixture.Temperature;
|
||||
|
||||
var energyModifier = 1f;
|
||||
@@ -45,11 +45,11 @@ public sealed partial class FrezonCoolantReaction : IGasReactionEffect
|
||||
energyReleased = burnRate * Atmospherics.FrezonCoolEnergyReleased * energyModifier;
|
||||
}
|
||||
|
||||
energyReleased /= atmosphereSystem.HeatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
|
||||
energyReleased /= heatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
|
||||
if (energyReleased >= 0f)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = (temperature * oldHeatCapacity + energyReleased) / newHeatCapacity;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Server.Atmos.Reactions;
|
||||
[UsedImplicitly]
|
||||
public sealed partial class FrezonProductionReaction : IGasReactionEffect
|
||||
{
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
|
||||
{
|
||||
var initialN2 = mixture.GetMoles(Gas.Nitrogen);
|
||||
var initialOxy = mixture.GetMoles(Gas.Oxygen);
|
||||
@@ -28,7 +28,6 @@ public sealed partial class FrezonProductionReaction : IGasReactionEffect
|
||||
// Amount of tritium & oxygen that are reacting
|
||||
var tritBurned = Math.Min(oxyLimit, initialTrit);
|
||||
var oxyBurned = tritBurned * Atmospherics.FrezonProductionTritRatio;
|
||||
var burnRatio = tritBurned / initialTrit;
|
||||
|
||||
var oxyConversion = oxyBurned / Atmospherics.FrezonProductionConversionRate;
|
||||
var tritConversion = tritBurned / Atmospherics.FrezonProductionConversionRate;
|
||||
|
||||
@@ -60,13 +60,20 @@ namespace Content.Server.Atmos.Reactions
|
||||
/// </summary>
|
||||
[DataField("effects")] private List<IGasReactionEffect> _effects = new();
|
||||
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
|
||||
/// <summary>
|
||||
/// Process all reaction effects.
|
||||
/// </summary>
|
||||
/// <param name="mixture">The gas mixture to react</param>
|
||||
/// <param name="holder">The container of this gas mixture</param>
|
||||
/// <param name="atmosphereSystem">The atmosphere system</param>
|
||||
/// <param name="heatScale">Scaling factor that should be applied to all heat input or outputs.</param>
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
|
||||
{
|
||||
var result = ReactionResult.NoReaction;
|
||||
|
||||
foreach (var effect in _effects)
|
||||
{
|
||||
result |= effect.React(mixture, holder, atmosphereSystem);
|
||||
result |= effect.React(mixture, holder, atmosphereSystem, heatScale);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Server.Atmos.Reactions;
|
||||
[UsedImplicitly]
|
||||
public sealed partial class MiasmicSubsumationReaction : IGasReactionEffect
|
||||
{
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
|
||||
{
|
||||
var initialMiasma = mixture.GetMoles(Gas.Miasma);
|
||||
var initialFrezon = mixture.GetMoles(Gas.Frezon);
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace Content.Server.Atmos.Reactions
|
||||
[DataDefinition]
|
||||
public sealed partial class PlasmaFireReaction : IGasReactionEffect
|
||||
{
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
|
||||
{
|
||||
var energyReleased = 0f;
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
var temperature = mixture.Temperature;
|
||||
var location = holder as TileAtmosphere;
|
||||
mixture.ReactionResults[GasReaction.Fire] = 0;
|
||||
@@ -22,8 +22,10 @@ namespace Content.Server.Atmos.Reactions
|
||||
if (temperature > Atmospherics.PlasmaUpperTemperature)
|
||||
temperatureScale = 1f;
|
||||
else
|
||||
{
|
||||
temperatureScale = (temperature - Atmospherics.PlasmaMinimumBurnTemperature) /
|
||||
(Atmospherics.PlasmaUpperTemperature - Atmospherics.PlasmaMinimumBurnTemperature);
|
||||
}
|
||||
|
||||
if (temperatureScale > 0)
|
||||
{
|
||||
@@ -56,14 +58,14 @@ namespace Content.Server.Atmos.Reactions
|
||||
mixture.AdjustMoles(Gas.CarbonDioxide, plasmaBurnRate * (1.0f - supersaturation));
|
||||
|
||||
energyReleased += Atmospherics.FirePlasmaEnergyReleased * plasmaBurnRate;
|
||||
energyReleased /= atmosphereSystem.HeatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
|
||||
energyReleased /= heatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
|
||||
mixture.ReactionResults[GasReaction.Fire] += plasmaBurnRate * (1 + oxygenBurnRate);
|
||||
}
|
||||
}
|
||||
|
||||
if (energyReleased > 0)
|
||||
{
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = (temperature * oldHeatCapacity + energyReleased) / newHeatCapacity;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace Content.Server.Atmos.Reactions
|
||||
[DataDefinition]
|
||||
public sealed partial class TritiumFireReaction : IGasReactionEffect
|
||||
{
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
|
||||
{
|
||||
var energyReleased = 0f;
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
var temperature = mixture.Temperature;
|
||||
var location = holder as TileAtmosphere;
|
||||
mixture.ReactionResults[GasReaction.Fire] = 0f;
|
||||
@@ -47,10 +47,10 @@ namespace Content.Server.Atmos.Reactions
|
||||
mixture.ReactionResults[GasReaction.Fire] += burnedFuel;
|
||||
}
|
||||
|
||||
energyReleased /= atmosphereSystem.HeatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
|
||||
energyReleased /= heatScale; // adjust energy to make sure speedup doesn't cause mega temperature rise
|
||||
if (energyReleased > 0)
|
||||
{
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = ((temperature * oldHeatCapacity + energyReleased) / newHeatCapacity);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.Atmos.Reactions
|
||||
|
||||
[DataField("molesPerUnit")] public float MolesPerUnit { get; private set; } = 1;
|
||||
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
|
||||
{
|
||||
// If any of the prototypes is invalid, we do nothing.
|
||||
if (string.IsNullOrEmpty(Reagent))
|
||||
@@ -34,9 +34,8 @@ namespace Content.Server.Atmos.Reactions
|
||||
// Remove the moles from the mixture...
|
||||
mixture.AdjustMoles(GasId, -MolesPerUnit);
|
||||
|
||||
var tileRef = tile.GridIndices.GetTileRef(tile.GridIndex);
|
||||
EntitySystem.Get<PuddleSystem>()
|
||||
.TrySpillAt(tileRef, new Solution(Reagent, FixedPoint2.New(MolesPerUnit)), out _, sound: false);
|
||||
var tileRef = atmosphereSystem.GetTileRef(tile);
|
||||
atmosphereSystem.Puddle.TrySpillAt(tileRef, new Solution(Reagent, FixedPoint2.New(MolesPerUnit)), out _, sound: false);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user