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:
@@ -80,7 +80,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
var timeDelta = args.dt;
|
||||
var timeDelta = args.dt;
|
||||
var pressureDelta = timeDelta * vent.TargetPressureChange;
|
||||
|
||||
if (vent.PumpDirection == VentPumpDirection.Releasing && pipe.Air.Pressure > 0)
|
||||
@@ -292,7 +292,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
/// </summary>
|
||||
private void OnAnalyzed(EntityUid uid, GasVentPumpComponent component, GasAnalyzerScanEvent args)
|
||||
{
|
||||
var gasMixDict = new Dictionary<string, GasMixture?>();
|
||||
args.GasMixtures ??= new List<(string, GasMixture?)>();
|
||||
|
||||
// these are both called pipe, above it switches using this so I duplicated that...?
|
||||
var nodeName = component.PumpDirection switch
|
||||
@@ -301,10 +301,14 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
VentPumpDirection.Siphoning => component.Outlet,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
if (_nodeContainer.TryGetNode(uid, nodeName, out PipeNode? pipe))
|
||||
gasMixDict.Add(nodeName, pipe.Air);
|
||||
|
||||
args.GasMixtures = gasMixDict;
|
||||
// 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(uid, nodeName, out PipeNode? pipe) && pipe.Air.Volume != 0f)
|
||||
{
|
||||
var pipeAirLocal = pipe.Air.Clone();
|
||||
pipeAirLocal.Multiply(pipe.Volume / pipe.Air.Volume);
|
||||
pipeAirLocal.Volume = pipe.Volume;
|
||||
args.GasMixtures.Add((nodeName, pipeAirLocal));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnWeldChanged(EntityUid uid, GasVentPumpComponent component, ref WeldableChangedEvent args)
|
||||
|
||||
Reference in New Issue
Block a user