From: SmallJoker Date: Thu, 10 Aug 2017 07:41:56 +0000 (+0200) Subject: Trigger on_rightclick regardless on the formspec meta field X-Git-Tag: 5.0.0~963 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4381fe0a0a0921e6ba79c072045be2dc04be646a;p=oweals%2Fminetest.git Trigger on_rightclick regardless on the formspec meta field Document behaviour for older clients. --- diff --git a/doc/lua_api.txt b/doc/lua_api.txt index b9dc1b47f..b5ab30d58 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4317,9 +4317,11 @@ Definition tables ^ By default: Calls minetest.register_on_punchnode callbacks ]] on_rightclick = func(pos, node, clicker, itemstack, pointed_thing), --[[ ^ default: nil - ^ if defined, itemstack will hold clicker's wielded item + ^ itemstack will hold clicker's wielded item ^ Shall return the leftover itemstack - ^ Note: pointed_thing can be nil, if a mod calls this function ]] + ^ Note: pointed_thing can be nil, if a mod calls this function + This function does not get triggered by clients <=0.4.16 if the + "formspec" node metadata field is set ]] on_dig = func(pos, node, digger), --[[ ^ default: minetest.node_dig diff --git a/src/game.cpp b/src/game.cpp index e34a02693..4588e21e0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3799,6 +3799,11 @@ void Game::handlePointingAtNode(const PointedThing &pointed, if (meta && meta->getString("formspec") != "" && !random_input && !isKeyDown(KeyType::SNEAK)) { + // Report right click to server + if (nodedef_manager->get(map.getNodeNoEx(nodepos)).rightclickable) { + client->interact(3, pointed); + } + infostream << "Launching custom inventory view" << std::endl; InventoryLocation inventoryloc;