Improve gas analyzer interface (#22779)

This commit is contained in:
qwerltaz
2023-12-20 18:56:57 +01:00
committed by GitHub
parent ef4afc5612
commit 289aab768f
4 changed files with 48 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
using System.Linq;
using Content.Server.Atmos;
using Content.Server.Atmos.Components;
using Content.Server.NodeContainer;
@@ -23,6 +24,11 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly UserInterfaceSystem _userInterface = default!;
[Dependency] private readonly TransformSystem _transform = default!;
/// <summary>
/// Minimum moles of a gas to be sent to the client.
/// </summary>
private const float UIMinMoles = 0.01f;
public override void Initialize()
{
base.Initialize();
@@ -254,7 +260,7 @@ namespace Content.Server.Atmos.EntitySystems
{
var gas = _atmo.GetGas(i);
if (mixture?.Moles[i] <= Atmospherics.GasMinMoles)
if (mixture?.Moles[i] <= UIMinMoles)
continue;
if (mixture != null)
@@ -264,7 +270,9 @@ namespace Content.Server.Atmos.EntitySystems
}
}
return gases.ToArray();
var gasesOrdered = gases.OrderByDescending(gas => gas.Amount);
return gasesOrdered.ToArray();
}
}
}