]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Trigger on_rightclick regardless on the formspec meta field
authorSmallJoker <mk939@ymail.com>
Thu, 10 Aug 2017 07:41:56 +0000 (09:41 +0200)
committerparamat <mat.gregory@virginmedia.com>
Sun, 13 Aug 2017 20:37:30 +0000 (21:37 +0100)
Document behaviour for older clients.

doc/lua_api.txt
src/game.cpp

index b9dc1b47fc10afff1d48d5bdde02f3075b1aade1..b5ab30d58c7387972c1133a68bb788af270d78f2 100644 (file)
@@ -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
index e34a02693cb834525b2d422275397dd30613ab2f..4588e21e0cf992b4d62197636ff9dd5e56507471 100644 (file)
@@ -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;