mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +03:00
25 lines
798 B
C#
25 lines
798 B
C#
using System.Text;
|
|
|
|
namespace Content.Shared.Atmos;
|
|
|
|
public readonly record struct GasMixtureStringRepresentation(float TotalMoles, float Temperature, float Pressure, Dictionary<string, float> MolesPerGas) : IFormattable
|
|
{
|
|
public override string ToString()
|
|
{
|
|
var stringBuilder = new StringBuilder();
|
|
foreach (var (gas, moles) in MolesPerGas)
|
|
{
|
|
stringBuilder.Append($"{gas}: {moles}, ");
|
|
}
|
|
var result = stringBuilder.ToString();
|
|
|
|
return $"{Temperature} K, {Pressure} kPa, {result}Total Moles: {TotalMoles}";
|
|
}
|
|
|
|
public string ToString(string? format, IFormatProvider? formatProvider)
|
|
{
|
|
return ToString();
|
|
}
|
|
|
|
public static implicit operator string(GasMixtureStringRepresentation rep) => rep.ToString();
|
|
}
|