intllib support added (thanks Xanthin)

master
TenPlus1 2016-05-30 12:42:09 +01:00
parent 718adac01d
commit 7c8b2dde92
4 changed files with 62 additions and 14 deletions

View File

@ -1,2 +1,3 @@
default
vessels
vessels
intllib?

View File

@ -5,6 +5,27 @@
-- and step onto pad or walk into the blue portal light, portal closes after
-- 10 seconds, pad remains, potions are throwable... SFX are license Free...
-- Intllib
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s, a, ...)
if a == nil then
return s
end
a = {a, ...}
return s:gsub("(@?)@(%(?)(%d+)(%)?)",
function(e, o, n, c)
if e == "" then
return a[tonumber(n)] .. (o == "" and c or "")
else
return "@" .. o .. n .. c
end
end)
end
end
-- max teleport distance
local dist = tonumber(minetest.setting_get("map_generation_limit") or 31000)
@ -107,7 +128,7 @@ minetest.register_node("teleport_potion:potion", {
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
description="Teleport Potion (place and right-click to enchant location)",
description = S("Teleport Potion (place and right-click to enchant location)"),
inventory_image = "potion.png",
wield_image = "potion.png",
groups = {dig_immediate = 3},
@ -118,8 +139,8 @@ minetest.register_node("teleport_potion:potion", {
local meta = minetest.get_meta(pos)
-- text entry formspec
meta:set_string("formspec", "field[text;Enter teleport coords (e.g. 200,20,-200);${text}]")
meta:set_string("infotext", "Right-click to enchant teleport location")
meta:set_string("formspec", "field[text;" .. S("Enter teleport coords (e.g. 200,20,-200)") .. ";${text}]")
meta:set_string("infotext", S("Right-click to enchant teleport location"))
meta:set_string("text", pos.x .. "," .. pos.y .. "," .. pos.z)
-- set default coords
@ -166,16 +187,16 @@ minetest.register_node("teleport_potion:potion", {
})
else
minetest.chat_send_player(name, 'Potion failed!')
minetest.chat_send_player(name, S("Potion failed!"))
minetest.set_node(pos, {name = "air"})
minetest.add_item(pos, 'teleport_potion:potion')
minetest.add_item(pos, "teleport_potion:potion")
end
end,
})
-- teleport potion recipe
minetest.register_craft({
output = 'teleport_potion:potion',
output = "teleport_potion:potion",
recipe = {
{"", "default:diamond", ""},
{"default:diamond", "vessels:glass_bottle", "default:diamond"},
@ -192,7 +213,7 @@ minetest.register_node("teleport_potion:pad", {
legacy_wallmounted = true,
walkable = true,
sunlight_propagates = true,
description="Teleport Pad (place and right-click to enchant location)",
description = S("Teleport Pad (place and right-click to enchant location)"),
inventory_image = "padd.png",
wield_image = "padd.png",
light_source = 5,
@ -210,8 +231,8 @@ minetest.register_node("teleport_potion:pad", {
local meta = minetest.get_meta(pos)
-- text entry formspec
meta:set_string("formspec", "field[text;Enter teleport coords (e.g. 200,20,-200,Home);${text}]")
meta:set_string("infotext", "Right-click to enchant teleport location")
meta:set_string("formspec", "field[text;" .. S("Enter teleport coords (e.g. 200,20,-200,Home)") .. ";${text}]")
meta:set_string("infotext", S("Right-click to enchant teleport location"))
meta:set_string("text", pos.x .. "," .. pos.y .. "," .. pos.z)
-- set default coords
@ -243,10 +264,10 @@ minetest.register_node("teleport_potion:pad", {
if coords.desc and coords.desc ~= "" then
meta:set_string("infotext", "Teleport to " .. coords.desc)
meta:set_string("infotext", S("Teleport to @1", coords.desc))
else
meta:set_string("infotext", "Pad Active ("
.. coords.x .. "," .. coords.y .. "," .. coords.z .. ")")
meta:set_string("infotext", S("Pad Active (@1,@2,@3)",
coords.x, coords.y, coords.z))
end
minetest.sound_play("portal_open", {
@ -256,7 +277,7 @@ minetest.register_node("teleport_potion:pad", {
})
else
minetest.chat_send_player(name, 'Teleport Pad coordinates failed!')
minetest.chat_send_player(name, S("Teleport Pad coordinates failed!"))
end
end,
})

14
locale/de.txt Normal file
View File

@ -0,0 +1,14 @@
# German Translation for teleport_potion mod
# Deutsche Übersetzung der teleport_potion Mod
# last update: 2016/May/27
# Author: Xanthin
Teleport Potion (place and right-click to enchant location) = Teleportationstrank (platzieren und rechtsklicken,\num Standort zu verzaubern)
Enter teleport coords (e.g. 200,20,-200) = Koordinaten eingeben (z.B. 200,20,-200)
Right-click to enchant teleport location = Rechtsklick um Teleportationsort zu verzaubern
Potion failed! = Trank misslungen!
Teleport Pad (place and right-click to enchant location) = Teleportationsfeld (platzieren und rechtsklicken,\num Standort zu verzaubern)
Enter teleport coords (e.g. 200,20,-200,Home) = Koordinaten eingeben (z.B. 200,20,-200,Haus)
Teleport to @1 = Teleportiere nach @1
Pad Active (@1,@2,@3) = Feld aktiv (@1,@2,@3)
Teleport Pad coordinates failed! = Teleportationsfeldkoordinaten fehlgeschlagen!

12
locale/template.txt Normal file
View File

@ -0,0 +1,12 @@
# Template for translations of teleport_potion mod
# last update: 2016/May/27
Teleport Potion (place and right-click to enchant location) =
Enter teleport coords (e.g. 200,20,-200) =
Right-click to enchant teleport location =
Potion failed! =
Teleport Pad (place and right-click to enchant location) =
Enter teleport coords (e.g. 200,20,-200,Home) =
Teleport to @1 =
Pad Active (@1,@2,@3) =
Teleport Pad coordinates failed! =