From 6432bf721dd90018d651c3b6f1ae16c1a79d8fe6 Mon Sep 17 00:00:00 2001 From: Zefram Date: Sun, 6 Jul 2014 23:35:12 +0100 Subject: [PATCH] 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. --- node_breaker.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) -- 2.30.2