Change doc_items format, add award

master
Wuzzy 2016-11-02 23:34:36 +01:00
parent cc98185c3c
commit 417ed74be1
4 changed files with 40 additions and 29 deletions

View File

@ -1,5 +1,5 @@
intllib? intllib?
doc_items?
technic? technic?
default? default?
mana? mana?
awards?

View File

@ -85,8 +85,17 @@ function teletool.teleport(player, pointed_thing)
return true return true
end end
-- doc_items help texts
local base = S("Point teleporters are short-range teleportation devices which allow the user to teleport instantly towards a block they point at.")
local inf = S("Infinite point teleporters are very powerful, they can be used without limits.")
local baseuse = S("To use this tool, point to a face of a block and punch to teleport in front of it. The target location must have a minimum amount of space for you to stand in, otherwise, teleportation will fail.")
local desc_inf = base .. "\n" .. inf
local use_inf = baseuse
minetest.register_tool("teletool:teletool_infinite", { minetest.register_tool("teletool:teletool_infinite", {
description = S("Infinite point teleporter"), description = S("Infinite point teleporter"),
x_doc_items_longdesc = desc_inf,
x_doc_items_usagehelp = use_inf,
range = 20.0, range = 20.0,
tool_capabilities = {}, tool_capabilities = {},
wield_image = "teletool_teletool_infinite.png", wield_image = "teletool_teletool_infinite.png",
@ -110,8 +119,15 @@ minetest.register_tool("teletool:teletool_infinite", {
if(minetest.get_modpath("technic")) then if(minetest.get_modpath("technic")) then
technic.register_power_tool("teletool:teletool_technic", 50000) technic.register_power_tool("teletool:teletool_technic", 50000)
local technic = S("Electronic point teleporters run on electricity and must be charged initially. Fully charged, they can be used about 50 times.")
local technicuse = S("To recharge this tool, place it in a powered battery box.")
local desc_technic = base .. "\n" .. technic
local use_technic = technicuse .. " " .. baseuse
minetest.register_tool("teletool:teletool_technic", { minetest.register_tool("teletool:teletool_technic", {
description = S("Electronic point teleporter"), description = S("Electronic point teleporter"),
x_doc_items_longdesc = desc_technic,
x_doc_items_usagehelp = use_technic,
range = 20.0, range = 20.0,
tool_capabilities = {}, tool_capabilities = {},
wield_image = "teletool_teletool_technic.png", wield_image = "teletool_teletool_technic.png",
@ -149,8 +165,15 @@ if(minetest.get_modpath("technic")) then
end end
if(minetest.get_modpath("mana") ~= nil) then if(minetest.get_modpath("mana") ~= nil) then
local dmana = string.format(S("Magical point teleporters are fueled by mana and require %d mana per teleportation."), teletool.settings.cost_mana)
local manause = string.format(S("First make sure you have at least %d mana."), teletool.settings.cost_mana)
local desc_mana = base .. "\n" .. dmana
local use_mana = manause .. " " .. baseuse
minetest.register_tool("teletool:teletool_mana", { minetest.register_tool("teletool:teletool_mana", {
description = S("Magical point teleporter"), description = S("Magical point teleporter"),
x_doc_items_longdesc = desc_mana,
x_doc_items_usagehelp = use_mana,
range = 20.0, range = 20.0,
tool_capabilities = {}, tool_capabilities = {},
wield_image = "teletool_teletool_mana.png", wield_image = "teletool_teletool_mana.png",
@ -187,34 +210,18 @@ if(minetest.get_modpath("default") ~= nil and minetest.get_modpath("technic") ~=
{"technic:stainless_steel_ingot", "technic:battery", "technic:stainless_steel_ingot"} {"technic:stainless_steel_ingot", "technic:battery", "technic:stainless_steel_ingot"}
} }
}) })
end if(minetest.get_modpath("awards") ~= nil) then
awards.register_achievement("teletool_technic", {
if(minetest.get_modpath("doc_items") ~= nil) then title = S("What an awesome device!"),
local base = S("Point teleporters are short-range teleportation devices which allow the user to teleport instantly towards a block they point at.") description = S("Craft an electronic point teleporter."),
local inf = S("Infinite point teleporters are very powerful, they can be used without limits.") icon = "teletool_teletool_technic.png",
local mana = string.format(S("Magical point teleporters are fueled by mana and require %d mana per teleportation."), teletool.settings.cost_mana) trigger = {
local technic = S("Electronic point teleporters run on electricity and must be charged initially. Fully charged, they can be used about 50 times.") type = "craft",
local baseuse = S("To use this tool, point to a face of a block and punch to teleport in front of it. The target location must have a minimum amount of space for you to stand in, otherwise, teleportation will fail.") item = "teletool:teletool_technic",
local technicuse = S("To recharge this tool, place it in a powered battery box.") target = 1,
local manause = string.format(S("First make sure you have at least %d mana."), teletool.settings.cost_mana) },
})
local desc_inf = base .. "\n" .. inf end
local desc_mana = base .. "\n" .. mana
local desc_technic = base .. "\n" .. technic
local use_inf = baseuse
local use_mana = manause .. " " .. baseuse
local use_technic = technicuse .. " " .. baseuse
doc.sub.items.set_items_longdesc({
["teletool:teletool_infinite"] = desc_inf,
["teletool:teletool_mana"] = desc_mana,
["teletool:teletool_technic"] = desc_technic,
})
doc.sub.items.set_items_usagehelp({
["teletool:teletool_infinite"] = use_inf,
["teletool:teletool_mana"] = use_mana,
["teletool:teletool_technic"] = use_technic,
})
end end
minetest.register_alias("teletool:teletool", "teletool:teletool_infinite") minetest.register_alias("teletool:teletool", "teletool:teletool_infinite")

View File

@ -8,3 +8,5 @@ Electronic point teleporters run on electricity and must be charged initially. F
To use this tool, point to a face of a block and punch to teleport in front of it. The target location must have a minimum amount of space for you to stand in, otherwise, teleportation will fail. = Um dieses Werkzeug zu benutzen, zeigen Sie auf eine Seite eines Blockes, und schlagen Sie, um sich direkt davor zu teleportieren. Der Zielort muss genügend Platz haben, damit Sie darin stehen können, ansonsten wird die Teleportation fehlschlagen. To use this tool, point to a face of a block and punch to teleport in front of it. The target location must have a minimum amount of space for you to stand in, otherwise, teleportation will fail. = Um dieses Werkzeug zu benutzen, zeigen Sie auf eine Seite eines Blockes, und schlagen Sie, um sich direkt davor zu teleportieren. Der Zielort muss genügend Platz haben, damit Sie darin stehen können, ansonsten wird die Teleportation fehlschlagen.
To recharge this tool, place it in a powered battery box. = Um dieses Werkzeug wiederaufzuladen, platzieren Sie es in einer mit Strom versorgten Batteriebox. To recharge this tool, place it in a powered battery box. = Um dieses Werkzeug wiederaufzuladen, platzieren Sie es in einer mit Strom versorgten Batteriebox.
First make sure you have at least %d mana. = Stellen Sie zunächst sicher, dass Sie mindestens %d Mana haben. First make sure you have at least %d mana. = Stellen Sie zunächst sicher, dass Sie mindestens %d Mana haben.
What an awesome device! = Was für ein tolles Gerät!
Craft an electronic point teleporter. = Fertigen Sie einen elektronischen Zeigeteleporter.

View File

@ -8,3 +8,5 @@ Electronic point teleporters run on electricity and must be charged initially. F
To use this tool, point to a face of a block and punch to teleport in front of it. The target location must have a minimum amount of space for you to stand in, otherwise, teleportation will fail. To use this tool, point to a face of a block and punch to teleport in front of it. The target location must have a minimum amount of space for you to stand in, otherwise, teleportation will fail.
To recharge this tool, place it in a powered battery box. To recharge this tool, place it in a powered battery box.
First make sure you have at least %d mana. First make sure you have at least %d mana.
What an awesome device!
Craft an electronic point teleporter.