Gas Analyzer can now scan pipes/devices along with the environment (#10976)
This commit is contained in:
@@ -38,6 +38,7 @@ namespace Content.Server.Atmos.Portable
|
||||
SubscribeLocalEvent<PortableScrubberComponent, PowerChangedEvent>(OnPowerChanged);
|
||||
SubscribeLocalEvent<PortableScrubberComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<PortableScrubberComponent, DestructionEventArgs>(OnDestroyed);
|
||||
SubscribeLocalEvent<PortableScrubberComponent, GasAnalyzerScanEvent>(OnScrubberAnalyzed);
|
||||
}
|
||||
|
||||
private void OnDeviceUpdated(EntityUid uid, PortableScrubberComponent component, AtmosDeviceUpdateEvent args)
|
||||
@@ -158,5 +159,21 @@ namespace Content.Server.Atmos.Portable
|
||||
|
||||
appearance.SetData(PortableScrubberVisuals.IsDraining, isDraining);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the gas mixture for the gas analyzer
|
||||
/// </summary>
|
||||
private void OnScrubberAnalyzed(EntityUid uid, PortableScrubberComponent component, GasAnalyzerScanEvent args)
|
||||
{
|
||||
var gasMixDict = new Dictionary<string, GasMixture?>();
|
||||
// If it's connected to a port, include the port side
|
||||
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
|
||||
{
|
||||
if(nodeContainer != null && nodeContainer.TryGetNode(component.PortName, out PipeNode? port))
|
||||
gasMixDict.Add(component.PortName, port.Air);
|
||||
}
|
||||
gasMixDict.Add(Name(uid), component.Air);
|
||||
args.GasMixtures = gasMixDict;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user