Add cryopod logs (#16854)

This commit is contained in:
Chief-Engineer
2023-05-28 03:59:27 -05:00
committed by GitHub
parent 6c7db6dbc3
commit 707b9063f9
5 changed files with 97 additions and 12 deletions

View File

@@ -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)

View 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();
}