From: RealBadAngel Date: Tue, 12 Feb 2013 21:51:38 +0000 (+0100) Subject: Fix to on_rightclick not able to change wielded_item X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=b1019a88ba9c0822d60d3f4a74d745c69be8a79b;p=zefram%2Fminetest%2Fminetest_engine.git Fix to on_rightclick not able to change wielded_item --- diff --git a/builtin/item.lua b/builtin/item.lua index a28798d4..acbdaa53 100644 --- a/builtin/item.lua +++ b/builtin/item.lua @@ -237,8 +237,7 @@ function minetest.item_place(itemstack, placer, pointed_thing) local n = minetest.env:get_node(pointed_thing.under) local nn = n.name if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].on_rightclick then - minetest.registered_nodes[nn].on_rightclick(pointed_thing.under, n, placer) - return + return minetest.registered_nodes[nn].on_rightclick(pointed_thing.under, n, placer, itemstack) end end diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 7ba2ed00..af70a104 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1497,8 +1497,10 @@ Node definition (register_node) on_punch = func(pos, node, puncher), ^ default: minetest.node_punch ^ By default: does nothing - on_rightclick = func(pos, node, clicker), + on_rightclick = func(pos, node, clicker, itemstack), ^ default: nil + ^ if defined, itemstack will hold clicker's wielded item + Shall return the leftover itemstack on_dig = func(pos, node, digger), ^ default: minetest.node_dig ^ By default: checks privileges, wears out tool and removes node