атмос гейминг indeed (#513)
* fix hypernob + plasma and trit fire * add 11 new gas types * actually fix hypernob --------- Co-authored-by: halicopter <kirillhalic@gmail.com>
This commit is contained in:
39
Content.Server/Atmos/Reactions/ZaukerProductionReaction.cs
Normal file
39
Content.Server/Atmos/Reactions/ZaukerProductionReaction.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class ZaukerProductionReaction : IGasReactionEffect
|
||||
{
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
|
||||
{
|
||||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium);
|
||||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var initialHypernoblium = mixture.GetMoles(Gas.HyperNoblium);
|
||||
var initialNitrium = mixture.GetMoles(Gas.Nitrium);
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
var heatEfficiency = Math.Min(temperature * Atmospherics.ZaukerFormationTemperatureScale, Math.Min(initialHypernoblium * 0.01f, initialNitrium * 0.5f));
|
||||
|
||||
if (heatEfficiency <= 0 || initialHypernoblium - heatEfficiency * 0.01f < 0 || initialNitrium - heatEfficiency * 0.5f < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.HyperNoblium, -heatEfficiency * 0.01f);
|
||||
mixture.AdjustMoles(Gas.Nitrium, -heatEfficiency * 0.5f);
|
||||
mixture.AdjustMoles(Gas.Zauker, heatEfficiency * 0.5f);
|
||||
|
||||
var energyUsed = heatEfficiency * Atmospherics.ZaukerFormationEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity - energyUsed) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user