Show volume on the gas analyzer (#25720)
The gas analyzer now shows the volume of pipes, tanks, canisters and the environment. Adjust gas analyzers so that the volume and number of moles shown corresponds to only the scanned element, e.g. a canister or single pipe in a pipenet.
This commit is contained in:
@@ -276,10 +276,17 @@ public sealed partial class CryoPodSystem : SharedCryoPodSystem
|
||||
if (!TryComp(entity, out CryoPodAirComponent? cryoPodAir))
|
||||
return;
|
||||
|
||||
args.GasMixtures ??= new Dictionary<string, GasMixture?> { { Name(entity.Owner), cryoPodAir.Air } };
|
||||
args.GasMixtures ??= new List<(string, GasMixture?)>();
|
||||
args.GasMixtures.Add((Name(entity.Owner), cryoPodAir.Air));
|
||||
// If it's connected to a port, include the port side
|
||||
if (_nodeContainer.TryGetNode(entity.Owner, entity.Comp.PortName, out PipeNode? port))
|
||||
args.GasMixtures.Add(entity.Comp.PortName, port.Air);
|
||||
// multiply by volume fraction to make sure to send only the gas inside the analyzed pipe element, not the whole pipe system
|
||||
if (_nodeContainer.TryGetNode(entity.Owner, entity.Comp.PortName, out PipeNode? port) && port.Air.Volume != 0f)
|
||||
{
|
||||
var portAirLocal = port.Air.Clone();
|
||||
portAirLocal.Multiply(port.Volume / port.Air.Volume);
|
||||
portAirLocal.Volume = port.Volume;
|
||||
args.GasMixtures.Add((entity.Comp.PortName, portAirLocal));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEjected(Entity<CryoPodComponent> cryoPod, ref EntRemovedFromContainerMessage args)
|
||||
|
||||
Reference in New Issue
Block a user