Fixed target container overflow (Infinite beaker fill from mop) (#16804)

This commit is contained in:
Ilya Babunov
2023-05-25 13:12:08 +04:00
committed by GitHub
parent 56f33bbae4
commit daa47ff0d1
2 changed files with 13 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ public sealed class AbsorbentSystem : SharedAbsorbentSystem
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SolutionContainerSystem _solutionSystem = default!;
[Dependency] private readonly UseDelaySystem _useDelay = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
public override void Initialize()
{
@@ -158,11 +159,18 @@ public sealed class AbsorbentSystem : SharedAbsorbentSystem
return false;
}
absorberSoln.AddReagent(PuddleSystem.EvaporationReagent, water);
refillableSolution.AddSolution(nonWater, _prototype);
_solutionSystem.UpdateChemicals(used, absorberSoln);
_solutionSystem.UpdateChemicals(target, refillableSolution);
if (water > 0 && !_solutionContainerSystem.TryAddReagent(used, absorberSoln, PuddleSystem.EvaporationReagent, water,
out _))
{
_popups.PopupEntity(Loc.GetString("mopping-system-full", ("used", used)), used, user);
}
if (nonWater.Volume > 0 && !_solutionContainerSystem.TryAddSolution(target, refillableSolution, nonWater))
{
absorberSoln.AddSolution(nonWater, _prototype);
_popups.PopupEntity(Loc.GetString("mopping-system-full", ("used", target)), user, user);
}
_audio.PlayPvs(component.TransferSound, target);
_useDelay.BeginDelay(used);
return true;