Add item documentation

This commit is contained in:
Wuzzy 2016-08-08 05:11:36 +02:00
parent 2a772701f0
commit cfb8c262ab
2 changed files with 21 additions and 0 deletions

View File

@ -1 +1,2 @@
mana?
doc_items?

View File

@ -110,3 +110,23 @@ minetest.register_tool("returnmirror:mirror_active", {
})
minetest.register_alias("returnmirror:mirror_inactive", "returnmirror:returnmirror")
if minetest.get_modpath("doc_items") ~= nil then
local longdesc, usagehelp
usagehelp = "Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location."
if minetest.get_modpath("mana") ~= nil then
longdesc ="This item allows to teleport the user back to a previously set location, at the cost of mana."
usagehelp = usagehelp .. " " .. string.format("Setting the teleport location costs %d mana, teleporting costs %d mana.", returnmirror.cost_set, returnmirror.cost_teleport)
else
longdesc = "This item allows to teleport its user back to a previously set location."
end
doc.sub.items.set_items_longdesc({
["returnmirror:mirror_inactive"] = longdesc,
})
doc.sub.items.set_items_usagehelp({
["returnmirror:mirror_inactive"] = usagehelp
})
doc.add_entry_alias("tools", "returnmirror:mirror_inactive", "returnmirror:mirror_active")
end