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

View File

@@ -165,14 +165,13 @@ namespace Content.Server.Atmos.Portable
/// </summary> /// </summary>
private void OnScrubberAnalyzed(EntityUid uid, PortableScrubberComponent component, GasAnalyzerScanEvent args) 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 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(component.PortName, port.Air);
} }
gasMixDict.Add(Name(uid), component.Air);
args.GasMixtures = gasMixDict; args.GasMixtures = gasMixDict;
} }
} }