forked from Rxup/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Atmos changes try one * Fixes * Update Content.Server/Backmen/Atmos/Reactions/HalonProductionReaction.cs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
2c659d4
commit 3939e98
Showing
15 changed files
with
297 additions
and
52 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
43 changes: 43 additions & 0 deletions
43
Content.Server/Backmen/Atmos/Reactions/HalonFrezonDecompositionReaction.cs
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,43 @@ | ||
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 HalonFrezonDecompositionReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialHalon = mixture.GetMoles(Gas.Halon); | ||
var initialFrezon = mixture.GetMoles(Gas.Frezon); | ||
|
||
var environmentEfficiency = mixture.Pressure * Atmospherics.HalonFrezonDecompositionPressureBonus / mixture.Volume; | ||
var ratioEfficiency = Math.Min(initialHalon / initialFrezon, 1); | ||
|
||
var producedAmount = Math.Min(ratioEfficiency * environmentEfficiency * 2f, Math.Min(initialFrezon * 0.5f, initialHalon * 0.5f)); | ||
|
||
if (producedAmount <= 0 || initialHalon - producedAmount * 0.5f < 0 || initialFrezon - producedAmount * 0.5f < 0) | ||
return ReactionResult.NoReaction; | ||
|
||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
mixture.AdjustMoles(Gas.Halon, -producedAmount * 0.5f); | ||
mixture.AdjustMoles(Gas.Frezon, -producedAmount * 0.5f); | ||
mixture.AdjustMoles(Gas.Helium, producedAmount * 1f); | ||
mixture.AdjustMoles(Gas.CarbonDioxide, producedAmount * 0.25f); | ||
mixture.AdjustMoles(Gas.Hydrogen, producedAmount * 2f); | ||
|
||
var energyReleased = producedAmount * Atmospherics.HalonFrezonDecompositionEnergy; | ||
|
||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
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
39 changes: 39 additions & 0 deletions
39
Content.Server/Backmen/Atmos/Reactions/HalonProductionReaction.cs
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,39 @@ | ||
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 HalonProductionReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialBZ = mixture.GetMoles(Gas.BZ); | ||
var initialTritium = mixture.GetMoles(Gas.Tritium); | ||
var initialHalon = mixture.GetMoles(Gas.Halon); | ||
|
||
var producedAmount = Math.Min(Atmospherics.HalonMaxRate, Math.Min(initialTritium * 0.5f, initialBZ * 0.2f)); | ||
|
||
if (producedAmount <= 0 || initialBZ - producedAmount * 0.2f < 0 || initialTritium - producedAmount * 0.5f < 0 || initialBZ > initialTritium + initialHalon) | ||
return ReactionResult.NoReaction; | ||
|
||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
|
||
mixture.AdjustMoles(Gas.BZ, -producedAmount * 0.2f); | ||
mixture.AdjustMoles(Gas.Tritium, -producedAmount * 0.5f); | ||
mixture.AdjustMoles(Gas.Halon, producedAmount * 0.7f); | ||
|
||
var energyReleased = producedAmount * Atmospherics.HalonFormationEnergy; | ||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,10 +1,23 @@ | ||
gas-ammonia-abbreviation = NH₃ | ||
gas-carbon-dioxide-abbreviation = CO₂ | ||
gas-frezon-abbreviation = F | ||
gas-frezon-abbreviation = Fr # backmen change | ||
gas-nitrogen-abbreviation = N₂ | ||
gas-nitrous-oxide-abbreviation = N₂O | ||
gas-oxygen-abbreviation = O₂ | ||
gas-plasma-abbreviation = P | ||
gas-plasma-abbreviation = Pl # backmen change | ||
gas-tritium-abbreviation = T | ||
gas-water-vapor-abbreviation = H₂O | ||
gas-unknown-abbreviation = X | ||
# backmen gases | ||
gas-bz-abbreviation = Bz | ||
gas-pluoxium-abbreviation = Pu | ||
gas-hydrogen-abbreviation = H₂ | ||
gas-nitrium-abbreviation = Ni | ||
gas-healium-abbreviation = Hi | ||
gas-hyper-nobilium-abbreviation = No | ||
gas-proto-nitrate-abbreviation = Pn | ||
gas-zauker-abbreviation = Zk | ||
gas-halon-abbreviation = Hl | ||
gas-helium-abbreviation = He | ||
gas-anti-nobilium-abbreviation = An |
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 |
---|---|---|
@@ -1,10 +1,23 @@ | ||
gas-ammonia-abbreviation = NH₃ | ||
gas-carbon-dioxide-abbreviation = CO₂ | ||
gas-frezon-abbreviation = F | ||
gas-frezon-abbreviation = Fr # backmen change | ||
gas-nitrogen-abbreviation = N₂ | ||
gas-nitrous-oxide-abbreviation = N₂O | ||
gas-oxygen-abbreviation = O₂ | ||
gas-plasma-abbreviation = P | ||
gas-plasma-abbreviation = Pl # backmen change | ||
gas-tritium-abbreviation = T | ||
gas-water-vapor-abbreviation = H₂O | ||
gas-unknown-abbreviation = X | ||
# backmen gases | ||
gas-bz-abbreviation = Bz | ||
gas-pluoxium-abbreviation = Pu | ||
gas-hydrogen-abbreviation = H₂ | ||
gas-nitrium-abbreviation = Ni | ||
gas-healium-abbreviation = Hi | ||
gas-hyper-nobilium-abbreviation = No | ||
gas-proto-nitrate-abbreviation = Pn | ||
gas-zauker-abbreviation = Zk | ||
gas-halon-abbreviation = Hl | ||
gas-helium-abbreviation = He | ||
gas-anti-nobilium-abbreviation = An |
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
Oops, something went wrong.