Add clientside translations, more expensive crafts

This commit is contained in:
SmallJoker 2018-08-03 11:04:50 +02:00
parent f957841e0a
commit 19f26db01f
7 changed files with 47 additions and 24 deletions

@ -1,12 +1,15 @@
local S = upgrade_packs.translator
minetest.register_chatcommand("upgrade_packs", {
description = "Allows inserting upgrade packs without CSM",
description = S("Allows using upgrade packs without CSM"),
func = function(name, param)
minetest.show_formspec(name, "upgrade_packs:gui_plain",
"size[8,7]" ..
"label[3,0;Upgrade Packs]" ..
"list[current_player;ugpacks;2,1;4,1;]" ..
"list[current_player;main;0,3;8,4;]" ..
"listring[]"
minetest.show_formspec(name, "upgrade_packs:gui_plain", ([[
size[8,7]
label[3,0;%s]
list[current_player;ugpacks;2,1;4,1;]
list[current_player;main;0,3;8,4;]
listring[]
]]):format(S("Upgrade Packs"))
)
end
})

@ -1,12 +1,14 @@
local S = upgrade_packs.translator
sfinv.register_page("upgrade_packs:ugpacks", {
title = "Upgrade Packs",
title = S("Upgrade Packs"),
get = function(self, player, context)
local name = player:get_player_name()
return sfinv.make_formspec(player, context,
"label[3,0.7;Upgrade Packs]" ..
"list[current_player;ugpacks;3,1.5;2,2;]" ..
"listring[current_player;main]" ..
"listring[current_player;ugpacks]"
, true)
return sfinv.make_formspec(player, context, ([[
label[3,0.7;%s]
list[current_player;ugpacks;3,1.5;2,2;]
listring[current_player;main]"
listring[current_player;ugpacks]
]]):format(S("Upgrade Packs")), true)
end
})

@ -1,7 +1,9 @@
local S = upgrade_packs.translator
unified_inventory.register_button("ugpacks", {
type = "image",
image = "heart.png",
tooltip = "Upgrade Packs"
tooltip = S("Upgrade Packs")
})
unified_inventory.register_page("ugpacks", {
@ -11,7 +13,7 @@ unified_inventory.register_page("ugpacks", {
return { formspec = (
"no_prepend[]" ..
"listcolors[#888;#AAA;#111]" ..
"label[3," .. (y - 0.1) .. ";Upgrade Packs]" ..
"label[3," .. (y - 0.1) .. ";" .. S("Upgrade Packs") .. "]" ..
"list[current_player;ugpacks;3," .. (y + 0.7) .. ";2,2;]" ..
"list[current_player;main;0," .. (y + 3.5) .. ";8,4;]" ..
"listring[]"

@ -5,6 +5,7 @@ end
upgrade_packs = {}
upgrade_packs.health_items = {}
upgrade_packs.breath_items = {}
upgrade_packs.translator = minetest.get_translator("upgrade_packs")
local modpath = minetest.get_modpath("upgrade_packs")

6
locale/template.txt Normal file

@ -0,0 +1,6 @@
# textdomain: upgrade_packs
+10 HP =
+5 Breath =
Allows inserting upgrade packs without CSM =
Upgrade Packs =

@ -0,0 +1,6 @@
# textdomain: upgrade_packs
+10 HP=+10 Lebenspunkte
+5 Breath=+5 Atem
Allows using upgrade packs without CSM=Ermöglicht die Nutzung von Upgrade-Paketen ohne CSM
Upgrade Packs=Upgrade-Pakete

@ -1,22 +1,25 @@
local S = upgrade_packs.translator
upgrade_packs.register_pack("upgrade_packs:hp_10", "health", {
description = "+10 HP",
description = S("+10 HP"),
strength = 10,
image = "heart.png"
})
local mc = "default:mese_crystal"
local gb = "vessels:glass_bottle"
local ci = "default:copper_ingot"
minetest.register_craft({
output = "upgrade_packs:hp_10",
recipe = {
{ci, gb, ci},
{gb, "", gb},
{ci, gb, ci}
{ci, mc, ci},
{mc, gb, mc},
{ci, mc, ci}
}
})
upgrade_packs.register_pack("upgrade_packs:breath_5", "breath", {
description = "+5 Breath",
description = S("+5 Breath"),
strength = 5,
image = "bubble.png"
})
@ -26,9 +29,9 @@ local ti = "default:tin_ingot"
minetest.register_craft({
output = "upgrade_packs:breath_5",
recipe = {
{ti, sb, ti},
{sb, "", sb},
{ti, sb, ti}
{ti, mc, ti},
{mc, sb, mc},
{ti, mc, ti}
}
})