1
0
Fork 0

Update doc_identifier

This commit is contained in:
Wuzzy 2017-07-24 20:16:47 +02:00
parent dde6c678ad
commit 26f2fc1b12
2 changed files with 20 additions and 3 deletions

View File

@ -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 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`. use the tiny API of this mod, see `API.md`.
## Credits
Everything created by Wuzzy.
## License ## License
Everything in this mod is licensed under the MIT License. Everything in this mod is licensed under the MIT License.

View File

@ -135,10 +135,30 @@ doc_identifier.identify = function(itemstack, user, pointed_thing)
end end
function doc_identifier.solid_mode(itemstack, user, pointed_thing) 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") return ItemStack("doc_identifier:identifier_solid")
end end
function doc_identifier.liquid_mode(itemstack, user, pointed_thing) 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") return ItemStack("doc_identifier:identifier_liquid")
end end