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.
This commit is contained in:
Zefram 2014-07-06 23:35:12 +01:00 committed by Vanessa Ezekowitz
parent ce1505d008
commit 6432bf721d

@ -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)