From: Tayrtahn Date: Thu, 18 Jan 2024 21:39:13 +0000 (-0500) Subject: Fix solution corruption when grinding a stack of items (#24242) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=20dadf45ec92aecd244ae9e77d87c4531c6d1493;p=space-station-14.git Fix solution corruption when grinding a stack of items (#24242) Fix corruption when grinding a stack of items --- diff --git a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs index acb6116e9a..e309c3bd37 100644 --- a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs @@ -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