Gas tanks and masks (#2409)
Co-authored-by: a.rudenko <creadth@gmail.com> Co-authored-by: creadth <creadth@users.noreply.github.com> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
329926b175
commit
870d052354
@@ -65,6 +65,38 @@ namespace Content.Server.Atmos
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Heat capacity ratio of gas mixture
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public float HeatCapacityRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
var delimiterSum = 0f;
|
||||
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
|
||||
{
|
||||
delimiterSum += _moles[i] / (_atmosphereSystem.GetGas(i).HeatCapacityRatio - 1);
|
||||
}
|
||||
return 1 + TotalMoles / delimiterSum;
|
||||
}
|
||||
}
|
||||
|
||||
public float MolarMass
|
||||
{
|
||||
get
|
||||
{
|
||||
var molarMass = 0f;
|
||||
var totalMoles = TotalMoles;
|
||||
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
|
||||
{
|
||||
molarMass += _atmosphereSystem.GetGas(i).MolarMass * (_moles[i] / totalMoles);
|
||||
}
|
||||
|
||||
return molarMass;
|
||||
}
|
||||
}
|
||||
|
||||
[ViewVariables]
|
||||
public float HeatCapacityArchived
|
||||
{
|
||||
@@ -136,14 +168,15 @@ namespace Content.Server.Atmos
|
||||
public GasMixture(AtmosphereSystem? atmosphereSystem)
|
||||
{
|
||||
_atmosphereSystem = atmosphereSystem ?? EntitySystem.Get<AtmosphereSystem>();
|
||||
_moles = new float[_atmosphereSystem.Gases.Count()];
|
||||
_molesArchived = new float[_moles.Length];
|
||||
}
|
||||
|
||||
public GasMixture(float volume, AtmosphereSystem? atmosphereSystem = null)
|
||||
public GasMixture(float volume, AtmosphereSystem? atmosphereSystem = null): this(atmosphereSystem)
|
||||
{
|
||||
if (volume < 0)
|
||||
volume = 0;
|
||||
Volume = volume;
|
||||
_atmosphereSystem = atmosphereSystem ?? EntitySystem.Get<AtmosphereSystem>();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
Reference in New Issue
Block a user