From e4ccd13845a48cd8eb987d770a89bb002917157e Mon Sep 17 00:00:00 2001 From: Tom Leys Date: Thu, 18 May 2023 07:22:56 +1200 Subject: [PATCH] Plasma still creates tritium down to 1 to 32 concentration (#16517) - But it's less efficient --- Content.Server/Atmos/Reactions/PlasmaFireReaction.cs | 11 +++++++++-- Content.Shared/Atmos/Atmospherics.cs | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/Reactions/PlasmaFireReaction.cs b/Content.Server/Atmos/Reactions/PlasmaFireReaction.cs index c0e830f250..cd8a773344 100644 --- a/Content.Server/Atmos/Reactions/PlasmaFireReaction.cs +++ b/Content.Server/Atmos/Reactions/PlasmaFireReaction.cs @@ -34,7 +34,11 @@ namespace Content.Server.Atmos.Reactions var initialPlasmaMoles = mixture.GetMoles(Gas.Plasma); // Supersaturation makes tritium. - var supersaturation = initialOxygenMoles / initialPlasmaMoles > Atmospherics.SuperSaturationThreshold; + var oxyRatio = initialOxygenMoles / initialPlasmaMoles; + // Efficiency of reaction decreases from 1% Plasma to 3% plasma: + var supersaturation = Math.Clamp((oxyRatio - Atmospherics.SuperSaturationEnds) / + (Atmospherics.SuperSaturationThreshold - + Atmospherics.SuperSaturationEnds), 0.0f, 1.0f); if (initialOxygenMoles > initialPlasmaMoles * Atmospherics.PlasmaOxygenFullburn) plasmaBurnRate = initialPlasmaMoles * temperatureScale / Atmospherics.PlasmaBurnRateDelta; @@ -46,7 +50,10 @@ namespace Content.Server.Atmos.Reactions plasmaBurnRate = MathF.Min(plasmaBurnRate, MathF.Min(initialPlasmaMoles, initialOxygenMoles / oxygenBurnRate)); mixture.SetMoles(Gas.Plasma, initialPlasmaMoles - plasmaBurnRate); mixture.SetMoles(Gas.Oxygen, initialOxygenMoles - plasmaBurnRate * oxygenBurnRate); - mixture.AdjustMoles(supersaturation ? Gas.Tritium : Gas.CarbonDioxide, plasmaBurnRate); + + // supersaturation adjusts the ratio of produced tritium to unwanted CO2 + mixture.AdjustMoles(Gas.Tritium, plasmaBurnRate * supersaturation); + mixture.AdjustMoles(Gas.CarbonDioxide, plasmaBurnRate * (1.0f - supersaturation)); energyReleased += Atmospherics.FirePlasmaEnergyReleased * plasmaBurnRate; mixture.ReactionResults[GasReaction.Fire] += plasmaBurnRate * (1 + oxygenBurnRate); diff --git a/Content.Shared/Atmos/Atmospherics.cs b/Content.Shared/Atmos/Atmospherics.cs index e2be8d73ff..293866ed77 100644 --- a/Content.Shared/Atmos/Atmospherics.cs +++ b/Content.Shared/Atmos/Atmospherics.cs @@ -187,6 +187,7 @@ namespace Content.Shared.Atmos public const float FireGrowthRate = 40000f; public const float SuperSaturationThreshold = 96f; + public const float SuperSaturationEnds = SuperSaturationThreshold / 3; public const float OxygenBurnRateBase = 1.4f; public const float PlasmaMinimumBurnTemperature = (100f+T0C); -- 2.51.2