From 5269e44b609f0f4ed10c19d0dfb6e84082f3826e Mon Sep 17 00:00:00 2001 From: bas <bas@bigdell> Date: Tue, 29 Oct 2013 17:51:39 +0100 Subject: [PATCH] bugfix init.lua:104: attempt to call method 'get_wielded_item' (a nil value) --- init.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 4ddf7f0..b4638c2 100644 --- a/init.lua +++ b/init.lua @@ -101,14 +101,13 @@ minetest.register_node("vines:side", { type = "wallmounted", }, after_dig_node = function(pos, oldnode, oldmetadata, user) - local wielded = user:get_wielded_item() + local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end if 'vines:shears' == wielded:get_name() then local inv = user:get_inventory() if inv then inv:add_item("main", ItemStack(oldnode.name)) end end - wielded:add_wear(65535/80) end }) @@ -147,14 +146,13 @@ minetest.register_node("vines:willow", { type = "wallmounted", }, after_dig_node = function(pos, oldnode, oldmetadata, user) - local wielded = user:get_wielded_item() + local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end if 'vines:shears' == wielded:get_name() then local inv = user:get_inventory() if inv then inv:add_item("main", ItemStack(oldnode.name)) end end - wielded:add_wear(65535/80) end }) @@ -210,14 +208,13 @@ minetest.register_node("vines:vine", { fixed = {-0.3, -1/2, -0.3, 0.3, 1/2, 0.3}, }, after_dig_node = function(pos, oldnode, oldmetadata, user) - local wielded = user:get_wielded_item() + local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end if 'vines:shears' == wielded:get_name() then local inv = user:get_inventory() if inv then inv:add_item("main", ItemStack(oldnode.name)) end end - wielded:add_wear(65535/80) end })