fix: Show both port and internal gas when gas scanning a portable scrubber (#11495)

This commit is contained in:
Francesco 2022-09-24 19:46:27 +02:00 committed by GitHub
parent f656ceda99
commit 3fcc87687a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -165,14 +165,13 @@ namespace Content.Server.Atmos.Portable
/// </summary>
private void OnScrubberAnalyzed(EntityUid uid, PortableScrubberComponent component, GasAnalyzerScanEvent args)
{
var gasMixDict = new Dictionary<string, GasMixture?>();
var gasMixDict = new Dictionary<string, GasMixture?> { { Name(uid), component.Air } };
// If it's connected to a port, include the port side
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
if (TryComp(uid, out NodeContainerComponent? nodeContainer))
{
if(nodeContainer != null && nodeContainer.TryGetNode(component.PortName, out PipeNode? port))
if(nodeContainer.TryGetNode(component.PortName, out PipeNode? port))
gasMixDict.Add(component.PortName, port.Air);
}
gasMixDict.Add(Name(uid), component.Air);
args.GasMixtures = gasMixDict;
}
}