Skip to content

Commit

Permalink
Fixed target container overflow (Infinite beaker fill from mop) (#16804)
Browse files Browse the repository at this point in the history
  • Loading branch information
McFck authored May 25, 2023
1 parent 56f33bb commit daa47ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .run/Content Server+Client.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<toRun name="Content.Server" type="DotNetProject" />
<method v="2" />
</configuration>
</component>
</component>
16 changes: 12 additions & 4 deletions Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -158,11 +159,18 @@ private bool TryTransferAbsorber(EntityUid user, EntityUid used, EntityUid targe
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;
Expand Down

0 comments on commit daa47ff

Please sign in to comment.