From 26f2fc1b12763660a1feaebdc1fdff0b39f52083 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 24 Jul 2017 20:16:47 +0200 Subject: [PATCH] Update doc_identifier --- mods/HELP/doc/doc_identifier/README.md | 3 --- mods/HELP/doc/doc_identifier/init.lua | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/mods/HELP/doc/doc_identifier/README.md b/mods/HELP/doc/doc_identifier/README.md index 6338d1f0b..7620be7c5 100644 --- a/mods/HELP/doc/doc_identifier/README.md +++ b/mods/HELP/doc/doc_identifier/README.md @@ -25,8 +25,5 @@ and Item Help [`doc_items`] for getting the item documentation right. For the lookup tool to be able to work on custom objects/entities, you have to use the tiny API of this mod, see `API.md`. -## Credits -Everything created by Wuzzy. - ## License Everything in this mod is licensed under the MIT License. diff --git a/mods/HELP/doc/doc_identifier/init.lua b/mods/HELP/doc/doc_identifier/init.lua index 956c29d6a..b9675349e 100644 --- a/mods/HELP/doc/doc_identifier/init.lua +++ b/mods/HELP/doc/doc_identifier/init.lua @@ -135,10 +135,30 @@ doc_identifier.identify = function(itemstack, user, pointed_thing) end function doc_identifier.solid_mode(itemstack, user, pointed_thing) + -- Use pointed node's on_rightclick function first, if present + if pointed_thing.type == "node" then + local node = minetest.get_node(pointed_thing.under) + if user and not user:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack + end + end + end + return ItemStack("doc_identifier:identifier_solid") end function doc_identifier.liquid_mode(itemstack, user, pointed_thing) + -- Use pointed node's on_rightclick function first, if present + if pointed_thing.type == "node" then + local node = minetest.get_node(pointed_thing.under) + if user and not user:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack + end + end + end + return ItemStack("doc_identifier:identifier_liquid") end