-
Notifications
You must be signed in to change notification settings - Fork 592
Stimpack Rework #5944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: starlight-dev
Are you sure you want to change the base?
Stimpack Rework #5944
Changes from all commits
d993b57
557a9e5
c3d9565
28e8297
c5422fc
a8e10c5
cce0bee
f61ccb2
14c6e9f
c5bf7a7
2ed864f
8928f59
90bf789
29c16b5
ee12d1f
a962c72
cad48e1
d578dd3
d7fd9c9
8ed8623
3fb9996
3ee8e4e
eda3d7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| using Content.Server.Atmos; | ||
| using Content.Server.Atmos.EntitySystems; | ||
| using Content.Shared.Atmos; | ||
| using Content.Shared.Atmos.Reactions; | ||
| using JetBrains.Annotations; | ||
|
|
||
| namespace Content.Server._Starlight.Atmos.Reactions; | ||
|
|
||
| /// <summary> | ||
| /// Funky Atmos - /tg/ gases - Starlight Overhaul | ||
| /// Produces Nitrium by mixing Tritium, Nitrogen and Pluoxium at temperatures above 500K. | ||
| /// </summary> | ||
| [UsedImplicitly] | ||
| public sealed partial class NitriumProductionReaction : IGasReactionEffect | ||
| { | ||
| public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
| { | ||
| if (mixture.Temperature > 20f && mixture.GetMoles(Gas.HyperNoblium) >= 5f) | ||
| return ReactionResult.NoReaction; | ||
|
|
||
| var initTritium = mixture.GetMoles(Gas.Tritium); | ||
| var initNitrogen = mixture.GetMoles(Gas.Nitrogen); | ||
| var initPluox = mixture.GetMoles(Gas.Pluoxium); | ||
| var initBZ = mixture.GetMoles(Gas.BZ); | ||
| var pressure = mixture.Pressure; | ||
| var volume = mixture.Volume; | ||
| var temperature = mixture.Temperature; | ||
|
|
||
| var catalyze = 1f + (initBZ / 100f) ; | ||
|
|
||
| /// Check what ingredient is smallest relative to its un-catalyzed demand. Use it as a limiter. | ||
|
|
||
| var limit = Math.Min(initTritium / 2f, Math.Min(initNitrogen * catalyze / 3f, initPluox)); | ||
|
|
||
| /// Produces faster with higher temperature, lower pressure, and higher concetrations of BZ. BZ also magnifies the nitrogen consumption so watch out. | ||
|
|
||
| var tempRate = temperature / 500f ; | ||
|
|
||
| var pressureRate = (10f / pressure) * 2f ; | ||
|
Check warning on line 39 in Content.Server/_Starlight/Atmos/Reactions/NitriumProductionReaction.cs
|
||
|
|
||
| var rate = Math.Min(0.5F * tempRate * pressureRate * catalyze, limit); | ||
|
|
||
| var tritiumRemoved = 2f * rate; | ||
| var nitrogenRemoved = 3f * rate * catalyze; | ||
| var pluoxRemoved = 1f * rate; | ||
|
|
||
| var nitriumProduced = 3f * rate; | ||
|
|
||
| mixture.AdjustMoles(Gas.Tritium, -tritiumRemoved); | ||
| mixture.AdjustMoles(Gas.Nitrogen, -nitrogenRemoved); | ||
| mixture.AdjustMoles(Gas.Pluoxium, -pluoxRemoved); | ||
| mixture.AdjustMoles(Gas.Nitrium, nitriumProduced); | ||
|
|
||
| var energyReleased = rate * Atmospherics.NitriumProductionEnergy / heatScale; | ||
| var heatCap = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
| if (heatCap > Atmospherics.MinimumHeatCapacity) | ||
| mixture.Temperature = Math.Max((mixture.Temperature * heatCap + energyReleased) / heatCap, Atmospherics.TCMB); | ||
|
Check warning on line 57 in Content.Server/_Starlight/Atmos/Reactions/NitriumProductionReaction.cs
|
||
|
|
||
| return ReactionResult.Reacting; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.