Add grinder bugfix from Micu

This commit is contained in:
Joachim Stolberg 2021-06-14 23:23:56 +02:00
parent 288472d20d
commit 60487a232f

View File

@ -99,7 +99,7 @@ local function src_to_dst(src_stack, idx, src_name, num_items, inp_num, inv, dst
end
local function grinding(pos, crd, nvm, inv)
local num_items = 0
local blocked = false -- idle
for idx,stack in ipairs(inv:get_list("src")) do
if not stack:is_empty() then
local name = stack:get_name()
@ -107,17 +107,22 @@ local function grinding(pos, crd, nvm, inv)
local recipe = Recipes[name]
if src_to_dst(stack, idx, name, crd.num_items, recipe.inp_num, inv, recipe.output) then
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
return
else
crd.State:blocked(pos, nvm)
blocked = true
end
else
crd.State:fault(pos, nvm)
end
return
end
end
end
if blocked then
crd.State:blocked(pos, nvm)
else
crd.State:idle(pos, nvm)
end
end
local function keep_running(pos, elapsed)
local nvm = techage.get_nvm(pos)