Use new doc_items data format

This commit is contained in:
Wuzzy 2016-11-02 22:53:34 +01:00
parent 0d0215fe22
commit 232d3ff473
2 changed files with 16 additions and 17 deletions

View File

@ -1,3 +1,4 @@
mana?
intllib?
doc?
doc_items?

View File

@ -60,8 +60,21 @@ returnmirror.set_position_active = function(itemstack, user, pointed_thing)
end
end
local longdesc, usagehelp
if minetest.get_modpath("doc_items") then
usagehelp = S("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 = S("This item allows to teleport the user back to a previously set location, at the cost of mana.")
usagehelp = usagehelp .. " " .. string.format(S("Setting the teleport location costs %d mana, teleporting costs %d mana."), returnmirror.cost_set, returnmirror.cost_teleport)
else
longdesc = S("This item allows to teleport its user back to a previously set location.")
end
end
minetest.register_tool("returnmirror:mirror_inactive", {
description = S("Mirror of Returning"),
x_doc_items_longdesc = longdesc,
x_doc_items_usagehelp = usagehelp,
inventory_image = "returnmirror_mirror_inactive.png",
wield_image = "returnmirror_mirror_inactive.png",
tool_capabilities = {},
@ -75,6 +88,7 @@ minetest.register_tool("returnmirror:mirror_inactive", {
minetest.register_tool("returnmirror:mirror_active", {
description = S("Mirror of Returning"),
x_doc_items_create_entry = false,
stack_max = 1,
inventory_image = "returnmirror_mirror_active.png",
wield_image = "returnmirror_mirror_active.png",
@ -130,22 +144,6 @@ 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 = S("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 = S("This item allows to teleport the user back to a previously set location, at the cost of mana.")
usagehelp = usagehelp .. " " .. string.format(S("Setting the teleport location costs %d mana, teleporting costs %d mana."), returnmirror.cost_set, returnmirror.cost_teleport)
else
longdesc = S("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
})
if minetest.get_modpath("doc") ~= nil then
doc.add_entry_alias("tools", "returnmirror:mirror_inactive", "returnmirror:mirror_active")
end