mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Recyclers: spill without valid solutions (#44344)
* Recyclers: spill without valid solutions * Early return on empty
This commit is contained in:
parent
cd6d356005
commit
2773e3f4fb
1 changed files with 12 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue