Adds tritium fire reaction and water vapor, fix gas reactions (#1623)
hehe Tritfire go BRRRR
This commit is contained in:
committed by
GitHub
parent
cc9f16e738
commit
b5a976b173
@@ -16,6 +16,11 @@ namespace Content.Server.Atmos.Reactions
|
||||
StopReactions = 2,
|
||||
}
|
||||
|
||||
public enum GasReaction : byte
|
||||
{
|
||||
Fire = 0,
|
||||
}
|
||||
|
||||
[Prototype("gasReaction")]
|
||||
public class GasReactionPrototype : IPrototype, IIndexedPrototype
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using CannyFastMath;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions
|
||||
@@ -53,7 +54,7 @@ namespace Content.Server.Atmos.Reactions
|
||||
|
||||
energyReleased += Atmospherics.FirePhoronEnergyReleased * (phoronBurnRate);
|
||||
|
||||
mixture.ReactionResultFire += (phoronBurnRate) * (1 + oxygenBurnRate);
|
||||
mixture.ReactionResults[GasReaction.Fire] += (phoronBurnRate) * (1 + oxygenBurnRate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,15 +70,15 @@ namespace Content.Server.Atmos.Reactions
|
||||
temperature = mixture.Temperature;
|
||||
if (temperature > Atmospherics.FireMinimumTemperatureToExist)
|
||||
{
|
||||
location.HotspotExpose(temperature, Atmospherics.CellVolume);
|
||||
location.HotspotExpose(temperature, mixture.Volume);
|
||||
|
||||
// TODO ATMOS Expose temperature all items on cell
|
||||
|
||||
location.TemperatureExpose(mixture, temperature, Atmospherics.CellVolume);
|
||||
location.TemperatureExpose(mixture, temperature, mixture.Volume);
|
||||
}
|
||||
}
|
||||
|
||||
return mixture.ReactionResultFire != 0 ? ReactionResult.Reacting : ReactionResult.NoReaction;
|
||||
return mixture.ReactionResults[GasReaction.Fire] != 0 ? ReactionResult.Reacting : ReactionResult.NoReaction;
|
||||
}
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
|
||||
78
Content.Server/Atmos/Reactions/TritiumFireReaction.cs
Normal file
78
Content.Server/Atmos/Reactions/TritiumFireReaction.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
#nullable enable
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.Atmos.Reactions
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class TritiumFireReaction : IGasReactionEffect
|
||||
{
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
}
|
||||
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder)
|
||||
{
|
||||
var energyReleased = 0f;
|
||||
var oldHeatCapacity = mixture.HeatCapacity;
|
||||
var temperature = mixture.Temperature;
|
||||
var location = holder as TileAtmosphere;
|
||||
mixture.ReactionResults[GasReaction.Fire] = 0f;
|
||||
var burnedFuel = 0f;
|
||||
var initialTrit = mixture.GetMoles(Gas.Tritium);
|
||||
|
||||
if (mixture.GetMoles(Gas.Oxygen) < initialTrit ||
|
||||
Atmospherics.MinimumTritiumOxyburnEnergy > (temperature * oldHeatCapacity))
|
||||
{
|
||||
burnedFuel = mixture.GetMoles(Gas.Oxygen) / Atmospherics.TritiumBurnOxyFactor;
|
||||
if (burnedFuel > initialTrit)
|
||||
burnedFuel = initialTrit;
|
||||
|
||||
mixture.AdjustMoles(Gas.Tritium, -burnedFuel);
|
||||
}
|
||||
else
|
||||
{
|
||||
burnedFuel = initialTrit;
|
||||
mixture.SetMoles(Gas.Tritium, mixture.GetMoles(Gas.Tritium ) * (1 - 1 / Atmospherics.TritiumBurnTritFactor));
|
||||
mixture.AdjustMoles(Gas.Oxygen, -mixture.GetMoles(Gas.Tritium));
|
||||
energyReleased += (Atmospherics.FireHydrogenEnergyReleased * burnedFuel * (Atmospherics.TritiumBurnTritFactor - 1));
|
||||
}
|
||||
|
||||
if (burnedFuel > 0)
|
||||
{
|
||||
energyReleased += (Atmospherics.FireHydrogenEnergyReleased * burnedFuel);
|
||||
|
||||
// TODO ATMOS Radiation pulse here!
|
||||
|
||||
// Conservation of mass is important.
|
||||
mixture.AdjustMoles(Gas.WaterVapor, burnedFuel);
|
||||
|
||||
mixture.ReactionResults[GasReaction.Fire] += burnedFuel;
|
||||
}
|
||||
|
||||
if (energyReleased > 0)
|
||||
{
|
||||
var newHeatCapacity = mixture.HeatCapacity;
|
||||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||
mixture.Temperature = ((temperature * oldHeatCapacity + energyReleased) / newHeatCapacity);
|
||||
}
|
||||
|
||||
if (location != null)
|
||||
{
|
||||
temperature = mixture.Temperature;
|
||||
if (temperature > Atmospherics.FireMinimumTemperatureToExist)
|
||||
{
|
||||
location.HotspotExpose(temperature, mixture.Volume);
|
||||
|
||||
// TODO ATMOS Expose temperature all items on cell
|
||||
|
||||
location.TemperatureExpose(mixture, temperature, mixture.Volume);
|
||||
}
|
||||
}
|
||||
|
||||
return mixture.ReactionResults[GasReaction.Fire] != 0 ? ReactionResult.Reacting : ReactionResult.NoReaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user