Don't spill an extra pick from old node breakers
authorZefram <zefram@fysh.org>
Sun, 6 Jul 2014 22:35:12 +0000 (23:35 +0100)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Mon, 14 Jul 2014 18:55:27 +0000 (14:55 -0400)
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.

node_breaker.lua

index 03df35ce7b58b089fcf616cd116dfc498e3cd53b..3267dc957d677fa2af6f7d7c073d023f2d8c43d5 100644 (file)
@@ -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)