Bugfix in compacting-storage.lua

This commit is contained in:
Emerson Rosen-Jones 2025-09-14 14:13:57 -04:00
parent 562303e98f
commit ca8d0fea41

View file

@ -133,7 +133,7 @@ function should_fill (type, counts)
end end
if fill_src ~= nil and fill_dest ~= nil then break end if fill_src ~= nil and fill_dest ~= nil then break end
end end
local amount_to_use = do local amount_to_use = nil
local ratio = AMOUNT_USED / AMOUNT_RETURNED local ratio = AMOUNT_USED / AMOUNT_RETURNED
local amount_needed_src = nil local amount_needed_src = nil
if fill_src == "block" then if fill_src == "block" then
@ -142,10 +142,9 @@ function should_fill (type, counts)
amount_needed_src = amount_needed * ratio amount_needed_src = amount_needed * ratio
end end
if amount_needed_src < amount_spare then if amount_needed_src < amount_spare then
return amount_needed_src amount_to_use = amount_needed_src
else else
return amount_spare amount_to_use = amount_spare
end
end end
return fill_dest, fill_src, amount_to_use return fill_dest, fill_src, amount_to_use
end end