]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Infinate chem dupe fixed (Toilet, drain) + dirty water toilet fix (#27446)
authorbeck-thompson <107373427+beck-thompson@users.noreply.github.com>
Mon, 29 Apr 2024 03:08:41 +0000 (20:08 -0700)
committerGitHub <noreply@github.com>
Mon, 29 Apr 2024 03:08:41 +0000 (13:08 +1000)
innital commit

Content.Server/Fluids/EntitySystems/DrainSystem.cs
Resources/Prototypes/Entities/Structures/Furniture/toilet.yml

index b8fa04b872e052ba40accdead99a35f293411114..5fc406dca539e3fca7cbcc6f996ce8de15810e33 100644 (file)
@@ -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);
index 0824d21ae0d6e76c53b7b9cd8159ac95b36ebf25..2556b9ddfde31d57828a4e6d0ea05df9123ab16e 100644 (file)
   components:
   - type: SolutionContainerManager
     solutions:
-      toilet:
+      drainBuffer:
+        maxVol: 100
+      tank:
+        maxVol: 500
         reagents:
         - ReagentId: Water
           Quantity: 180