From: Zefram Date: Sun, 6 Jul 2014 22:35:12 +0000 (+0100) Subject: Don't spill an extra pick from old node breakers X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=6432bf721dd90018d651c3b6f1ae16c1a79d8fe6;p=zefram%2Fminetest%2Fpipeworks.git Don't spill an extra pick from old node breakers Due to historical shenanigans around the addition of the pick slot to node breakers, some breakers that were placed before the addition have ended up with a mese pick in their newly-acquired pick slot, rather than in the ghost_pick slot where it belongs. This causes these breakers to spill this ghost pick when they are broken. To avoid this, make pick spilling conditional on the breaker having a formspec: pre-slot breakers don't have one. --- diff --git a/node_breaker.lua b/node_breaker.lua index 03df35c..3267dc9 100644 --- a/node_breaker.lua +++ b/node_breaker.lua @@ -278,7 +278,7 @@ minetest.register_node("pipeworks:nodebreaker_off", { minetest.get_meta(pos):set_string("owner", placer:get_player_name()) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) - if oldmetadata.inventory.pick then + if oldmetadata.inventory.pick and oldmetadata.fields.formspec then local stack = oldmetadata.inventory.pick[1] if not stack:is_empty() then minetest.add_item(pos, stack) @@ -378,7 +378,7 @@ minetest.register_node("pipeworks:nodebreaker_on", { minetest.get_meta(pos):set_string("owner", placer:get_player_name()) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) - if oldmetadata.inventory.pick then + if oldmetadata.inventory.pick and oldmetadata.fields.formspec then local stack = oldmetadata.inventory.pick[1] if not stack:is_empty() then minetest.add_item(pos, stack)