атмос гейминг 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:
@@ -43,7 +43,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
ExcitedGroupResetCooldowns(tile.ExcitedGroup);
|
||||
|
||||
if ((tile.Hotspot.Temperature < Atmospherics.FireMinimumTemperatureToExist) || (tile.Hotspot.Volume <= 1f)
|
||||
|| tile.Air == null || tile.Air.GetMoles(Gas.Oxygen) < 0.5f || (tile.Air.GetMoles(Gas.Plasma) < 0.5f && tile.Air.GetMoles(Gas.Tritium) < 0.5f))
|
||||
|| tile.Air == null || tile.Air.GetMoles(Gas.Oxygen) < 0.5f || (tile.Air.GetMoles(Gas.Plasma) < 0.5f && tile.Air.GetMoles(Gas.Tritium) < 0.5f && tile.Air.GetMoles(Gas.Hydrogen) < 0.5f && tile.Air.GetMoles(Gas.HyperNoblium) > 5f))
|
||||
{
|
||||
tile.Hotspot = new Hotspot();
|
||||
InvalidateVisuals(tile.GridIndex, tile.GridIndices);
|
||||
@@ -107,12 +107,14 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
var plasma = tile.Air.GetMoles(Gas.Plasma);
|
||||
var tritium = tile.Air.GetMoles(Gas.Tritium);
|
||||
var hydrogen = tile.Air.GetMoles(Gas.Hydrogen);
|
||||
var hypernoblium = tile.Air.GetMoles(Gas.HyperNoblium);
|
||||
|
||||
if (tile.Hotspot.Valid)
|
||||
{
|
||||
if (soh)
|
||||
{
|
||||
if (plasma > 0.5f || tritium > 0.5f)
|
||||
if (plasma > 0.5f && hypernoblium < 5f || tritium > 0.5f && hypernoblium < 5f || hydrogen > 0.5f && hypernoblium < 5f)
|
||||
{
|
||||
if (tile.Hotspot.Temperature < exposedTemperature)
|
||||
tile.Hotspot.Temperature = exposedTemperature;
|
||||
@@ -124,10 +126,10 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
if ((exposedTemperature > Atmospherics.PlasmaMinimumBurnTemperature) && (plasma > 0.5f || tritium > 0.5f))
|
||||
if ((exposedTemperature > Atmospherics.PlasmaMinimumBurnTemperature) && (plasma > 0.5f && hypernoblium < 5f || tritium > 0.5f && hypernoblium < 5f || hydrogen > 0.5f && hypernoblium < 5f))
|
||||
{
|
||||
if (sparkSourceUid.HasValue)
|
||||
_adminLog.Add(LogType.Flammable, LogImpact.High, $"Heat/spark of {ToPrettyString(sparkSourceUid.Value)} caused atmos ignition of gas: {tile.Air.Temperature.ToString():temperature}K - {oxygen}mol Oxygen, {plasma}mol Plasma, {tritium}mol Tritium");
|
||||
_adminLog.Add(LogType.Flammable, LogImpact.High, $"Heat/spark of {ToPrettyString(sparkSourceUid.Value)} caused atmos ignition of gas: {tile.Air.Temperature.ToString():temperature}K - {oxygen}mol Oxygen, {plasma}mol Plasma, {tritium}mol Tritium, {hydrogen}mol Hydrogen");
|
||||
|
||||
tile.Hotspot = new Hotspot
|
||||
{
|
||||
|
||||
@@ -30,7 +30,18 @@ namespace Content.Server.Atmos.Portable
|
||||
Gas.WaterVapor,
|
||||
Gas.Ammonia,
|
||||
Gas.NitrousOxide,
|
||||
Gas.Frezon
|
||||
Gas.Frezon,
|
||||
Gas.BZ,
|
||||
Gas.Pluoxium,
|
||||
Gas.Hydrogen,
|
||||
Gas.Nitrium,
|
||||
Gas.Healium,
|
||||
Gas.HyperNoblium,
|
||||
Gas.ProtoNitrate,
|
||||
Gas.Zauker,
|
||||
Gas.Halon,
|
||||
Gas.Helium,
|
||||
Gas.AntiNoblium
|
||||
};
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
|
||||
50
Content.Server/Atmos/Reactions/BZProductionReaction.cs
Normal file
50
Content.Server/Atmos/Reactions/BZProductionReaction.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class BZProductionReaction : 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 initialNitrousOxide = mixture.GetMoles(Gas.NitrousOxide);
|
||||
var initialPlasma = mixture.GetMoles(Gas.Plasma);
|
||||
|
||||
var environmentEfficiency = mixture.Volume / mixture.Pressure;
|
||||
var ratioEfficiency = Math.Min(initialNitrousOxide / initialPlasma, 1);
|
||||
|
||||
var BZFormed = Math.Min(0.01f * ratioEfficiency * environmentEfficiency, Math.Min(initialNitrousOxide * 0.4f, initialPlasma * 0.8f));
|
||||
|
||||
if (initialNitrousOxide - BZFormed * 0.4f < 0 || initialPlasma - (0.8f - BZFormed) < 0 || BZFormed <= 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
var amountDecomposed = 0.0f;
|
||||
var nitrousOxideDecomposedFactor = Math.Max(4.0f * (initialPlasma / (initialNitrousOxide + initialPlasma) - 0.75f), 0);
|
||||
if (nitrousOxideDecomposedFactor > 0)
|
||||
{
|
||||
amountDecomposed = 0.4f * BZFormed * nitrousOxideDecomposedFactor;
|
||||
mixture.AdjustMoles(Gas.Oxygen, amountDecomposed);
|
||||
mixture.AdjustMoles(Gas.Nitrogen, 0.5f * amountDecomposed);
|
||||
}
|
||||
|
||||
mixture.AdjustMoles(Gas.BZ, Math.Max(0f, BZFormed * (1.0f - nitrousOxideDecomposedFactor)));
|
||||
mixture.AdjustMoles(Gas.NitrousOxide, -0.4f * BZFormed);
|
||||
mixture.AdjustMoles(Gas.Plasma, -0.8f * BZFormed * (1.0f - nitrousOxideDecomposedFactor));
|
||||
|
||||
var energyReleased = BZFormed * (Atmospherics.BZFormationEnergy + nitrousOxideDecomposedFactor * (Atmospherics.NitrousOxideDecompositionEnergy - Atmospherics.BZFormationEnergy));
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,11 @@ public sealed partial class FrezonCoolantReaction : IGasReactionEffect
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
|
||||
{
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
|
||||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium);
|
||||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
|
||||
var energyModifier = 1f;
|
||||
|
||||
@@ -13,6 +13,10 @@ public sealed partial class FrezonProductionReaction : 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 initialN2 = mixture.GetMoles(Gas.Nitrogen);
|
||||
var initialOxy = mixture.GetMoles(Gas.Oxygen);
|
||||
var initialTrit = mixture.GetMoles(Gas.Tritium);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class HalonOxygenAbsorptionReaction : 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 initialHalon = mixture.GetMoles(Gas.Halon);
|
||||
var initialOxygen = mixture.GetMoles(Gas.Oxygen);
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
|
||||
var heatEfficiency = Math.Min(temperature / (Atmospherics.FireMinimumTemperatureToExist * 10f), Math.Min(initialHalon, initialOxygen*20f));
|
||||
if (heatEfficiency <= 0f || initialHalon - heatEfficiency < 0f || initialOxygen - heatEfficiency * 20f < 0f)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.Halon, -heatEfficiency);
|
||||
mixture.AdjustMoles(Gas.Oxygen, -heatEfficiency*20f);
|
||||
mixture.AdjustMoles(Gas.CarbonDioxide, heatEfficiency*5f);
|
||||
|
||||
var energyUsed = heatEfficiency * Atmospherics.HalonCombustionEnergy;
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyUsed) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
39
Content.Server/Atmos/Reactions/HealiumProductionReaction.cs
Normal file
39
Content.Server/Atmos/Reactions/HealiumProductionReaction.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 HealiumProductionReaction : 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 initialBZ = mixture.GetMoles(Gas.BZ);
|
||||
var initialFrezon = mixture.GetMoles(Gas.Frezon);
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
var heatEfficiency = Math.Min(temperature*0.3f, Math.Min(initialFrezon*2.75f, initialBZ*0.25f));
|
||||
|
||||
if (heatEfficiency <= 0 || initialFrezon - heatEfficiency * 2.75f < 0 || initialBZ - heatEfficiency * 0.25f < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.Frezon, -heatEfficiency*2.75f);
|
||||
mixture.AdjustMoles(Gas.BZ, -heatEfficiency*0.25f);
|
||||
mixture.AdjustMoles(Gas.Healium, heatEfficiency*3);
|
||||
|
||||
var energyReleased = heatEfficiency * Atmospherics.HealiumFormationEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class HyperNobliumProductionReaction : 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 initialNitrogen = mixture.GetMoles(Gas.Nitrogen);
|
||||
var initialTritium = mixture.GetMoles(Gas.Tritium);
|
||||
var initialBZ = mixture.GetMoles(Gas.BZ);
|
||||
|
||||
var nobFormed = Math.Min((initialNitrogen+initialTritium)*0.01f,Math.Min(initialTritium*5f, initialNitrogen*10f));
|
||||
if (nobFormed <= 0 || (initialTritium - 5f) * nobFormed < 0 || (initialNitrogen - 10f) * nobFormed < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
var reductionFactor = Math.Clamp(initialTritium/(initialTritium+initialBZ), 0.001f, 1f);
|
||||
|
||||
mixture.AdjustMoles(Gas.Tritium, -5f * nobFormed * reductionFactor);
|
||||
mixture.AdjustMoles(Gas.Nitrogen, -10f * nobFormed);
|
||||
mixture.AdjustMoles(Gas.HyperNoblium, nobFormed);
|
||||
|
||||
var energyReleased = nobFormed * (Atmospherics.NobliumFormationEnergy/Math.Max(initialBZ, 1));
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class NitriumDecompositionReaction : 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 initialNitrium = mixture.GetMoles(Gas.Nitrium);
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
var heatEfficiency = Math.Min(temperature / Atmospherics.NitriumDecompositionTempDivisor, initialNitrium);
|
||||
|
||||
if (heatEfficiency <= 0 || initialNitrium - heatEfficiency < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.Nitrium, -heatEfficiency);
|
||||
mixture.AdjustMoles(Gas.Hydrogen, heatEfficiency);
|
||||
mixture.AdjustMoles(Gas.Nitrogen, heatEfficiency);
|
||||
|
||||
var energyReleased = heatEfficiency * Atmospherics.NitriumDecompositionEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
40
Content.Server/Atmos/Reactions/NitriumProductionReaction.cs
Normal file
40
Content.Server/Atmos/Reactions/NitriumProductionReaction.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class NitriumProductionReaction : 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 initialTritium = mixture.GetMoles(Gas.Tritium);
|
||||
var initialNitrogen = mixture.GetMoles(Gas.Nitrogen);
|
||||
var initialBZ = mixture.GetMoles(Gas.BZ);
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
var heatEfficiency = Math.Min(temperature / Atmospherics.NitriumFormationTempDivisor, Math.Min(initialTritium, Math.Min(initialNitrogen, initialBZ * 0.05f)));
|
||||
|
||||
if (heatEfficiency <= 0 || initialTritium - heatEfficiency < 0 || initialNitrogen - heatEfficiency < 0 || initialBZ - heatEfficiency * 0.05f < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
mixture.AdjustMoles(Gas.Tritium, -heatEfficiency);
|
||||
mixture.AdjustMoles(Gas.Nitrogen, -heatEfficiency);
|
||||
mixture.AdjustMoles(Gas.BZ, -heatEfficiency * 0.05f);
|
||||
mixture.AdjustMoles(Gas.Nitrium, heatEfficiency);
|
||||
|
||||
var energyUsed = heatEfficiency * Atmospherics.NitriumFormationEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity - energyUsed) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@ namespace Content.Server.Atmos.Reactions
|
||||
{
|
||||
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 energyReleased = 0f;
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
var temperature = mixture.Temperature;
|
||||
|
||||
40
Content.Server/Atmos/Reactions/PluoxiumProductionReaction.cs
Normal file
40
Content.Server/Atmos/Reactions/PluoxiumProductionReaction.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class PluoxiumProductionReaction : 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 initialCarbonDioxide = mixture.GetMoles(Gas.CarbonDioxide);
|
||||
var initialOxygen = mixture.GetMoles(Gas.Oxygen);
|
||||
var initialTritium = mixture.GetMoles(Gas.Tritium);
|
||||
|
||||
var producedAmount = Math.Min(Atmospherics.PluoxiumMaxRate, Math.Min(initialCarbonDioxide, Math.Min(initialOxygen * 0.5f, initialTritium * 0.01f)));
|
||||
|
||||
if (producedAmount <= 0 || initialCarbonDioxide - producedAmount < 0 || initialOxygen - producedAmount * 0.5f < 0 || initialTritium - producedAmount * 0.01f <0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
mixture.AdjustMoles(Gas.CarbonDioxide, -producedAmount);
|
||||
mixture.AdjustMoles(Gas.Oxygen, -producedAmount * 0.5f);
|
||||
mixture.AdjustMoles(Gas.Tritium, -producedAmount * 0.01f);
|
||||
mixture.AdjustMoles(Gas.Pluoxium, producedAmount);
|
||||
mixture.AdjustMoles(Gas.Hydrogen, producedAmount * 0.01f);
|
||||
|
||||
var energyReleased = producedAmount * Atmospherics.PluoxiumFormationEnergy;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class ProtoNitrateBZaseConversionReaction : 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 initialProtoNitrate = mixture.GetMoles(Gas.ProtoNitrate);
|
||||
var initialBZ = mixture.GetMoles(Gas.BZ);
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
var consumedAmount = Math.Min(temperature/2240f * initialBZ * initialProtoNitrate / (initialBZ + initialProtoNitrate), Math.Min(initialBZ, initialProtoNitrate));
|
||||
|
||||
if (consumedAmount <= 0 || initialBZ - consumedAmount < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.BZ, -consumedAmount);
|
||||
mixture.AdjustMoles(Gas.Nitrogen, consumedAmount*0.4f);
|
||||
mixture.AdjustMoles(Gas.Helium, consumedAmount*1.6f);
|
||||
mixture.AdjustMoles(Gas.Plasma, consumedAmount*0.8f);
|
||||
|
||||
var energyReleased = consumedAmount * Atmospherics.ProtoNitrateBZaseConversionEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class ProtoNitrateHydrogenConversionReaction : 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 initialProtoNitrate = mixture.GetMoles(Gas.ProtoNitrate);
|
||||
var initialHydrogen = mixture.GetMoles(Gas.Hydrogen);
|
||||
|
||||
var producedAmount = Math.Min(Atmospherics.ProtoNitrateHydrogenConversionMaxRate, Math.Min(initialHydrogen, initialProtoNitrate));
|
||||
|
||||
if (producedAmount <= 0 || initialHydrogen-producedAmount < 0f)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.Hydrogen, -producedAmount);
|
||||
mixture.AdjustMoles(Gas.ProtoNitrate, producedAmount*0.5f);
|
||||
|
||||
var energyUsed = producedAmount * Atmospherics.ProtoNitrateHydrogenConversionEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity - energyUsed) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
@@ -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 ProtoNitrateProductionReaction : 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 initialPluoxium = mixture.GetMoles(Gas.Pluoxium);
|
||||
var initialHydrogen = mixture.GetMoles(Gas.Hydrogen);
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
var heatEfficiency = Math.Min(temperature * 0.005f, Math.Min(initialPluoxium * 0.2f, initialHydrogen * 2.0f));
|
||||
|
||||
if (heatEfficiency <= 0 || initialPluoxium - heatEfficiency * 0.2f < 0 || initialHydrogen - heatEfficiency * 2f < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.Hydrogen, -heatEfficiency * 2f);
|
||||
mixture.AdjustMoles(Gas.Pluoxium, -heatEfficiency * 0.2f);
|
||||
mixture.AdjustMoles(Gas.ProtoNitrate, heatEfficiency * 0.2f);
|
||||
|
||||
var energyReleased = heatEfficiency * Atmospherics.ProtoNitrateFormationEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
@@ -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 ProtoNitrateTritiumConversionReaction : 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 initialProtoNitrate = mixture.GetMoles(Gas.ProtoNitrate);
|
||||
var initialTritium = mixture.GetMoles(Gas.Tritium);
|
||||
|
||||
var temperature = mixture.Temperature;
|
||||
var producedAmount = Math.Min(temperature/34f*initialTritium*initialProtoNitrate/(initialTritium+10f*initialProtoNitrate), Math.Min(initialTritium, initialProtoNitrate*0.01f));
|
||||
|
||||
if (initialTritium - producedAmount < 0 || initialProtoNitrate - producedAmount * 0.01f < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.ProtoNitrate, -producedAmount * 0.01f);
|
||||
mixture.AdjustMoles(Gas.Tritium, -producedAmount);
|
||||
mixture.AdjustMoles(Gas.Hydrogen, producedAmount);
|
||||
|
||||
var energyReleased = producedAmount * Atmospherics.ProtoNitrateTritiumConversionEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@ namespace Content.Server.Atmos.Reactions
|
||||
{
|
||||
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 energyReleased = 0f;
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true);
|
||||
var temperature = mixture.Temperature;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class ZaukerDecompositionReaction : 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 initialZauker = mixture.GetMoles(Gas.Zauker);
|
||||
var initialNitrogen = mixture.GetMoles(Gas.Nitrogen);
|
||||
|
||||
var burnedFuel = Math.Min(Atmospherics.ZaukerDecompositionMaxRate, Math.Min(initialNitrogen,initialZauker));
|
||||
|
||||
if (burnedFuel <= 0 || initialZauker - burnedFuel < 0)
|
||||
return ReactionResult.NoReaction;
|
||||
|
||||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
|
||||
mixture.AdjustMoles(Gas.Zauker, -burnedFuel);
|
||||
mixture.AdjustMoles(Gas.Oxygen, burnedFuel*0.3f);
|
||||
mixture.AdjustMoles(Gas.Nitrogen, burnedFuel*0.7f);
|
||||
|
||||
var energyReleased = burnedFuel * Atmospherics.ZaukerDecompositionEnergy;
|
||||
|
||||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB);
|
||||
|
||||
return ReactionResult.Reacting;
|
||||
}
|
||||
}
|
||||
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