Add support for intllib

This commit is contained in:
stujones11 2017-03-31 19:54:12 +01:00
parent 7fde7c050d
commit 23e4d5114f
8 changed files with 105 additions and 76 deletions

@ -12,8 +12,6 @@ armor = {
default.gui_bg_img.. default.gui_bg_img..
default.gui_slots.. default.gui_slots..
default.get_hotbar_bg(0, 4.7).. default.get_hotbar_bg(0, 4.7)..
"label[5,1;Level: armor_level]"..
"label[5,1.5;Heal: armor_attr_heal]"..
"list[current_player;main;0,4.7;8,1;]".. "list[current_player;main;0,4.7;8,1;]"..
"list[current_player;main;0,5.85;8,3;8]", "list[current_player;main;0,5.85;8,3;8]",
def = {}, def = {},

@ -1,10 +1,15 @@
local S = function(s) return s end
if minetest.global_exists("intllib") then
S = intllib.Getter()
end
minetest.register_alias("adminboots","3d_armor:boots_admin") minetest.register_alias("adminboots","3d_armor:boots_admin")
minetest.register_alias("adminhelmet","3d_armor:helmet_admin") minetest.register_alias("adminhelmet","3d_armor:helmet_admin")
minetest.register_alias("adminchestplate","3d_armor:chestplate_admin") minetest.register_alias("adminchestplate","3d_armor:chestplate_admin")
minetest.register_alias("adminleggings","3d_armor:leggings_admin") minetest.register_alias("adminleggings","3d_armor:leggings_admin")
armor:register_armor("3d_armor:helmet_admin", { armor:register_armor("3d_armor:helmet_admin", {
description = "Admin Helmet", description = S("Admin Helmet"),
inventory_image = "3d_armor_inv_helmet_admin.png", inventory_image = "3d_armor_inv_helmet_admin.png",
armor_groups = {fleshy=100}, armor_groups = {fleshy=100},
groups = {armor_head=1, armor_heal=100, armor_use=0, armor_water=1, groups = {armor_head=1, armor_heal=100, armor_use=0, armor_water=1,
@ -15,7 +20,7 @@ armor:register_armor("3d_armor:helmet_admin", {
}) })
armor:register_armor("3d_armor:chestplate_admin", { armor:register_armor("3d_armor:chestplate_admin", {
description = "Admin Chestplate", description = S("Admin Chestplate"),
inventory_image = "3d_armor_inv_chestplate_admin.png", inventory_image = "3d_armor_inv_chestplate_admin.png",
armor_groups = {fleshy=100}, armor_groups = {fleshy=100},
groups = {armor_torso=1, armor_heal=100, armor_use=0, groups = {armor_torso=1, armor_heal=100, armor_use=0,
@ -26,7 +31,7 @@ armor:register_armor("3d_armor:chestplate_admin", {
}) })
armor:register_armor("3d_armor:leggings_admin", { armor:register_armor("3d_armor:leggings_admin", {
description = "Admin Leggings", description = S("Admin Leggings"),
inventory_image = "3d_armor_inv_leggings_admin.png", inventory_image = "3d_armor_inv_leggings_admin.png",
armor_groups = {fleshy=100}, armor_groups = {fleshy=100},
groups = {armor_legs=1, armor_heal=100, armor_use=0, groups = {armor_legs=1, armor_heal=100, armor_use=0,
@ -37,7 +42,7 @@ armor:register_armor("3d_armor:leggings_admin", {
}) })
armor:register_armor("3d_armor:boots_admin", { armor:register_armor("3d_armor:boots_admin", {
description = "Admin Boots", description = S("Admin Boots"),
inventory_image = "3d_armor_inv_boots_admin.png", inventory_image = "3d_armor_inv_boots_admin.png",
armor_groups = {fleshy=100}, armor_groups = {fleshy=100},
groups = {armor_feet=1, armor_heal=100, armor_use=0, groups = {armor_feet=1, armor_heal=100, armor_use=0,
@ -49,25 +54,25 @@ armor:register_armor("3d_armor:boots_admin", {
if armor.materials.wood then if armor.materials.wood then
armor:register_armor("3d_armor:helmet_wood", { armor:register_armor("3d_armor:helmet_wood", {
description = "Wood Helmet", description = S("Wood Helmet"),
inventory_image = "3d_armor_inv_helmet_wood.png", inventory_image = "3d_armor_inv_helmet_wood.png",
armor_groups = {fleshy=5}, armor_groups = {fleshy=5},
groups = {armor_head=1, armor_heal=0, armor_use=2000}, groups = {armor_head=1, armor_heal=0, armor_use=2000},
}) })
armor:register_armor("3d_armor:chestplate_wood", { armor:register_armor("3d_armor:chestplate_wood", {
description = "Wood Chestplate", description = S("Wood Chestplate"),
inventory_image = "3d_armor_inv_chestplate_wood.png", inventory_image = "3d_armor_inv_chestplate_wood.png",
armor_groups = {fleshy=10}, armor_groups = {fleshy=10},
groups = {armor_torso=1, armor_heal=0, armor_use=2000}, groups = {armor_torso=1, armor_heal=0, armor_use=2000},
}) })
armor:register_armor("3d_armor:leggings_wood", { armor:register_armor("3d_armor:leggings_wood", {
description = "Wood Leggings", description = S("Wood Leggings"),
inventory_image = "3d_armor_inv_leggings_wood.png", inventory_image = "3d_armor_inv_leggings_wood.png",
armor_groups = {fleshy=5}, armor_groups = {fleshy=5},
groups = {armor_legs=1, armor_heal=0, armor_use=2000}, groups = {armor_legs=1, armor_heal=0, armor_use=2000},
}) })
armor:register_armor("3d_armor:boots_wood", { armor:register_armor("3d_armor:boots_wood", {
description = "Wood Boots", description = S("Wood Boots"),
inventory_image = "3d_armor_inv_boots_wood.png", inventory_image = "3d_armor_inv_boots_wood.png",
armor_groups = {fleshy=5}, armor_groups = {fleshy=5},
groups = {armor_feet=1, armor_heal=0, armor_use=2000}, groups = {armor_feet=1, armor_heal=0, armor_use=2000},
@ -76,25 +81,25 @@ end
if armor.materials.cactus then if armor.materials.cactus then
armor:register_armor("3d_armor:helmet_cactus", { armor:register_armor("3d_armor:helmet_cactus", {
description = "Cactus Helmet", description = S("Cactus Helmet"),
inventory_image = "3d_armor_inv_helmet_cactus.png", inventory_image = "3d_armor_inv_helmet_cactus.png",
armor_groups = {fleshy=5}, armor_groups = {fleshy=5},
groups = {armor_head=1, armor_heal=0, armor_use=1000}, groups = {armor_head=1, armor_heal=0, armor_use=1000},
}) })
armor:register_armor("3d_armor:chestplate_cactus", { armor:register_armor("3d_armor:chestplate_cactus", {
description = "Cactus Chestplate", description = S("Cactus Chestplate"),
inventory_image = "3d_armor_inv_chestplate_cactus.png", inventory_image = "3d_armor_inv_chestplate_cactus.png",
armor_groups = {fleshy=10}, armor_groups = {fleshy=10},
groups = {armor_torso=1, armor_heal=0, armor_use=1000}, groups = {armor_torso=1, armor_heal=0, armor_use=1000},
}) })
armor:register_armor("3d_armor:leggings_cactus", { armor:register_armor("3d_armor:leggings_cactus", {
description = "Cactus Leggings", description = S("Cactus Leggings"),
inventory_image = "3d_armor_inv_leggings_cactus.png", inventory_image = "3d_armor_inv_leggings_cactus.png",
armor_groups = {fleshy=5}, armor_groups = {fleshy=5},
groups = {armor_legs=1, armor_heal=0, armor_use=1000}, groups = {armor_legs=1, armor_heal=0, armor_use=1000},
}) })
armor:register_armor("3d_armor:boots_cactus", { armor:register_armor("3d_armor:boots_cactus", {
description = "Cactus Boots", description = S("Cactus Boots"),
inventory_image = "3d_armor_inv_boots_cactus.png", inventory_image = "3d_armor_inv_boots_cactus.png",
armor_groups = {fleshy=5}, armor_groups = {fleshy=5},
groups = {armor_feet=1, armor_heal=0, armor_use=1000}, groups = {armor_feet=1, armor_heal=0, armor_use=1000},
@ -103,25 +108,25 @@ end
if armor.materials.steel then if armor.materials.steel then
armor:register_armor("3d_armor:helmet_steel", { armor:register_armor("3d_armor:helmet_steel", {
description = "Steel Helmet", description = S("Steel Helmet"),
inventory_image = "3d_armor_inv_helmet_steel.png", inventory_image = "3d_armor_inv_helmet_steel.png",
armor_groups = {fleshy=10}, armor_groups = {fleshy=10},
groups = {armor_head=1, armor_heal=0, armor_use=500}, groups = {armor_head=1, armor_heal=0, armor_use=500},
}) })
armor:register_armor("3d_armor:chestplate_steel", { armor:register_armor("3d_armor:chestplate_steel", {
description = "Steel Chestplate", description = S("Steel Chestplate"),
inventory_image = "3d_armor_inv_chestplate_steel.png", inventory_image = "3d_armor_inv_chestplate_steel.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_torso=1, armor_heal=0, armor_use=500}, groups = {armor_torso=1, armor_heal=0, armor_use=500},
}) })
armor:register_armor("3d_armor:leggings_steel", { armor:register_armor("3d_armor:leggings_steel", {
description = "Steel Leggings", description = S("Steel Leggings"),
inventory_image = "3d_armor_inv_leggings_steel.png", inventory_image = "3d_armor_inv_leggings_steel.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_legs=1, armor_heal=0, armor_use=500}, groups = {armor_legs=1, armor_heal=0, armor_use=500},
}) })
armor:register_armor("3d_armor:boots_steel", { armor:register_armor("3d_armor:boots_steel", {
description = "Steel Boots", description = S("Steel Boots"),
inventory_image = "3d_armor_inv_boots_steel.png", inventory_image = "3d_armor_inv_boots_steel.png",
armor_groups = {fleshy=10}, armor_groups = {fleshy=10},
groups = {armor_feet=1, armor_heal=0, armor_use=500}, groups = {armor_feet=1, armor_heal=0, armor_use=500},
@ -130,25 +135,25 @@ end
if armor.materials.bronze then if armor.materials.bronze then
armor:register_armor("3d_armor:helmet_bronze", { armor:register_armor("3d_armor:helmet_bronze", {
description = "Bronze Helmet", description = S("Bronze Helmet"),
inventory_image = "3d_armor_inv_helmet_bronze.png", inventory_image = "3d_armor_inv_helmet_bronze.png",
armor_groups = {fleshy=10}, armor_groups = {fleshy=10},
groups = {armor_head=1, armor_heal=6, armor_use=250}, groups = {armor_head=1, armor_heal=6, armor_use=250},
}) })
armor:register_armor("3d_armor:chestplate_bronze", { armor:register_armor("3d_armor:chestplate_bronze", {
description = "Bronze Chestplate", description = S("Bronze Chestplate"),
inventory_image = "3d_armor_inv_chestplate_bronze.png", inventory_image = "3d_armor_inv_chestplate_bronze.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_torso=1, armor_heal=6, armor_use=250}, groups = {armor_torso=1, armor_heal=6, armor_use=250},
}) })
armor:register_armor("3d_armor:leggings_bronze", { armor:register_armor("3d_armor:leggings_bronze", {
description = "Bronze Leggings", description = S("Bronze Leggings"),
inventory_image = "3d_armor_inv_leggings_bronze.png", inventory_image = "3d_armor_inv_leggings_bronze.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_legs=1, armor_heal=6, armor_use=250}, groups = {armor_legs=1, armor_heal=6, armor_use=250},
}) })
armor:register_armor("3d_armor:boots_bronze", { armor:register_armor("3d_armor:boots_bronze", {
description = "Bronze Boots", description = S("Bronze Boots"),
inventory_image = "3d_armor_inv_boots_bronze.png", inventory_image = "3d_armor_inv_boots_bronze.png",
armor_groups = {fleshy=10}, armor_groups = {fleshy=10},
groups = {armor_feet=1, armor_heal=6, armor_use=250}, groups = {armor_feet=1, armor_heal=6, armor_use=250},
@ -157,25 +162,25 @@ end
if armor.materials.diamond then if armor.materials.diamond then
armor:register_armor("3d_armor:helmet_diamond", { armor:register_armor("3d_armor:helmet_diamond", {
description = "Diamond Helmet", description = S("Diamond Helmet"),
inventory_image = "3d_armor_inv_helmet_diamond.png", inventory_image = "3d_armor_inv_helmet_diamond.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_head=1, armor_heal=12, armor_use=100}, groups = {armor_head=1, armor_heal=12, armor_use=100},
}) })
armor:register_armor("3d_armor:chestplate_diamond", { armor:register_armor("3d_armor:chestplate_diamond", {
description = "Diamond Chestplate", description = S("Diamond Chestplate"),
inventory_image = "3d_armor_inv_chestplate_diamond.png", inventory_image = "3d_armor_inv_chestplate_diamond.png",
armor_groups = {fleshy=20}, armor_groups = {fleshy=20},
groups = {armor_torso=1, armor_heal=12, armor_use=100}, groups = {armor_torso=1, armor_heal=12, armor_use=100},
}) })
armor:register_armor("3d_armor:leggings_diamond", { armor:register_armor("3d_armor:leggings_diamond", {
description = "Diamond Leggings", description = S("Diamond Leggings"),
inventory_image = "3d_armor_inv_leggings_diamond.png", inventory_image = "3d_armor_inv_leggings_diamond.png",
armor_groups = {fleshy=20}, armor_groups = {fleshy=20},
groups = {armor_legs=1, armor_heal=12, armor_use=100}, groups = {armor_legs=1, armor_heal=12, armor_use=100},
}) })
armor:register_armor("3d_armor:boots_diamond", { armor:register_armor("3d_armor:boots_diamond", {
description = "Diamond Boots", description = S("Diamond Boots"),
inventory_image = "3d_armor_inv_boots_diamond.png", inventory_image = "3d_armor_inv_boots_diamond.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_feet=1, armor_heal=12, armor_use=100}, groups = {armor_feet=1, armor_heal=12, armor_use=100},
@ -184,25 +189,25 @@ end
if armor.materials.gold then if armor.materials.gold then
armor:register_armor("3d_armor:helmet_gold", { armor:register_armor("3d_armor:helmet_gold", {
description = "Gold Helmet", description = S("Gold Helmet"),
inventory_image = "3d_armor_inv_helmet_gold.png", inventory_image = "3d_armor_inv_helmet_gold.png",
armor_groups = {fleshy=10}, armor_groups = {fleshy=10},
groups = {armor_head=1, armor_heal=6, armor_use=250}, groups = {armor_head=1, armor_heal=6, armor_use=250},
}) })
armor:register_armor("3d_armor:chestplate_gold", { armor:register_armor("3d_armor:chestplate_gold", {
description = "Gold Chestplate", description = S("Gold Chestplate"),
inventory_image = "3d_armor_inv_chestplate_gold.png", inventory_image = "3d_armor_inv_chestplate_gold.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_torso=1, armor_heal=6, armor_use=250}, groups = {armor_torso=1, armor_heal=6, armor_use=250},
}) })
armor:register_armor("3d_armor:leggings_gold", { armor:register_armor("3d_armor:leggings_gold", {
description = "Gold Leggings", description = S("Gold Leggings"),
inventory_image = "3d_armor_inv_leggings_gold.png", inventory_image = "3d_armor_inv_leggings_gold.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_legs=1, armor_heal=6, armor_use=250}, groups = {armor_legs=1, armor_heal=6, armor_use=250},
}) })
armor:register_armor("3d_armor:boots_gold", { armor:register_armor("3d_armor:boots_gold", {
description = "Gold Boots", description = S("Gold Boots"),
inventory_image = "3d_armor_inv_boots_gold.png", inventory_image = "3d_armor_inv_boots_gold.png",
armor_groups = {fleshy=10}, armor_groups = {fleshy=10},
groups = {armor_feet=1, armor_heal=6, armor_use=250}, groups = {armor_feet=1, armor_heal=6, armor_use=250},
@ -211,25 +216,25 @@ end
if armor.materials.mithril then if armor.materials.mithril then
armor:register_armor("3d_armor:helmet_mithril", { armor:register_armor("3d_armor:helmet_mithril", {
description = "Mithril Helmet", description = S("Mithril Helmet"),
inventory_image = "3d_armor_inv_helmet_mithril.png", inventory_image = "3d_armor_inv_helmet_mithril.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_head=1, armor_heal=12, armor_use=50}, groups = {armor_head=1, armor_heal=12, armor_use=50},
}) })
armor:register_armor("3d_armor:chestplate_mithril", { armor:register_armor("3d_armor:chestplate_mithril", {
description = "Mithril Chestplate", description = S("Mithril Chestplate"),
inventory_image = "3d_armor_inv_chestplate_mithril.png", inventory_image = "3d_armor_inv_chestplate_mithril.png",
armor_groups = {fleshy=20}, armor_groups = {fleshy=20},
groups = {armor_torso=1, armor_heal=12, armor_use=50}, groups = {armor_torso=1, armor_heal=12, armor_use=50},
}) })
armor:register_armor("3d_armor:leggings_mithril", { armor:register_armor("3d_armor:leggings_mithril", {
description = "Mithril Leggings", description = S("Mithril Leggings"),
inventory_image = "3d_armor_inv_leggings_mithril.png", inventory_image = "3d_armor_inv_leggings_mithril.png",
armor_groups = {fleshy=20}, armor_groups = {fleshy=20},
groups = {armor_legs=1, armor_heal=12, armor_use=50}, groups = {armor_legs=1, armor_heal=12, armor_use=50},
}) })
armor:register_armor("3d_armor:boots_mithril", { armor:register_armor("3d_armor:boots_mithril", {
description = "Mithril Boots", description = S("Mithril Boots"),
inventory_image = "3d_armor_inv_boots_mithril.png", inventory_image = "3d_armor_inv_boots_mithril.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_feet=1, armor_heal=12, armor_use=50}, groups = {armor_feet=1, armor_heal=12, armor_use=50},
@ -238,25 +243,25 @@ end
if armor.materials.crystal then if armor.materials.crystal then
armor:register_armor("3d_armor:helmet_crystal", { armor:register_armor("3d_armor:helmet_crystal", {
description = "Crystal Helmet", description = S("Crystal Helmet"),
inventory_image = "3d_armor_inv_helmet_crystal.png", inventory_image = "3d_armor_inv_helmet_crystal.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_head=1, armor_heal=12, armor_use=50, armor_fire=1}, groups = {armor_head=1, armor_heal=12, armor_use=50, armor_fire=1},
}) })
armor:register_armor("3d_armor:chestplate_crystal", { armor:register_armor("3d_armor:chestplate_crystal", {
description = "Crystal Chestplate", description = S("Crystal Chestplate"),
inventory_image = "3d_armor_inv_chestplate_crystal.png", inventory_image = "3d_armor_inv_chestplate_crystal.png",
armor_groups = {fleshy=20}, armor_groups = {fleshy=20},
groups = {armor_torso=1, armor_heal=12, armor_use=50, armor_fire=1}, groups = {armor_torso=1, armor_heal=12, armor_use=50, armor_fire=1},
}) })
armor:register_armor("3d_armor:leggings_crystal", { armor:register_armor("3d_armor:leggings_crystal", {
description = "Crystal Leggings", description = S("Crystal Leggings"),
inventory_image = "3d_armor_inv_leggings_crystal.png", inventory_image = "3d_armor_inv_leggings_crystal.png",
armor_groups = {fleshy=20}, armor_groups = {fleshy=20},
groups = {armor_legs=1, armor_heal=12, armor_use=50, armor_fire=1}, groups = {armor_legs=1, armor_heal=12, armor_use=50, armor_fire=1},
}) })
armor:register_armor("3d_armor:boots_crystal", { armor:register_armor("3d_armor:boots_crystal", {
description = "Crystal Boots", description = S("Crystal Boots"),
inventory_image = "3d_armor_inv_boots_crystal.png", inventory_image = "3d_armor_inv_boots_crystal.png",
armor_groups = {fleshy=15}, armor_groups = {fleshy=15},
groups = {armor_feet=1, armor_heal=12, armor_use=50, physics_speed=1, groups = {armor_feet=1, armor_heal=12, armor_use=50, physics_speed=1,

@ -4,3 +4,4 @@ armor_monoid?
fire? fire?
ethereal? ethereal?
bakedclay? bakedclay?
intllib?

@ -1,3 +1,7 @@
local S = function(s) return s end
if minetest.global_exists("intllib") then
S = intllib.Getter()
end
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local worldpath = minetest.get_worldpath() local worldpath = minetest.get_worldpath()
@ -50,8 +54,11 @@ for material, _ in pairs(armor.materials) do
armor.materials[material] = nil armor.materials[material] = nil
end end
end end
armor.formspec = armor.formspec..
"label[5,1;"..S("Level")..": armor_level]"..
"label[5,1.5;"..S("Heal")..": armor_attr_heal]"
if armor.config.fire_protect then if armor.config.fire_protect then
armor.formspec = armor.formspec.."label[5,2;Fire: armor_fire]" armor.formspec = armor.formspec.."label[5,2;"..S("Fire")..": armor_fire]"
end end
dofile(modpath.."/armor.lua") dofile(modpath.."/armor.lua")
@ -59,7 +66,8 @@ dofile(modpath.."/armor.lua")
-- Mod Compatibility -- Mod Compatibility
if minetest.get_modpath("technic") then if minetest.get_modpath("technic") then
armor.formspec = armor.formspec.."label[5,2.5;Radiation: armor_group_radiation]" armor.formspec = armor.formspec..
"label[5,2.5;"..S("Radiation")..": armor_group_radiation]"
armor:register_armor_group("radiation") armor:register_armor_group("radiation")
end end
local skin_mods = {"skins", "u_skins", "simple_skins", "wardrobe"} local skin_mods = {"skins", "u_skins", "simple_skins", "wardrobe"}
@ -282,7 +290,8 @@ minetest.register_on_player_hpchange(function(player, hp_change)
if stack:get_count() == 0 then if stack:get_count() == 0 then
local desc = minetest.registered_items[item].description local desc = minetest.registered_items[item].description
if desc then if desc then
minetest.chat_send_player(name, "Your "..desc.." got destroyed!") minetest.chat_send_player(name,
S("Your")..desc.." "..S("got destroyed").."!")
end end
armor:set_player_armor(player) armor:set_player_armor(player)
armor:run_callbacks("on_unequip", player, stack) armor:run_callbacks("on_unequip", player, stack)

@ -2,6 +2,10 @@ if not minetest.global_exists("unified_inventory") then
minetest.log("warning", "3d_armor_ui: Mod loaded but unused.") minetest.log("warning", "3d_armor_ui: Mod loaded but unused.")
return return
end end
local S = function(s) return s end
if minetest.global_exists("intllib") then
S = intllib.Getter()
end
if unified_inventory.sfinv_compat_layer then if unified_inventory.sfinv_compat_layer then
return return
@ -27,17 +31,17 @@ unified_inventory.register_page("armor", {
"label[0,0;Armor]".. "label[0,0;Armor]"..
"list[detached:"..name.."_armor;armor;0,"..fy..";2,3;]".. "list[detached:"..name.."_armor;armor;0,"..fy..";2,3;]"..
"image[2.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]".. "image[2.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]"..
"label[5.0,"..(fy + 0.0)..";Level: "..armor.def[name].level.."]".. "label[5.0,"..(fy + 0.0)..";"..S("Level")..": "..armor.def[name].level.."]"..
"label[5.0,"..(fy + 0.5)..";Heal: "..armor.def[name].heal.."]".. "label[5.0,"..(fy + 0.5)..";"..S("Heal")..": "..armor.def[name].heal.."]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[detached:"..name.."_armor;armor]" "listring[detached:"..name.."_armor;armor]"
if armor.config.fire_protect then if armor.config.fire_protect then
formspec = formspec.."label[5.0,"..(fy + 1.0).. formspec = formspec.."label[5.0,"..(fy + 1.0)..";"..
";Fire: "..armor.def[name].fire.."]" S("Fire")..": "..armor.def[name].fire.."]"
end end
if minetest.global_exists("technic") then if minetest.global_exists("technic") then
formspec = formspec.."label[5.0,"..(fy + 1.5).. formspec = formspec.."label[5.0,"..(fy + 1.5)..";"..
";Radiation: "..armor.def[name].groups["radiation"].."]" S("Radiation")..": "..armor.def[name].groups["radiation"].."]"
end end
return {formspec=formspec} return {formspec=formspec}
end, end,

@ -2,6 +2,10 @@ if not minetest.get_modpath("technic") then
minetest.log("warning", "hazmat_suit: Mod loaded but unused.") minetest.log("warning", "hazmat_suit: Mod loaded but unused.")
return return
end end
local S = function(s) return s end
if minetest.global_exists("intllib") then
S = intllib.Getter()
end
local part_count = 4 local part_count = 4
@ -26,37 +30,37 @@ fire = math.floor(fire / part_count)
radiation = math.floor(radiation / part_count) radiation = math.floor(radiation / part_count)
minetest.register_craftitem("hazmat_suit:helmet_hazmat", { minetest.register_craftitem("hazmat_suit:helmet_hazmat", {
description = "Hazmat Helmet", description = S("Hazmat Helmet"),
inventory_image = "hazmat_suit_inv_helmet_hazmat.png", inventory_image = "hazmat_suit_inv_helmet_hazmat.png",
stack_max = 1, stack_max = 1,
}) })
minetest.register_craftitem("hazmat_suit:chestplate_hazmat", { minetest.register_craftitem("hazmat_suit:chestplate_hazmat", {
description = "Hazmat Chestplate", description = S("Hazmat Chestplate"),
inventory_image = "hazmat_suit_inv_chestplate_hazmat.png", inventory_image = "hazmat_suit_inv_chestplate_hazmat.png",
stack_max = 1, stack_max = 1,
}) })
minetest.register_craftitem("hazmat_suit:sleeve_hazmat", { minetest.register_craftitem("hazmat_suit:sleeve_hazmat", {
description = "Hazmat Sleeve", description = S("Hazmat Sleeve"),
inventory_image = "hazmat_suit_inv_sleeve_hazmat.png", inventory_image = "hazmat_suit_inv_sleeve_hazmat.png",
stack_max = 1, stack_max = 1,
}) })
minetest.register_craftitem("hazmat_suit:leggings_hazmat", { minetest.register_craftitem("hazmat_suit:leggings_hazmat", {
description = "Hazmat Leggins", description = S("Hazmat Leggins"),
inventory_image = "hazmat_suit_inv_leggings_hazmat.png", inventory_image = "hazmat_suit_inv_leggings_hazmat.png",
stack_max = 1, stack_max = 1,
}) })
minetest.register_craftitem("hazmat_suit:boots_hazmat", { minetest.register_craftitem("hazmat_suit:boots_hazmat", {
description = "Hazmat Boots", description = S("Hazmat Boots"),
inventory_image = "hazmat_suit_inv_boots_hazmat.png", inventory_image = "hazmat_suit_inv_boots_hazmat.png",
stack_max = 1, stack_max = 1,
}) })
minetest.register_tool("hazmat_suit:suit_hazmat", { minetest.register_tool("hazmat_suit:suit_hazmat", {
description = "Hazmat Suit", description = S("Hazmat Suit"),
inventory_image = "hazmat_suit_inv_suit_hazmat.png", inventory_image = "hazmat_suit_inv_suit_hazmat.png",
groups = { groups = {
armor_head = level, armor_head = level,

@ -1,3 +1,7 @@
local S = function(s) return s end
if minetest.global_exists("intllib") then
S = intllib.Getter()
end
local use_moreores = minetest.get_modpath("moreores") local use_moreores = minetest.get_modpath("moreores")
if minetest.global_exists("armor") and armor.elements then if minetest.global_exists("armor") and armor.elements then
@ -9,7 +13,7 @@ end
-- Regisiter Shields -- Regisiter Shields
minetest.register_tool("shields:shield_admin", { minetest.register_tool("shields:shield_admin", {
description = "Admin Shield", description = S("Admin Shield"),
inventory_image = "shields_inv_shield_admin.png", inventory_image = "shields_inv_shield_admin.png",
groups = {armor_shield=1000, armor_heal=100, armor_use=0, not_in_creative_inventory=1}, groups = {armor_shield=1000, armor_heal=100, armor_use=0, not_in_creative_inventory=1},
wear = 0, wear = 0,
@ -17,13 +21,13 @@ minetest.register_tool("shields:shield_admin", {
if armor.materials.wood then if armor.materials.wood then
minetest.register_tool("shields:shield_wood", { minetest.register_tool("shields:shield_wood", {
description = "Wooden Shield", description = S("Wooden Shield"),
inventory_image = "shields_inv_shield_wood.png", inventory_image = "shields_inv_shield_wood.png",
groups = {armor_shield=5, armor_heal=0, armor_use=2000}, groups = {armor_shield=5, armor_heal=0, armor_use=2000},
wear = 0, wear = 0,
}) })
minetest.register_tool("shields:shield_enhanced_wood", { minetest.register_tool("shields:shield_enhanced_wood", {
description = "Enhanced Wood Shield", description = S("Enhanced Wood Shield"),
inventory_image = "shields_inv_shield_enhanced_wood.png", inventory_image = "shields_inv_shield_enhanced_wood.png",
groups = {armor_shield=8, armor_heal=0, armor_use=1000}, groups = {armor_shield=8, armor_heal=0, armor_use=1000},
wear = 0, wear = 0,
@ -40,13 +44,13 @@ end
if armor.materials.cactus then if armor.materials.cactus then
minetest.register_tool("shields:shield_cactus", { minetest.register_tool("shields:shield_cactus", {
description = "Cactus Shield", description = S("Cactus Shield"),
inventory_image = "shields_inv_shield_cactus.png", inventory_image = "shields_inv_shield_cactus.png",
groups = {armor_shield=5, armor_heal=0, armor_use=2000}, groups = {armor_shield=5, armor_heal=0, armor_use=2000},
wear = 0, wear = 0,
}) })
minetest.register_tool("shields:shield_enhanced_cactus", { minetest.register_tool("shields:shield_enhanced_cactus", {
description = "Enhanced Cactus Shield", description = S("Enhanced Cactus Shield"),
inventory_image = "shields_inv_shield_enhanced_cactus.png", inventory_image = "shields_inv_shield_enhanced_cactus.png",
groups = {armor_shield=8, armor_heal=0, armor_use=1000}, groups = {armor_shield=8, armor_heal=0, armor_use=1000},
wear = 0, wear = 0,
@ -63,7 +67,7 @@ end
if armor.materials.steel then if armor.materials.steel then
minetest.register_tool("shields:shield_steel", { minetest.register_tool("shields:shield_steel", {
description = "Steel Shield", description = S("Steel Shield"),
inventory_image = "shields_inv_shield_steel.png", inventory_image = "shields_inv_shield_steel.png",
groups = {armor_shield=10, armor_heal=0, armor_use=500}, groups = {armor_shield=10, armor_heal=0, armor_use=500},
wear = 0, wear = 0,
@ -72,7 +76,7 @@ end
if armor.materials.bronze then if armor.materials.bronze then
minetest.register_tool("shields:shield_bronze", { minetest.register_tool("shields:shield_bronze", {
description = "Bronze Shield", description = S("Bronze Shield"),
inventory_image = "shields_inv_shield_bronze.png", inventory_image = "shields_inv_shield_bronze.png",
groups = {armor_shield=10, armor_heal=6, armor_use=250}, groups = {armor_shield=10, armor_heal=6, armor_use=250},
wear = 0, wear = 0,
@ -81,7 +85,7 @@ end
if armor.materials.diamond then if armor.materials.diamond then
minetest.register_tool("shields:shield_diamond", { minetest.register_tool("shields:shield_diamond", {
description = "Diamond Shield", description = S("Diamond Shield"),
inventory_image = "shields_inv_shield_diamond.png", inventory_image = "shields_inv_shield_diamond.png",
groups = {armor_shield=15, armor_heal=12, armor_use=100}, groups = {armor_shield=15, armor_heal=12, armor_use=100},
wear = 0, wear = 0,
@ -90,7 +94,7 @@ end
if armor.materials.gold then if armor.materials.gold then
minetest.register_tool("shields:shield_gold", { minetest.register_tool("shields:shield_gold", {
description = "Gold Shield", description = S("Gold Shield"),
inventory_image = "shields_inv_shield_gold.png", inventory_image = "shields_inv_shield_gold.png",
groups = {armor_shield=10, armor_heal=6, armor_use=250}, groups = {armor_shield=10, armor_heal=6, armor_use=250},
wear = 0, wear = 0,
@ -99,7 +103,7 @@ end
if armor.materials.mithril then if armor.materials.mithril then
minetest.register_tool("shields:shield_mithril", { minetest.register_tool("shields:shield_mithril", {
description = "Mithril Shield", description = S("Mithril Shield"),
inventory_image = "shields_inv_shield_mithril.png", inventory_image = "shields_inv_shield_mithril.png",
groups = {armor_shield=15, armor_heal=12, armor_use=50}, groups = {armor_shield=15, armor_heal=12, armor_use=50},
wear = 0, wear = 0,
@ -108,7 +112,7 @@ end
if armor.materials.crystal then if armor.materials.crystal then
minetest.register_tool("shields:shield_crystal", { minetest.register_tool("shields:shield_crystal", {
description = "Crystal Shield", description = S("Crystal Shield"),
inventory_image = "shields_inv_shield_crystal.png", inventory_image = "shields_inv_shield_crystal.png",
groups = {armor_shield=15, armor_heal=12, armor_use=50, armor_fire=1}, groups = {armor_shield=15, armor_heal=12, armor_use=50, armor_fire=1},
wear = 0, wear = 0,

@ -2,27 +2,31 @@ if not minetest.get_modpath("technic_worldgen") then
minetest.log("warning", "technic_armor: Mod loaded but unused.") minetest.log("warning", "technic_armor: Mod loaded but unused.")
return return
end end
local S = function(s) return s end
if minetest.global_exists("intllib") then
S = intllib.Getter()
end
local stats = { local stats = {
lead = { name="Lead", material="technic:lead_ingot", armor=1.6, heal=0, use=500, radiation=80*1.1 }, lead = { name=S("Lead"), material="technic:lead_ingot", armor=1.6, heal=0, use=500, radiation=80*1.1 },
brass = { name="Brass", material="technic:brass_ingot", armor=1.8, heal=0, use=650, radiation=43 }, brass = { name=S("Brass"), material="technic:brass_ingot", armor=1.8, heal=0, use=650, radiation=43 },
cast = { name="Cast Iron", material="technic:cast_iron_ingot", armor=2.5, heal=8, use=200, radiation=40 }, cast = { name=S("Cast Iron"), material="technic:cast_iron_ingot", armor=2.5, heal=8, use=200, radiation=40 },
carbon = { name="Carbon Steel", material="technic:carbon_steel_ingot", armor=2.7, heal=10, use=100, radiation=40 }, carbon = { name=S("Carbon Steel"), material="technic:carbon_steel_ingot", armor=2.7, heal=10, use=100, radiation=40 },
stainless = { name="Stainless Steel", material="technic:stainless_steel_ingot", armor=2.7, heal=10, use=75, radiation=40 }, stainless = { name=S("Stainless Steel"), material="technic:stainless_steel_ingot", armor=2.7, heal=10, use=75, radiation=40 },
} }
if minetest.get_modpath("moreores") then if minetest.get_modpath("moreores") then
stats.tin = { name="Tin", material="moreores:tin_ingot", armor=1.6, heal=0, use=750, radiation=37 } stats.tin = { name=S("Tin"), material="moreores:tin_ingot", armor=1.6, heal=0, use=750, radiation=37 }
stats.silver = { name="Silver", material="moreores:silver_ingot", armor=1.8, heal=6, use=650, radiation=53 } stats.silver = { name=S("Silver"), material="moreores:silver_ingot", armor=1.8, heal=6, use=650, radiation=53 }
end end
local parts = { local parts = {
helmet = { place="head", name="Helmet", level=5, radlevel = 0.10, craft={{1,1,1},{1,0,1}} }, helmet = { place="head", name=S("Helmet"), level=5, radlevel = 0.10, craft={{1,1,1},{1,0,1}} },
chestplate = { place="torso", name="Chestplate", level=8, radlevel = 0.35, craft={{1,0,1},{1,1,1},{1,1,1}} }, chestplate = { place="torso", name=S("Chestplate"), level=8, radlevel = 0.35, craft={{1,0,1},{1,1,1},{1,1,1}} },
leggings = { place="legs", name="Leggings", level=7, radlevel = 0.15, craft={{1,1,1},{1,0,1},{1,0,1}} }, leggings = { place="legs", name=S("Leggings"), level=7, radlevel = 0.15, craft={{1,1,1},{1,0,1},{1,0,1}} },
boots = { place="feet", name="Boots", level=4, radlevel = 0.10, craft={{1,0,1},{1,0,1}} }, boots = { place="feet", name=S("Boots"), level=4, radlevel = 0.10, craft={{1,0,1},{1,0,1}} },
} }
if minetest.get_modpath("shields") then if minetest.get_modpath("shields") then
parts.shield = { place="shield", name="Shield", level=5, radlevel=0.00, craft={{1,1,1},{1,1,1},{0,1,0}} } parts.shield = { place="shield", name=S("Shield"), level=5, radlevel=0.00, craft={{1,1,1},{1,1,1},{0,1,0}} }
end end
-- Makes a craft recipe based on a template -- Makes a craft recipe based on a template