Gas Analyzer can now scan pipes/devices along with the environment (#10976)

This commit is contained in:
theashtronaut
2022-09-08 14:22:14 +00:00
committed by GitHub
parent ae8fe43529
commit 868abaca5c
23 changed files with 826 additions and 758 deletions

View File

@@ -44,6 +44,7 @@ namespace Content.Server.Atmos.EntitySystems
SubscribeLocalEvent<GasTankComponent, EntParentChangedMessage>(OnParentChange);
SubscribeLocalEvent<GasTankComponent, GasTankSetPressureMessage>(OnGasTankSetPressure);
SubscribeLocalEvent<GasTankComponent, GasTankToggleInternalsMessage>(OnGasTankToggleInternals);
SubscribeLocalEvent<GasTankComponent, GasAnalyzerScanEvent>(OnAnalyzed);
}
private void OnGasShutdown(EntityUid uid, GasTankComponent component, ComponentShutdown args)
@@ -87,7 +88,7 @@ namespace Content.Server.Atmos.EntitySystems
{
// When an item is moved from hands -> pockets, the container removal briefly dumps the item on the floor.
// So this is a shitty fix, where the parent check is just delayed. But this really needs to get fixed
// properly at some point.
// properly at some point.
component.CheckUser = true;
}
@@ -323,5 +324,13 @@ namespace Content.Server.Atmos.EntitySystems
{
return GetInternalsComponent(component) != null;
}
/// <summary>
/// Returns the gas mixture for the gas analyzer
/// </summary>
private void OnAnalyzed(EntityUid uid, GasTankComponent component, GasAnalyzerScanEvent args)
{
args.GasMixtures = new Dictionary<string, GasMixture?> { {Name(uid), component.Air} };
}
}
}