summaryrefslogtreecommitdiff
path: root/autocrafter.lua
diff options
context:
space:
mode:
authorTim <t4im@users.noreply.github.com>2015-01-28 19:41:38 +0100
committerTim <t4im@users.noreply.github.com>2015-01-28 19:41:38 +0100
commit0cb1eb49dc07749922c0c48158cfc675d3285c82 (patch)
tree5035a1a6d43f060dfa1505f3388d798502d522da /autocrafter.lua
parent7dca3393bef4cbdd505789dd68f6e78b58b43252 (diff)
downloadpipeworks-0cb1eb49dc07749922c0c48158cfc675d3285c82.tar
pipeworks-0cb1eb49dc07749922c0c48158cfc675d3285c82.tar.gz
pipeworks-0cb1eb49dc07749922c0c48158cfc675d3285c82.tar.bz2
pipeworks-0cb1eb49dc07749922c0c48158cfc675d3285c82.tar.xz
pipeworks-0cb1eb49dc07749922c0c48158cfc675d3285c82.zip
make sure the autocrafter runs after an upgrade
Diffstat (limited to 'autocrafter.lua')
-rw-r--r--autocrafter.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/autocrafter.lua b/autocrafter.lua
index 39291d7..6a257d4 100644
--- a/autocrafter.lua
+++ b/autocrafter.lua
@@ -170,17 +170,19 @@ local function update_autocrafter(pos, meta)
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)
meta:set_string("virtual_items", "")
- return
else -- we are version 1
for idx, stack in ipairs(inv:get_list("recipe")) do
- minetest.item_drop(stack, "", pos)
- stack:set_count(1)
- stack:set_wear(0)
- inv:set_stack("recipe", idx, stack)
+ if not stack:is_empty() then
+ minetest.item_drop(stack, "", pos)
+ stack:set_count(1)
+ stack:set_wear(0)
+ inv:set_stack("recipe", idx, stack)
+ end
end
end
-- update the recipe, cache, and start the crafter
+ autocrafterCache[minetest.hash_node_position(pos)] = nil
after_recipe_change(pos, inv)
end
end