From cdd900cef65cda204c34a00d7309656e10bb2d09 Mon Sep 17 00:00:00 2001 From: beck-thompson <107373427+beck-thompson@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:08:41 -0700 Subject: [PATCH] Infinate chem dupe fixed (Toilet, drain) + dirty water toilet fix (#27446) innital commit --- .../Fluids/EntitySystems/DrainSystem.cs | 28 +++++++++++-------- .../Entities/Structures/Furniture/toilet.yml | 5 +++- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Content.Server/Fluids/EntitySystems/DrainSystem.cs b/Content.Server/Fluids/EntitySystems/DrainSystem.cs index b8fa04b872..5fc406dca5 100644 --- a/Content.Server/Fluids/EntitySystems/DrainSystem.cs +++ b/Content.Server/Fluids/EntitySystems/DrainSystem.cs @@ -87,19 +87,25 @@ public sealed class DrainSystem : SharedDrainSystem // Try to transfer as much solution as possible to the drain - var transferSolution = _solutionContainerSystem.SplitSolution(containerSoln.Value, - FixedPoint2.Min(containerSolution.Volume, drainSolution.AvailableVolume)); + var amountToPutInDrain = drainSolution.AvailableVolume; + var amountToSpillOnGround = containerSolution.Volume - drainSolution.AvailableVolume; - _solutionContainerSystem.TryAddSolution(drain.Solution.Value, transferSolution); - - _audioSystem.PlayPvs(drain.ManualDrainSound, target); - _ambientSoundSystem.SetAmbience(target, true); - - // If drain is full, spill - - if (drainSolution.MaxVolume == drainSolution.Volume) + if (amountToPutInDrain > 0) { - _puddleSystem.TrySpillAt(Transform(target).Coordinates, containerSolution, out _); + var solutionToPutInDrain = _solutionContainerSystem.SplitSolution(containerSoln.Value, amountToPutInDrain); + _solutionContainerSystem.TryAddSolution(drain.Solution.Value, solutionToPutInDrain); + + _audioSystem.PlayPvs(drain.ManualDrainSound, target); + _ambientSoundSystem.SetAmbience(target, true); + } + + + // Spill the remainder. + + if (amountToSpillOnGround > 0) + { + var solutionToSpill = _solutionContainerSystem.SplitSolution(containerSoln.Value, amountToSpillOnGround); + _puddleSystem.TrySpillAt(Transform(target).Coordinates, solutionToSpill, out _); _popupSystem.PopupEntity( Loc.GetString("drain-component-empty-verb-target-is-full-message", ("object", target)), container); diff --git a/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml b/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml index 0824d21ae0..2556b9ddfd 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml @@ -104,7 +104,10 @@ components: - type: SolutionContainerManager solutions: - toilet: + drainBuffer: + maxVol: 100 + tank: + maxVol: 500 reagents: - ReagentId: Water Quantity: 180