From: beck-thompson <107373427+beck-thompson@users.noreply.github.com> Date: Mon, 29 Apr 2024 03:08:41 +0000 (-0700) Subject: Infinate chem dupe fixed (Toilet, drain) + dirty water toilet fix (#27446) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=cdd900cef65cda204c34a00d7309656e10bb2d09;p=space-station-14.git Infinate chem dupe fixed (Toilet, drain) + dirty water toilet fix (#27446) innital commit --- 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); + if (amountToPutInDrain > 0) + { + var solutionToPutInDrain = _solutionContainerSystem.SplitSolution(containerSoln.Value, amountToPutInDrain); + _solutionContainerSystem.TryAddSolution(drain.Solution.Value, solutionToPutInDrain); + + _audioSystem.PlayPvs(drain.ManualDrainSound, target); + _ambientSoundSystem.SetAmbience(target, true); + } - _audioSystem.PlayPvs(drain.ManualDrainSound, target); - _ambientSoundSystem.SetAmbience(target, true); - // If drain is full, spill + // Spill the remainder. - if (drainSolution.MaxVolume == drainSolution.Volume) + if (amountToSpillOnGround > 0) { - _puddleSystem.TrySpillAt(Transform(target).Coordinates, containerSolution, out _); + 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