diff --git a/depends.txt b/depends.txt index 309189f..d2b2b14 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ mana? +doc_items? diff --git a/init.lua b/init.lua index bbbab0e..a7380bd 100644 --- a/init.lua +++ b/init.lua @@ -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