]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix solution corruption when grinding a stack of items (#24242)
authorTayrtahn <tayrtahn@gmail.com>
Thu, 18 Jan 2024 21:39:13 +0000 (16:39 -0500)
committerGitHub <noreply@github.com>
Thu, 18 Jan 2024 21:39:13 +0000 (16:39 -0500)
Fix corruption when grinding a stack of items

Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs

index acb6116e9ae9e7efbe0689768aab9f418e5a7e99..e309c3bd374926ffc0d4362dfc0e1a67aa5f351a 100644 (file)
@@ -103,7 +103,12 @@ namespace Content.Server.Kitchen.EntitySystems
                         if (fitsCount <= 0)
                             continue;
 
-                        solution.ScaleSolution(fitsCount);
+                        // Make a copy of the solution to scale
+                        // Otherwise we'll actually change the volume of the remaining stack too
+                        var scaledSolution = new Solution(solution);
+                        scaledSolution.ScaleSolution(fitsCount);
+                        solution = scaledSolution;
+
                         _stackSystem.SetCount(item, stack.Count - fitsCount); // Setting to 0 will QueueDel
                     }
                     else