Recyclers: spill without valid solutions (#44344)

* Recyclers: spill without valid solutions

* Early return on empty
This commit is contained in:
Whatstone 2026-07-23 00:52:53 +00:00 • committed by GitHub
parent cd6d356005
commit 2773e3f4fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -219,11 +219,15 @@ public sealed partial class MaterialReclaimerSystem : SharedMaterialReclaimerSys
TransformComponent? xform = null,
PhysicalCompositionComponent? composition = null)
{
if (!Resolve(reclaimer, ref reclaimerComponent, ref xform) || reclaimerComponent.SolutionContainerId == null)
if (!Resolve(reclaimer, ref reclaimerComponent, ref xform))
return;
efficiency *= reclaimerComponent.Efficiency;
// Solution will be empty, nothing to do.
if (efficiency <= 0)
return;
var totalChemicals = new Solution();
if (Resolve(item, ref composition, false))
@ -254,9 +258,13 @@ public sealed partial class MaterialReclaimerSystem : SharedMaterialReclaimerSys
}
}
if (!_solutionContainer.TryGetSolution(reclaimer, reclaimerComponent.SolutionContainerId, out var outputSolution) ||
!_solutionContainer.TryTransferSolution(outputSolution.Value, totalChemicals, totalChemicals.Volume) ||
totalChemicals.Volume > 0)
// Transfer or spill the solution if there's anything to move.
if (totalChemicals.Volume <= 0)
return;
if (reclaimerComponent.SolutionContainerId == null ||
!_solutionContainer.TryGetSolution(reclaimer, reclaimerComponent.SolutionContainerId, out var outputSolution) ||
!_solutionContainer.TryTransferSolution(outputSolution.Value, totalChemicals, totalChemicals.Volume))
{
_puddle.TrySpillAt(reclaimer, totalChemicals, out _, sound, transformComponent: xform);
}