forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 36e277b.
- Loading branch information
1 parent
dfaf886
commit 212e152
Showing
23 changed files
with
449 additions
and
704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions; | ||
|
||
[UsedImplicitly] | ||
public sealed partial class AmmoniaOxygenReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var nAmmonia = mixture.GetMoles(Gas.Ammonia); | ||
var nOxygen = mixture.GetMoles(Gas.Oxygen); | ||
var nTotal = mixture.TotalMoles; | ||
|
||
// Concentration-dependent reaction rate | ||
var fAmmonia = nAmmonia/nTotal; | ||
var fOxygen = nOxygen/nTotal; | ||
var rate = MathF.Pow(fAmmonia, 2) * MathF.Pow(fOxygen, 2); | ||
|
||
var deltaMoles = nAmmonia / Atmospherics.AmmoniaOxygenReactionRate * 2 * rate; | ||
|
||
if (deltaMoles <= 0 || nAmmonia - deltaMoles < 0) | ||
return ReactionResult.NoReaction; | ||
|
||
mixture.AdjustMoles(Gas.Ammonia, -deltaMoles); | ||
mixture.AdjustMoles(Gas.Oxygen, -deltaMoles); | ||
mixture.AdjustMoles(Gas.NitrousOxide, deltaMoles / 2); | ||
mixture.AdjustMoles(Gas.WaterVapor, deltaMoles * 1.5f); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions; | ||
|
||
/// <summary> | ||
/// Takes in nitrogen and frezon and cools down the surrounding area. | ||
/// </summary> | ||
[UsedImplicitly] | ||
public sealed partial class FrezonCoolantReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
var temperature = mixture.Temperature; | ||
|
||
var energyModifier = 1f; | ||
var scale = (temperature - Atmospherics.FrezonCoolLowerTemperature) / | ||
(Atmospherics.FrezonCoolMidTemperature - Atmospherics.FrezonCoolLowerTemperature); | ||
|
||
if (scale > 1f) | ||
{ | ||
// Scale energy but not frezon usage if we're in a very, very hot place | ||
energyModifier = Math.Min(scale, Atmospherics.FrezonCoolMaximumEnergyModifier); | ||
scale = 1f; | ||
} | ||
|
||
if (scale <= 0) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialNit = mixture.GetMoles(Gas.Nitrogen); | ||
var initialFrezon = mixture.GetMoles(Gas.Frezon); | ||
|
||
var burnRate = initialFrezon * scale / Atmospherics.FrezonCoolRateModifier; | ||
|
||
var energyReleased = 0f; | ||
if (burnRate > Atmospherics.MinimumHeatCapacity) | ||
{ | ||
var nitAmt = Math.Min(burnRate * Atmospherics.FrezonNitrogenCoolRatio, initialNit); | ||
var frezonAmt = Math.Min(burnRate, initialFrezon); | ||
mixture.AdjustMoles(Gas.Nitrogen, -nitAmt); | ||
mixture.AdjustMoles(Gas.Frezon, -frezonAmt); | ||
mixture.AdjustMoles(Gas.NitrousOxide, nitAmt + frezonAmt); | ||
energyReleased = burnRate * Atmospherics.FrezonCoolEnergyReleased * energyModifier; | ||
} | ||
|
||
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, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = (temperature * oldHeatCapacity + energyReleased) / newHeatCapacity; | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
56 changes: 0 additions & 56 deletions
56
Content.Server/Atmos/Reactions/FrezonOxygen_dissapation.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.