Add cryopod logs (#16854)
This commit is contained in:
@@ -207,6 +207,20 @@ namespace Content.Server.Atmos
|
||||
Array.Resize(ref Moles, Atmospherics.AdjustedNumberOfGases);
|
||||
}
|
||||
|
||||
public GasMixtureStringRepresentation ToPrettyString()
|
||||
{
|
||||
var molesPerGas = new Dictionary<string, float>();
|
||||
for (int i = 0; i < Moles.Length; i++)
|
||||
{
|
||||
if (Moles[i] == 0)
|
||||
continue;
|
||||
|
||||
molesPerGas.Add(((Gas) i).ToString(), Moles[i]);
|
||||
}
|
||||
|
||||
return new GasMixtureStringRepresentation(TotalMoles, Temperature, Pressure, molesPerGas);
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is GasMixture mix)
|
||||
|
||||
18
Content.Server/Atmos/GasMixtureStringRepresentation.cs
Normal file
18
Content.Server/Atmos/GasMixtureStringRepresentation.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace Content.Server.Atmos;
|
||||
|
||||
public readonly record struct GasMixtureStringRepresentation(float TotalMoles, float Temperature, float Pressure, Dictionary<string, float> MolesPerGas) : IFormattable
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Temperature}K {Pressure} kPa";
|
||||
}
|
||||
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
return ToString();
|
||||
}
|
||||
|
||||
public static implicit operator string(GasMixtureStringRepresentation rep) => rep.ToString();
|
||||
}
|
||||
Reference in New Issue
Block a user