diff options
author | SmallJoker <mk939@ymail.com> | 2017-08-10 09:41:56 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-06-03 17:31:59 +0200 |
commit | 037b01eac7d41de442149ba75a427f8b340b02dd (patch) | |
tree | 4d74e044341f0a82fcc475045d8f9ca0cdd360e4 | |
parent | c789c532bbda266cf2f3f27bac7d4ece9c5022bd (diff) | |
download | minetest-037b01eac7d41de442149ba75a427f8b340b02dd.tar.gz minetest-037b01eac7d41de442149ba75a427f8b340b02dd.tar.bz2 minetest-037b01eac7d41de442149ba75a427f8b340b02dd.zip |
Trigger on_rightclick regardless on the formspec meta field
Document behaviour for older clients.
-rw-r--r-- | doc/lua_api.txt | 6 | ||||
-rw-r--r-- | src/game.cpp | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index aefcba064..edef75593 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4261,9 +4261,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 8958826ad..68acc81b7 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3801,6 +3801,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; |