From 417ed74be1a5fb6159a45b997f5a72d60c36d0ad Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 2 Nov 2016 23:34:36 +0100 Subject: [PATCH] Change doc_items format, add award --- depends.txt | 2 +- init.lua | 63 +++++++++++++++++++++++++-------------------- locale/de.txt | 2 ++ locale/template.txt | 2 ++ 4 files changed, 40 insertions(+), 29 deletions(-) diff --git a/depends.txt b/depends.txt index 48b1dc8..d4df5fa 100644 --- a/depends.txt +++ b/depends.txt @@ -1,5 +1,5 @@ intllib? -doc_items? technic? default? mana? +awards? diff --git a/init.lua b/init.lua index 580226e..081e8d1 100644 --- a/init.lua +++ b/init.lua @@ -85,8 +85,17 @@ function teletool.teleport(player, pointed_thing) return true 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", { description = S("Infinite point teleporter"), + x_doc_items_longdesc = desc_inf, + x_doc_items_usagehelp = use_inf, range = 20.0, tool_capabilities = {}, wield_image = "teletool_teletool_infinite.png", @@ -110,8 +119,15 @@ minetest.register_tool("teletool:teletool_infinite", { if(minetest.get_modpath("technic")) then 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", { description = S("Electronic point teleporter"), + x_doc_items_longdesc = desc_technic, + x_doc_items_usagehelp = use_technic, range = 20.0, tool_capabilities = {}, wield_image = "teletool_teletool_technic.png", @@ -149,8 +165,15 @@ if(minetest.get_modpath("technic")) then end 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", { description = S("Magical point teleporter"), + x_doc_items_longdesc = desc_mana, + x_doc_items_usagehelp = use_mana, range = 20.0, tool_capabilities = {}, 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"} } }) -end - -if(minetest.get_modpath("doc_items") ~= nil) then - 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 mana = string.format(S("Magical point teleporters are fueled by mana and require %d mana per teleportation."), teletool.settings.cost_mana) - local technic = S("Electronic point teleporters run on electricity and must be charged initially. Fully charged, they can be used about 50 times.") - 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 technicuse = S("To recharge this tool, place it in a powered battery box.") - local manause = string.format(S("First make sure you have at least %d mana."), teletool.settings.cost_mana) - - local desc_inf = base .. "\n" .. inf - 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, - }) + if(minetest.get_modpath("awards") ~= nil) then + awards.register_achievement("teletool_technic", { + title = S("What an awesome device!"), + description = S("Craft an electronic point teleporter."), + icon = "teletool_teletool_technic.png", + trigger = { + type = "craft", + item = "teletool:teletool_technic", + target = 1, + }, + }) + end end minetest.register_alias("teletool:teletool", "teletool:teletool_infinite") diff --git a/locale/de.txt b/locale/de.txt index 6b75de6..87fe137 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -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 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. +What an awesome device! = Was für ein tolles Gerät! +Craft an electronic point teleporter. = Fertigen Sie einen elektronischen Zeigeteleporter. diff --git a/locale/template.txt b/locale/template.txt index d5f3d55..8952fd8 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -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 recharge this tool, place it in a powered battery box. First make sure you have at least %d mana. +What an awesome device! +Craft an electronic point teleporter.