From: username <113782077+whateverusername0@users.noreply.github.com> Date: Thu, 21 Dec 2023 01:33:08 +0000 (+1000) Subject: Add nitrous oxide decomposition reaction (#22738) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=c514af0366b383cb60a54f5f9c236437d25fb677;p=space-station-14.git Add nitrous oxide decomposition reaction (#22738) Co-authored-by: whateverusername0 Co-authored-by: Kevin Zheng --- diff --git a/Content.Server/Atmos/Reactions/N2ODecompositionReaction.cs b/Content.Server/Atmos/Reactions/N2ODecompositionReaction.cs new file mode 100644 index 0000000000..7fce663dc3 --- /dev/null +++ b/Content.Server/Atmos/Reactions/N2ODecompositionReaction.cs @@ -0,0 +1,28 @@ +using Content.Server.Atmos.EntitySystems; +using Content.Shared.Atmos; +using JetBrains.Annotations; + +namespace Content.Server.Atmos.Reactions; + +/// +/// Decomposes Nitrous Oxide into Nitrogen and Oxygen. +/// +[UsedImplicitly] +public sealed partial class N2ODecompositionReaction : IGasReactionEffect +{ + public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) + { + var cacheN2O = mixture.GetMoles(Gas.NitrousOxide); + + var burnedFuel = cacheN2O / Atmospherics.N2ODecompositionRate; + + if (burnedFuel <= 0 || cacheN2O - burnedFuel < 0) + return ReactionResult.NoReaction; + + mixture.AdjustMoles(Gas.NitrousOxide, -burnedFuel); + mixture.AdjustMoles(Gas.Nitrogen, burnedFuel); + mixture.AdjustMoles(Gas.Oxygen, burnedFuel / 2); + + return ReactionResult.Reacting; + } +} diff --git a/Content.Shared/Atmos/Atmospherics.cs b/Content.Shared/Atmos/Atmospherics.cs index 71908326cc..148f03e2d9 100644 --- a/Content.Shared/Atmos/Atmospherics.cs +++ b/Content.Shared/Atmos/Atmospherics.cs @@ -236,6 +236,11 @@ namespace Content.Shared.Atmos /// public const float FrezonProductionConversionRate = 50f; + /// + /// The maximum portion of the N2O that can decompose each reaction tick. (50%) + /// + public const float N2ODecompositionRate = 2f; + /// /// How many mol of frezon can be converted into miasma in one cycle. /// diff --git a/Resources/Prototypes/Atmospherics/reactions.yml b/Resources/Prototypes/Atmospherics/reactions.yml index 6553ae551b..22ca8b66f9 100644 --- a/Resources/Prototypes/Atmospherics/reactions.yml +++ b/Resources/Prototypes/Atmospherics/reactions.yml @@ -1,4 +1,4 @@ -- type: gasReaction +- type: gasReaction id: PlasmaFire priority: -2 minimumTemperature: 373.149 # Same as Atmospherics.FireMinimumTemperatureToExist @@ -91,6 +91,23 @@ effects: - !type:MiasmaOxygenReaction {} +- type: gasReaction + id: N2ODecomposition + priority: 0 + minimumTemperature: 850 + minimumRequirements: + - 0 # oxygen + - 0 # nitrogen + - 0 # carbon dioxide + - 0 # plasma + - 0 # tritium + - 0 # vapor + - 0 # miasma + - 0.01 # n2o + - 0 # frezon + effects: + - !type:N2ODecompositionReaction {} + #- type: gasReaction # id: WaterVaporPuddle # priority: 1