make sure the autocrafter runs after an upgrade

This commit is contained in:
Tim 2015-01-28 19:41:38 +01:00
parent 7dca3393be
commit 0cb1eb49dc

View File

@ -170,17 +170,19 @@ local function update_autocrafter(pos, meta)
if meta:get_string("virtual_items") == "1" then -- we are version 2 if meta:get_string("virtual_items") == "1" then -- we are version 2
-- we allready dropped stuff, so lets remove the metadatasetting (we are not being called again for this node) -- we allready dropped stuff, so lets remove the metadatasetting (we are not being called again for this node)
meta:set_string("virtual_items", "") meta:set_string("virtual_items", "")
return
else -- we are version 1 else -- we are version 1
for idx, stack in ipairs(inv:get_list("recipe")) do for idx, stack in ipairs(inv:get_list("recipe")) do
if not stack:is_empty() then
minetest.item_drop(stack, "", pos) minetest.item_drop(stack, "", pos)
stack:set_count(1) stack:set_count(1)
stack:set_wear(0) stack:set_wear(0)
inv:set_stack("recipe", idx, stack) inv:set_stack("recipe", idx, stack)
end end
end end
end
-- update the recipe, cache, and start the crafter -- update the recipe, cache, and start the crafter
autocrafterCache[minetest.hash_node_position(pos)] = nil
after_recipe_change(pos, inv) after_recipe_change(pos, inv)
end end
end end