атмос гейминг 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:
58
Content.Server/Atmos/Reactions/HydrogenFireReaction.cs
Normal file
58
Content.Server/Atmos/Reactions/HydrogenFireReaction.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed class HydrogenFireReaction : 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 energyReleased = 0f;
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
var temperature = mixture.Temperature;
|
||||
var location = holder as TileAtmosphere;
|
||||
mixture.ReactionResults[GasReaction.Fire] = 0;
|
||||
|
||||
var initialOxygen = mixture.GetMoles(Gas.Oxygen);
|
||||
var initialHydrogen = mixture.GetMoles(Gas.Hydrogen);
|
||||
|
||||
var burnedFuel = Math.Min(initialHydrogen / Atmospherics.FireH2BurnRateDelta, Math.Min(initialOxygen / (Atmospherics.FireH2BurnRateDelta * Atmospherics.H2OxygenFullBurn), Math.Min(initialHydrogen, initialOxygen * 0.5f)));
|
||||
|
||||
if (burnedFuel > 0)
|
||||
{
|
||||
energyReleased += Atmospherics.FireH2EnergyReleased * burnedFuel;
|
||||
|
||||
mixture.AdjustMoles(Gas.WaterVapor, burnedFuel);
|
||||
mixture.AdjustMoles(Gas.Hydrogen, -burnedFuel);
|
||||
mixture.AdjustMoles(Gas.Oxygen, -burnedFuel * 0.5f);
|
||||
|
||||
mixture.ReactionResults[GasReaction.Fire] += burnedFuel;
|
||||
}
|
||||
|
||||
if (energyReleased > 0)
|
||||
{
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = (temperature * oldHeatCapacity + energyReleased) / newHeatCapacity;
|
||||
}
|
||||
|
||||
if (location != null)
|
||||
{
|
||||
temperature = mixture.Temperature;
|
||||
if (temperature > Atmospherics.FireMinimumTemperatureToExist)
|
||||
{
|
||||
atmosphereSystem.HotspotExpose(location.GridIndex, location.GridIndices, temperature, mixture.Volume);
|
||||
}
|
||||
}
|
||||
|
||||
return mixture.ReactionResults[GasReaction.Fire] != 0 ? ReactionResult.Reacting : ReactionResult.NoReaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user