Auto-reveal hidden entries

This commit is contained in:
Wuzzy 2016-08-30 23:25:49 +02:00
parent a658892f6c
commit 4baef3d85f

View File

@ -64,7 +64,7 @@ doc_identifier.identify = function(itemstack, user, pointed_thing)
if(node.name == "ignore") then if(node.name == "ignore") then
show_message(username, "error_ignore") show_message(username, "error_ignore")
elseif doc.entry_exists("nodes", node.name) then elseif doc.entry_exists("nodes", node.name) then
doc.show_entry(username, "nodes", node.name) doc.show_entry(username, "nodes", node.name, true)
else else
show_message(username, "error_node") show_message(username, "error_node")
end end
@ -76,7 +76,7 @@ doc_identifier.identify = function(itemstack, user, pointed_thing)
local le = object:get_luaentity() local le = object:get_luaentity()
if object:is_player() then if object:is_player() then
if minetest.get_modpath("doc_basics") ~= nil and doc.entry_exists("basics", "players") then if minetest.get_modpath("doc_basics") ~= nil and doc.entry_exists("basics", "players") then
doc.show_entry(username, "basics", "players") doc.show_entry(username, "basics", "players", true)
else else
-- Fallback message -- Fallback message
show_message(username, "player") show_message(username, "player")
@ -88,11 +88,11 @@ doc_identifier.identify = function(itemstack, user, pointed_thing)
if le.name == "__builtin:item" then if le.name == "__builtin:item" then
local itemstring = ItemStack(minetest.deserialize(le:get_staticdata()).itemstring):get_name() local itemstring = ItemStack(minetest.deserialize(le:get_staticdata()).itemstring):get_name()
if doc.entry_exists("nodes", itemstring) then if doc.entry_exists("nodes", itemstring) then
doc.show_entry(username, "nodes", itemstring) doc.show_entry(username, "nodes", itemstring, true)
elseif doc.entry_exists("tools", itemstring) then elseif doc.entry_exists("tools", itemstring) then
doc.show_entry(username, "tools", itemstring) doc.show_entry(username, "tools", itemstring, true)
elseif doc.entry_exists("craftitems", itemstring) then elseif doc.entry_exists("craftitems", itemstring) then
doc.show_entry(username, "craftitems", itemstring) doc.show_entry(username, "craftitems", itemstring, true)
elseif minetest.registered_items[itemstring] == nil or itemstring == "unknown" then elseif minetest.registered_items[itemstring] == nil or itemstring == "unknown" then
show_message(username, "error_unknown", itemstring) show_message(username, "error_unknown", itemstring)
else else
@ -102,11 +102,11 @@ doc_identifier.identify = function(itemstack, user, pointed_thing)
elseif le.name == "__builtin:falling_node" then elseif le.name == "__builtin:falling_node" then
local itemstring = minetest.deserialize(le:get_staticdata()).name local itemstring = minetest.deserialize(le:get_staticdata()).name
if doc.entry_exists("nodes", itemstring) then if doc.entry_exists("nodes", itemstring) then
doc.show_entry(username, "nodes", itemstring) doc.show_entry(username, "nodes", itemstring, true)
end end
-- A known registered object -- A known registered object
elseif ro ~= nil then elseif ro ~= nil then
doc.show_entry(username, ro.category, ro.entry) doc.show_entry(username, ro.category, ro.entry, true)
-- Undefined object (error) -- Undefined object (error)
elseif minetest.registered_entities[le.name] == nil then elseif minetest.registered_entities[le.name] == nil then
show_message(username, "error_unknown", le.name) show_message(username, "error_unknown", le.name)