Use new intllib API.

This commit is contained in:
Diego Martínez 2017-01-24 17:43:20 -03:00
parent bb06cfd6f6
commit 0d3da0c328
24 changed files with 410 additions and 329 deletions

View File

@ -1,21 +1,20 @@
local S = homedecor.gettext
local bathroom_tile_colors = {
{ "1", "white/grey", "#c0c0c0:200" },
{ "2", "white/dark grey", "#404040:150" },
{ "3", "white/black", "#000000:200" },
{ "4", "black/dark grey", "" },
{ "red", "white/red", "#d00000:150" },
{ "green", "white/green", "#00d000:150" },
{ "blue", "white/blue", "#0000d0:150" },
{ "yellow", "white/yellow", "#ffff00:150" },
{ "tan", "white/tan", "#ceaf42:150" }
{ "1", S("white/grey"), "#c0c0c0:200" },
{ "2", S("white/dark grey"), "#404040:150" },
{ "3", S("white/black"), "#000000:200" },
{ "4", S("black/dark grey"), "" },
{ "red", S("white/red"), "#d00000:150" },
{ "green", S("white/green"), "#00d000:150" },
{ "blue", S("white/blue"), "#0000d0:150" },
{ "yellow", S("white/yellow"), "#ffff00:150" },
{ "tan", S("white/tan"), "#ceaf42:150" }
}
for i in ipairs(bathroom_tile_colors) do
local color = bathroom_tile_colors[i][1]
local shade = bathroom_tile_colors[i][2]
local hue = bathroom_tile_colors[i][3]
for _, c in ipairs(bathroom_tile_colors) do
local color, shade, hue = unpack(c)
local coloredtile = "homedecor_bathroom_tiles_bg.png^(homedecor_bathroom_tiles_fg.png^[colorize:"..hue..")"
@ -25,7 +24,7 @@ for i in ipairs(bathroom_tile_colors) do
end
minetest.register_node("homedecor:tiles_"..color, {
description = "Bathroom/kitchen tiles ("..shade..")",
description = S("Bathroom/kitchen tiles (@1)", shade),
tiles = {
coloredtile,
coloredtile,
@ -46,7 +45,7 @@ local tr_cbox = {
}
homedecor.register("towel_rod", {
description = "Towel rod with towel",
description = S("Towel rod with towel"),
mesh = "homedecor_towel_rod.obj",
tiles = {
"homedecor_generic_terrycloth.png",
@ -60,7 +59,7 @@ homedecor.register("towel_rod", {
})
homedecor.register("medicine_cabinet", {
description = S("Medicine Cabinet"),
description = S("Medicine cabinet"),
mesh = "homedecor_medicine_cabinet.obj",
tiles = {
'default_wood.png',

View File

@ -222,7 +222,7 @@ homedecor.register("shower_head", {
"homedecor_shower_head.png"
},
inventory_image = "homedecor_shower_head_inv.png",
description = "Shower Head",
description = S("Shower Head"),
groups = {snappy=3},
selection_box = sh_cbox,
walkable = false,
@ -262,7 +262,7 @@ homedecor.register("bathroom_set", {
"homedecor_bathroom_set_toothpaste.png",
},
inventory_image = "homedecor_bathroom_set_inv.png",
description = "Bathroom sundries set",
description = S("Bathroom sundries set"),
groups = {snappy=3},
selection_box = bs_cbox,
walkable = false,

View File

@ -1,21 +1,24 @@
local S = homedecor.gettext
local S, NS = homedecor.gettext, homedecor.ngettext
local function N_(x) return x end
local bedcolors = {
{ "black", "#000000:200" }, --new cg72
{ "brown", "#603010:175" },
{ "blue", "#0000d0:150" },
{ "cyan", "#009fa7:150" }, --new cg72
{ "darkgrey", "#101010:175" },
{ "dark_green", "#007000:150" },
{ "green", "#00d000:150" }, --new cg72
{ "grey", "#101010:100" }, --new cg72
{ "magenta", "#e0048b:150" }, --new cg72
{ "orange", "#ff3000:150" },
{ "pink", "#ff80b0:150" },
{ "red", "#d00000:150" },
{ "violet", "#7000e0:150" },
{ "white", "#000000:000" }, --new cg72
{ "yellow", "#ffe000:150" }
{ S("black"), "black", "#000000:200" }, --new cg72
{ S("brown"), "brown", "#603010:175" },
{ S("blue"), "blue", "#0000d0:150" },
{ S("cyan"), "cyan", "#009fa7:150" }, --new cg72
{ S("dark grey"), "darkgrey", "#101010:175" },
{ S("dark green"), "dark_green", "#007000:150" },
{ S("green"), "green", "#00d000:150" }, --new cg72
{ S("grey"), "grey", "#101010:100" }, --new cg72
{ S("magenta"), "magenta", "#e0048b:150" }, --new cg72
{ S("orange"), "orange", "#ff3000:150" },
{ S("pink"), "pink", "#ff80b0:150" },
{ S("red"), "red", "#d00000:150" },
{ S("violet"), "violet", "#7000e0:150" },
{ S("white"), "white", "#000000:000" }, --new cg72
{ S("yellow"), "yellow", "#ffe000:150" }
}
local bed_sbox = {
@ -46,10 +49,9 @@ local kbed_cbox = {
}
}
for i in ipairs(bedcolors) do
local color = bedcolors[i][1]
for _, c in ipairs(bedcolors) do
local colordesc, color, hue = unpack(c)
local color2=color
local hue = bedcolors[i][2]
if color == "darkgrey" then
color2 = "dark_grey"
@ -65,7 +67,7 @@ for i in ipairs(bedcolors) do
"wool_"..color2..".png^[brighten", -- pillow
},
inventory_image = "homedecor_bed_inv.png^(homedecor_bed_overlay_inv.png^[colorize:"..hue..")",
description = S("Bed (%s)"):format(color),
description = S("Bed (@1)", colordesc),
groups = {snappy=3},
selection_box = bed_sbox,
collision_box = bed_cbox,
@ -126,7 +128,7 @@ for i in ipairs(bedcolors) do
},
inventory_image = "homedecor_bed_kingsize_inv.png^(homedecor_bed_kingsize_overlay_inv.png^[colorize:"..hue..")",
groups = {snappy=3, not_in_creative_inventory=1},
description = S("Bed (%s, king sized)"):format(color),
description = S("Bed (@1, king sized)", colordesc),
groups = {snappy=3, not_in_creative_inventory=1},
selection_box = kbed_sbox,
collision_box = kbed_cbox,
@ -154,9 +156,9 @@ for i in ipairs(bedcolors) do
end
for _, w in pairs({"mahogany", "oak"}) do
for _, w in pairs({ N_("mahogany"), N_("oak") }) do
homedecor.register("nightstand_"..w.."_one_drawer", {
description = S("Nightstand with One Drawer ("..w..")"),
description = S("Nightstand with One Drawer (@1)", S(w)),
tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX',
@ -185,7 +187,7 @@ for _, w in pairs({"mahogany", "oak"}) do
})
homedecor.register("nightstand_"..w.."_two_drawers", {
description = S("Nightstand with Two Drawers ("..w..")"),
description = S("Nightstand with Two Drawers (@1)", S(w)),
tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX',

View File

@ -1,22 +1,23 @@
local S = homedecor.gettext
local function N_(x) return x end
local bookcolors = {
{ "red", "#c00000:150" },
{ "green", "#008000:150" },
{ "blue", "#4040c0:150" },
{ "violet", "#600070:150" },
{ "grey", "#202020:150" },
{ "brown", "#603010:175" }
{ N_("red"), "#c00000:150" },
{ N_("green"), "#008000:150" },
{ N_("blue"), "#4040c0:150" },
{ N_("violet"), "#600070:150" },
{ N_("grey"), "#202020:150" },
{ N_("brown"), "#603010:175" }
}
local BOOK_FORMNAME = "homedecor:book_form"
local player_current_book = { }
for c in ipairs(bookcolors) do
local color = bookcolors[c][1]
local color_d = S(bookcolors[c][1])
local hue = bookcolors[c][2]
for _, c in ipairs(bookcolors) do
local color, hue = unpack(c)
local function book_dig(pos, node, digger)
if minetest.is_protected(pos, digger:get_player_name()) then return end
@ -41,7 +42,7 @@ for c in ipairs(bookcolors) do
local inv_img = "homedecor_book_inv.png^[colorize:"..hue.."^homedecor_book_trim_inv.png"
homedecor.register("book_"..color, {
description = S("Writable Book (%s)"):format(color_d),
description = S("Writable Book (@1)", S(color)),
mesh = "homedecor_book.obj",
tiles = {
"(homedecor_book_cover.png^[colorize:"..hue..")^homedecor_book_cover_trim.png",
@ -169,6 +170,6 @@ minetest.register_on_player_receive_fields(function(player, form_name, fields)
if (fields.title or "") ~= "" then
meta:set_string("infotext", fields.title)
end
minetest.log("action", player:get_player_name().." has written in a book (title: \""..fields.title.."\"): \""..fields.text..
"\" at location: "..minetest.pos_to_string(player:getpos()))
minetest.log("action", S("@1 has written in a book (title: \"@2\"): \"@3\" at location @4",
player:get_player_name(), fields.title, fields.text, minetest.pos_to_string(player:getpos())))
end)

View File

@ -41,7 +41,7 @@ local add_mesh_desk_fan_entity = function(pos)
end
homedecor.register("desk_fan", {
description = "Desk Fan",
description = S("Desk Fan"),
groups = {oddly_breakable_by_hand=2},
node_box = {
type = "fixed",
@ -136,7 +136,7 @@ homedecor.register("radiator", {
"homedecor_radiator_controls.png"
},
inventory_image = "homedecor_radiator_inv.png",
description = "Radiator heater",
description = S("Radiator heater"),
groups = {snappy=3},
selection_box = r_cbox,
collision_box = r_cbox,

View File

@ -109,23 +109,23 @@ minetest.register_craftitem("homedecor:steel_strip", {
})
minetest.register_craftitem(":glooptest:chainlink", {
description = "Steel chainlink",
description = S("Steel chainlink"),
inventory_image = "homedecor_chainlink_steel.png"
})
minetest.register_craftitem("homedecor:chainlink_brass", {
description = "Brass chainlink",
description = S("Brass chainlink"),
inventory_image = "homedecor_chainlink_brass.png"
})
minetest.register_craftitem("homedecor:soda_can", {
description = "Soda Can",
description = S("Soda Can"),
inventory_image = "homedecor_soda_can.png",
on_use = minetest.item_eat(2),
})
minetest.register_craftitem("homedecor:coin", {
description = "Gold Coin (for soda vending machine)",
description = S("Gold Coin (for soda vending machine)"),
inventory_image = "homedecor_coin.png",
})

View File

@ -2,6 +2,8 @@
local S = homedecor.gettext
local function N_(x) return x end
-- doors
local function isSolid(pos, adjust)
@ -119,17 +121,17 @@ end
local door_model_list = {
{ name = "closet_mahogany",
description = S("Mahogany Closet Door"),
description = N_("Mahogany Closet Door (@1 opening)"),
mesh = "homedecor_door_closet.obj"
},
{ name = "closet_oak",
description = S("Oak Closet Door"),
description = N_("Oak Closet Door (@1 opening)"),
mesh = "homedecor_door_closet.obj"
},
{ name = "exterior_fancy",
description = S("Fancy Wood/Glass Door"),
description = N_("Fancy Wood/Glass Door (@1 opening)"),
mesh = "homedecor_door_fancy.obj",
tiles = {
"homedecor_door_exterior_fancy.png",
@ -139,12 +141,12 @@ local door_model_list = {
},
{ name = "glass",
description = S("Glass Office Door"),
description = N_("Glass Office Door (@1 opening)"),
mesh = "homedecor_door_plain.obj"
},
{ name = "wood_glass_oak",
description = S("Glass and Wood, Oak-colored"),
description = N_("Glass and Wood, Oak-colored (@1 opening)"),
mesh = "homedecor_door_wood_glass.obj",
tiles = {
"homedecor_door_wood_glass_oak.png",
@ -153,7 +155,7 @@ local door_model_list = {
},
{ name = "wood_glass_mahogany",
description = S("Glass and Wood, Mahogany-colored"),
description = N_("Glass and Wood, Mahogany-colored (@1 opening)"),
mesh = "homedecor_door_wood_glass.obj",
tiles = {
"homedecor_door_wood_glass_mahogany.png",
@ -162,7 +164,7 @@ local door_model_list = {
},
{ name = "wood_glass_white",
description = S("Glass and Wood, White"),
description = N_("Glass and Wood, White (@1 opening)"),
mesh = "homedecor_door_wood_glass.obj",
tiles = {
"homedecor_door_wood_glass_white.png",
@ -171,22 +173,22 @@ local door_model_list = {
},
{ name = "wood_plain",
description = S("Plain Wooden Door"),
description = N_("Plain Wooden Door (@1 opening)"),
mesh = "homedecor_door_plain.obj"
},
{ name = "bedroom",
description = S("White Bedroom Door"),
description = N_("White Bedroom Door (@1 opening)"),
mesh = "homedecor_door_plain.obj"
},
{ name = "wrought_iron",
description = S("Wrought Iron Gate/Door"),
description = N_("Wrought Iron Gate/Door (@1 opening)"),
mesh = "homedecor_door_wrought_iron.obj"
},
{ name = "woodglass",
description = S("Wooden door with glass insert"),
description = N_("Wooden door with glass insert (@1 opening)"),
mesh = "homedecor_door_woodglass_typea.obj",
tiles = {
"homedecor_door_woodglass_typea.png",
@ -196,7 +198,7 @@ local door_model_list = {
},
{ name = "woodglass2",
description = S("Wooden door with glass insert, type 2"),
description = N_("Wooden door with glass insert, type 2 (@1 opening)"),
mesh = "homedecor_door_plain.obj",
usealpha = true
},
@ -207,10 +209,9 @@ local def_selbox = {
fixed = { -0.5, -0.5, 0.375, 0.5, 1.5, 0.5 }
}
local sides = {"left", "right"}
local sides = { N_("left"), N_("right") }
for i in ipairs(sides) do
local side = sides[i]
for i, side in ipairs(sides) do
for _, door_model in ipairs(door_model_list) do
@ -227,7 +228,7 @@ for i in ipairs(sides) do
end
minetest.register_node("homedecor:door_"..doorname.."_"..side, {
description = door_model.description.." "..S("(%s-opening)"):format(side),
description = S(door_model.description, S(side)),
drawtype = "mesh",
mesh = mesh,
tiles = door_model.tiles or { "homedecor_door_"..doorname..".png" },
@ -291,8 +292,12 @@ end
-- Gates
local gates_list = { "picket", "picket_white", "barbed_wire", "chainlink" }
local gate_names = { "Unpainted Picket", "White Picket", "Barbed Wire", "Chainlink" }
local gate_list = {
{ "picket", S("Unpainted Picket Fence Gate") },
{ "picket_white", S("White Picket Fence Gate") },
{ "barbed_wire", S("Barbed Wire Fence Gate") },
{ "chainlink", S("Chainlink Fence Gate") },
}
local gate_models_closed = {
{{ -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }},
@ -332,9 +337,9 @@ local gate_models_open = {
{ 6/16, -3/16, -8/16, 8/16, 3/16, -6/16 }} -- the lump representing the lock
}
for i in ipairs(gates_list) do
for i, g in ipairs(gate_list) do
local gate=gates_list[i]
local gate, gatedesc = unpack(g)
local tiles = {
"homedecor_gate_"..gate.."_tb.png",
@ -369,7 +374,7 @@ for i in ipairs(gates_list) do
local def = {
drawtype = "nodebox",
description = S(gate_names[i].." Fence Gate"),
description = gatedesc,
tiles = tiles,
paramtype = "light",
groups = {snappy=3},
@ -518,7 +523,7 @@ local jp_cbox = {
}
minetest.register_node("homedecor:japanese_wall_top", {
description = "Japanese wall (top)",
description = S("Japanese wall (top)"),
drawtype = "mesh",
mesh = "homedecor_wall_japanese_top.obj",
tiles = {
@ -534,7 +539,7 @@ minetest.register_node("homedecor:japanese_wall_top", {
})
minetest.register_node("homedecor:japanese_wall_middle", {
description = "Japanese wall",
description = S("Japanese wall"),
drawtype = "mesh",
mesh = "homedecor_wall_japanese_middle.obj",
tiles = {
@ -550,7 +555,7 @@ minetest.register_node("homedecor:japanese_wall_middle", {
})
minetest.register_node("homedecor:japanese_wall_bottom", {
description = "Japanese wall (bottom)",
description = S("Japanese wall (bottom)"),
drawtype = "mesh",
mesh = "homedecor_wall_japanese_bottom.obj",
tiles = {
@ -574,7 +579,7 @@ minetest.register_node("homedecor:tatami_mat", {
"homedecor_tatami.png",
"homedecor_tatami.png"
},
description = "Japanese tatami",
description = S("Japanese tatami"),
drawtype = "nodebox",
paramtype = "light",
groups = {snappy=3},
@ -587,7 +592,7 @@ minetest.register_node("homedecor:tatami_mat", {
})
homedecor.register("door_japanese_closed", {
description = "Japanese-style door",
description = S("Japanese-style door"),
inventory_image = "homedecor_door_japanese_inv.png",
tiles = {
"homedecor_generic_wood_luxury.png",

View File

@ -135,7 +135,7 @@ homedecor.register("telephone", {
"homedecor_telephone_cord.png",
},
inventory_image = "homedecor_telephone_inv.png",
description = "Telephone",
description = S("Telephone"),
groups = {snappy=3},
selection_box = tel_cbox,
walkable = false,
@ -149,9 +149,9 @@ minetest.register_abm({
chance = 15,
action = function(pos, node)
minetest.sound_play("homedecor_telephone_ringing", {
pos = pos,
gain = 1.0,
max_hear_distance = 5
})
pos = pos,
gain = 1.0,
max_hear_distance = 5
})
end
})

View File

@ -1,12 +1,15 @@
local S = homedecor.gettext
local function N_(x) return x end
local bbq_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.3125, 0.5, 0.53125, 0.3125 }
}
homedecor.register("barbecue", {
description = "Barbecue",
description = S("Barbecue"),
mesh = "homedecor_barbecue.obj",
tiles = {
"homedecor_generic_metal_black.png",
@ -50,7 +53,7 @@ homedecor.register("bench_large_1", {
"homedecor_generic_wood_old.png",
"homedecor_generic_metal_wrought_iron.png"
},
description = "Garden Bench (style 1)",
description = S("Garden Bench (style 1)"),
inventory_image = "homedecor_bench_large_1_inv.png",
groups = { snappy = 3 },
expand = { right="placeholder" },
@ -77,7 +80,7 @@ local bl2_cbox = {
}
homedecor.register("bench_large_2", {
description = "Garden Bench (style 2)",
description = S("Garden Bench (style 2)"),
mesh = "homedecor_bench_large_2.obj",
tiles = { "homedecor_generic_wood_old.png" },
inventory_image = "homedecor_bench_large_2_inv.png",
@ -100,7 +103,7 @@ local dc_cbox = {
homedecor.register("deckchair", {
mesh = "homedecor_deckchair.obj",
tiles = {"homedecor_deckchair.png"},
description = "Deck Chair",
description = S("Deck Chair"),
groups = { snappy = 3 },
expand = { forward="placeholder" },
sounds = default.node_sound_wood_defaults(),
@ -115,7 +118,7 @@ minetest.register_alias("homedecor:deckchair_head", "air")
homedecor.register("deckchair_striped_blue", {
mesh = "homedecor_deckchair.obj",
tiles = {"homedecor_deckchair_striped_blue.png"},
description = "Deck Chair",
description = S("Deck Chair"),
groups = { snappy = 3 },
expand = { forward="placeholder" },
sounds = default.node_sound_wood_defaults(),
@ -131,7 +134,7 @@ homedecor.register("doghouse", {
"default_wood.png",
"building_blocks_towel.png"
},
description = "Doghouse",
description = S("Doghouse"),
inventory_image = "homedecor_doghouse_inv.png",
selection_box = homedecor.nodebox.slab_y(1.5),
collision_box = homedecor.nodebox.slab_y(1.5),
@ -146,7 +149,7 @@ minetest.register_alias("homedecor:doghouse_base", "homedecor:doghouse")
homedecor.register("simple_bench", {
tiles = { "homedecor_generic_wood_old.png" },
description = "Simple Bench",
description = S("Simple Bench"),
groups = {snappy=3},
node_box = {
type = "fixed",
@ -160,7 +163,7 @@ homedecor.register("simple_bench", {
})
homedecor.register("stonepath", {
description = "Garden stone path",
description = S("Garden stone path"),
tiles = {
"default_stone.png"
},
@ -187,17 +190,20 @@ homedecor.register("stonepath", {
})
local lattice_colors = {
{"wood", ".png^[colorize:#704214:180"},
{"white_wood", ".png"},
{"wood_vegetal", ".png^[colorize:#704214:180^homedecor_lattice_vegetal.png"},
{"white_wood_vegetal", ".png^homedecor_lattice_vegetal.png"},
{ "wood", S("wood"), ".png^[colorize:#704214:180" },
{ "white_wood", S("white wood"), ".png" },
{ "wood_vegetal", S("wood, with vegetation"),
".png^[colorize:#704214:180^homedecor_lattice_vegetal.png" },
{ "white_wood_vegetal", S("white wood, with vegetation"),
".png^homedecor_lattice_vegetal.png" },
}
for _, m in ipairs(lattice_colors) do
homedecor.register("lattice_"..m[1], {
description = "Garden Lattice ("..m[1]..")",
tiles = {"homedecor_lattice"..m[2]},
inventory_image = "homedecor_lattice"..m[2],
for _, c in ipairs(lattice_colors) do
local name, desc, texture = unpack(c)
homedecor.register("lattice_"..name, {
description = S("Garden Lattice (@1)", desc),
tiles = {"homedecor_lattice"..texture},
inventory_image = "homedecor_lattice"..texture,
groups = { snappy=3 },
node_box = {
type = "fixed",
@ -218,7 +224,7 @@ homedecor.register("lattice_"..m[1], {
end
homedecor.register("swing", {
description = "Tree's swing",
description = S("Tree's swing"),
tiles = {
"homedecor_swing_top.png",
"homedecor_swing_top.png^[transformR180",
@ -320,7 +326,7 @@ homedecor.register("well", {
"homedecor_shingles_wood.png"
},
inventory_image = "homedecor_well_inv.png",
description = "Water well",
description = S("Water well"),
groups = { snappy = 3 },
selection_box = homedecor.nodebox.slab_y(2),
collision_box = homedecor.nodebox.slab_y(2),
@ -352,16 +358,16 @@ if minetest.get_modpath("bucket") then
end
homedecor.shrub_colors = {
"green",
"red",
"yellow"
N_("green"),
N_("red"),
N_("yellow"),
}
local shrub_cbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
for _, color in ipairs(homedecor.shrub_colors) do
minetest.register_node("homedecor:shrubbery_large_"..color, {
description = S("Shrubbery ("..color..")"),
description = S("Shrubbery (@1)", S(color)),
drawtype = "mesh",
mesh = "homedecor_cube.obj",
tiles = {"homedecor_shrubbery_"..color..".png"},
@ -372,7 +378,7 @@ for _, color in ipairs(homedecor.shrub_colors) do
})
minetest.register_node("homedecor:shrubbery_"..color, {
description = S("Shrubbery ("..color..")"),
description = S("Shrubbery (@1)", S(color)),
drawtype = "mesh",
mesh = "homedecor_shrubbery.obj",
tiles = {

View File

@ -15,15 +15,23 @@ if signs_modpath then
end
local S = homedecor.gettext
local materials = {"brass", "wrought_iron"}
local function N_(x) return x end
local materials = {
{ S("brass"), "brass" },
{ S("wrought iron"), "wrought_iron" },
}
for _, m in ipairs(materials) do
homedecor.register("fence_"..m, {
description = S("Fence/railing ("..m..")"),
local desc, name = unpack(m)
homedecor.register("fence_"..name, {
description = S("Fence/railing (@1)", desc),
drawtype = "fencelike",
tiles = {"homedecor_generic_metal_"..m..".png"},
inventory_image = "homedecor_fence_"..m..".png",
tiles = {"homedecor_generic_metal_"..name..".png"},
inventory_image = "homedecor_fence_"..name..".png",
selection_box = homedecor.nodebox.bar_y(1/7),
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
@ -31,17 +39,17 @@ homedecor.register("fence_"..m, {
-- brass/wrought iron with signs:
homedecor.register("fence_"..m.."_with_sign", {
description = S("Fence/railing with sign ("..m..")"),
homedecor.register("fence_"..name.."_with_sign", {
description = S("Fence/railing with sign (@1)", desc),
tiles = {
"homedecor_sign_"..m.."_post_top.png",
"homedecor_sign_"..m.."_post_bottom.png",
"homedecor_sign_"..m.."_post_side.png",
"homedecor_sign_"..m.."_post_side.png",
"homedecor_sign_"..m.."_post_back.png",
"homedecor_sign_"..m.."_post_front.png",
"homedecor_sign_"..name.."_post_top.png",
"homedecor_sign_"..name.."_post_bottom.png",
"homedecor_sign_"..name.."_post_side.png",
"homedecor_sign_"..name.."_post_side.png",
"homedecor_sign_"..name.."_post_back.png",
"homedecor_sign_"..name.."_post_front.png",
},
wield_image = "homedecor_sign_"..m.."_post.png",
wield_image = "homedecor_sign_"..name.."_post.png",
node_box = sign_post_model,
groups = {snappy=3,not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
@ -50,7 +58,7 @@ homedecor.register("fence_"..m.."_with_sign", {
max_items = 2,
items = {
{ items = { "default:sign_wall" }},
{ items = { "homedecor:fence_"..m }},
{ items = { "homedecor:fence_"..name }},
},
},
})

View File

@ -1,21 +1,17 @@
local S = homedecor.gettext
local table_colors = {
{ "", homedecor.plain_wood },
{ "_mahogany", homedecor.mahogany_wood },
{ "_white", homedecor.white_wood }
{ "", S("Table"), homedecor.plain_wood },
{ "_mahogany", S("Mahogany Table"), homedecor.mahogany_wood },
{ "_white", S("White Table"), homedecor.white_wood }
}
for i in ipairs(table_colors) do
local desc = S("Table ("..i..")")
for _, t in ipairs(table_colors) do
local suffix, desc, texture = unpack(t)
if i == 1 then
desc = S("Table")
end
homedecor.register("table"..table_colors[i][1], {
homedecor.register("table"..suffix, {
description = desc,
tiles = { table_colors[i][2] },
tiles = { texture },
node_box = {
type = "fixed",
fixed = {
@ -36,13 +32,13 @@ for i in ipairs(table_colors) do
end
local chaircolors = {
{ "", "plain" },
{ "black", "Black" },
{ "red", "Red" },
{ "pink", "Pink" },
{ "violet", "Violet" },
{ "blue", "Blue" },
{ "dark_green", "Dark Green" },
{ "", S("plain") },
{ "black", S("black") },
{ "red", S("red") },
{ "pink", S("pink") },
{ "violet", S("violet") },
{ "blue", S("blue") },
{ "dark_green", S("dark green") },
}
local kc_cbox = {
@ -58,26 +54,27 @@ local ac_cbox = {
}
}
for i in ipairs(chaircolors) do
for _, t in ipairs(chaircolors) do
local color = "_"..chaircolors[i][1]
local color2 = chaircolors[i][1]
local name = S(chaircolors[i][2])
local chairtiles = {
homedecor.plain_wood,
"wool"..color..".png",
}
local woolcolor, colordesc = unpack(t)
local color = woolcolor
local chairtiles
if chaircolors[i][1] == "" then
color = ""
if woolcolor == "" then
chairtiles = {
homedecor.plain_wood,
homedecor.plain_wood
}
else
color = "_"..woolcolor
chairtiles = {
homedecor.plain_wood,
"wool"..color..".png",
}
end
homedecor.register("chair"..color, {
description = S("Kitchen chair (%s)"):format(name),
description = S("Kitchen chair (@1)", colordesc),
mesh = "homedecor_kitchen_chair.obj",
tiles = chairtiles,
selection_box = kc_cbox,
@ -93,7 +90,7 @@ for i in ipairs(chaircolors) do
if color ~= "" then
homedecor.register("armchair"..color, {
description = S("Armchair (%s)"):format(name),
description = S("Armchair (@1)", colordesc),
mesh = "forniture_armchair.obj",
tiles = {
"wool"..color..".png",
@ -108,9 +105,9 @@ for i in ipairs(chaircolors) do
minetest.register_craft({
output = "homedecor:armchair"..color.." 2",
recipe = {
{ "wool:"..color2,""},
{ "wool:"..woolcolor,""},
{ "group:wood","group:wood" },
{ "wool:"..color2,"wool:"..color2 },
{ "wool:"..woolcolor,"wool:"..woolcolor },
},
})
end
@ -122,7 +119,7 @@ local ob_cbox = {
}
minetest.register_node(":homedecor:openframe_bookshelf", {
description = "Bookshelf (open-frame)",
description = S("Bookshelf (open-frame)"),
drawtype = "mesh",
mesh = "homedecor_openframe_bookshelf.obj",
tiles = {
@ -138,7 +135,7 @@ minetest.register_node(":homedecor:openframe_bookshelf", {
})
homedecor.register("wall_shelf", {
description = "Wall Shelf",
description = S("Wall Shelf"),
tiles = {
"homedecor_wood_table_large_edges.png",
},

View File

@ -88,7 +88,7 @@ function homedecor.register_furnace(name, furnacedef)
furnacedef.cook_speed = furnacedef.cook_speed or 1
local description = furnacedef.description or "Furnace"
local description = furnacedef.description or S("Furnace")
local furnace_construct = function(pos)
local meta = minetest.get_meta(pos)
@ -106,7 +106,7 @@ function homedecor.register_furnace(name, furnacedef)
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", S("%s is empty"):format(description))
meta:set_string("infotext", S("@1 (empty)", description))
end
return stack:get_count()
else
@ -125,7 +125,7 @@ function homedecor.register_furnace(name, furnacedef)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", S("%s is empty"):format(description))
meta:set_string("infotext", S("@1 (empty)", description))
end
return count
else
@ -151,7 +151,7 @@ function homedecor.register_furnace(name, furnacedef)
}
local def_active = {
description = description .. " (active)",
description = S("@1 (active)", description),
tiles = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true),
light_source = 8,
drop = "homedecor:" .. name,
@ -231,7 +231,7 @@ function homedecor.register_furnace(name, furnacedef)
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext",S("%s active: %d%%"):format(desc,percent))
meta:set_string("infotext", S("@1 (active: @2%)", desc, percent))
swap_node(pos,name_active..locked)
meta:set_string("formspec", make_formspec(furnacedef, percent))
return
@ -251,7 +251,7 @@ function homedecor.register_furnace(name, furnacedef)
end
if (not fuel) or (fuel.time <= 0) then
meta:set_string("infotext",desc..S(": Out of fuel"))
meta:set_string("infotext", S("@1 (out of fuel)", desc))
swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return
@ -259,7 +259,7 @@ function homedecor.register_furnace(name, furnacedef)
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext",S("%s is empty"):format(desc))
meta:set_string("infotext", S("@1 (empty)", desc))
swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
end
@ -267,7 +267,7 @@ function homedecor.register_furnace(name, furnacedef)
end
if not inv:room_for_item("dst", cooked.item) then
meta:set_string("infotext", desc..S(": output bins are full"))
meta:set_string("infotext", S("@1 (output bins are full)", desc))
swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return

View File

@ -84,17 +84,17 @@ function homedecor.handle_inventory(name, def, original_def)
def.can_dig = def.can_dig or default_can_dig
def.on_metadata_inventory_move = def.on_metadata_inventory_move or function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", S("%s moves stuff in %s at %s"):format(
minetest.log("action", S("@1 moves stuff in @2 at @3",
player:get_player_name(), name, minetest.pos_to_string(pos)
))
end
def.on_metadata_inventory_put = def.on_metadata_inventory_put or function(pos, listname, index, stack, player)
minetest.log("action", S("%s moves %s to %s at %s"):format(
minetest.log("action", S("@1 moves @2 to @3 at @4",
player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)
))
end
def.on_metadata_inventory_take = def.on_metadata_inventory_take or function(pos, listname, index, stack, player)
minetest.log("action", S("%s takes %s from %s at %s"):format(
minetest.log("action", S("@1 takes @2 from @3 at @4",
player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)
))
end
@ -107,7 +107,7 @@ function homedecor.handle_inventory(name, def, original_def)
local owner = placer:get_player_name() or ""
meta:set_string("owner", owner)
meta:set_string("infotext", S("%s (owned by %s)"):format(def.infotext or def.description, owner))
meta:set_string("infotext", S("@1 (owned by @2)", def.infotext or def.description, owner))
return after_place_node and after_place_node(pos, placer)
end
@ -124,7 +124,7 @@ function homedecor.handle_inventory(name, def, original_def)
count
end
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
@ -142,7 +142,7 @@ function homedecor.handle_inventory(name, def, original_def)
stack:get_count()
end
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
@ -160,7 +160,7 @@ function homedecor.handle_inventory(name, def, original_def)
stack:get_count()
end
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
@ -170,7 +170,7 @@ function homedecor.handle_inventory(name, def, original_def)
local lockable = inventory.lockable
if lockable then
local locked_def = table.copy(original_def)
locked_def.description = S("Locked %s"):format(def.description or name)
locked_def.description = S("@1 (Locked)", def.description or name)
local locked_inventory = locked_def.inventory
locked_inventory.locked = true

View File

@ -9,11 +9,14 @@
local modpath = minetest.get_modpath("homedecor")
-- Load support for intllib.
local S, NS = dofile(modpath.."/intllib.lua")
homedecor = {
modpath = modpath,
-- Boilerplate to support localized strings if intllib mod is installed.
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
gettext = S,
ngettext = NS,
-- infinite stacks
expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory")
@ -127,4 +130,4 @@ dofile(modpath.."/wardrobe.lua")
dofile(modpath.."/crafts.lua")
print("[HomeDecor] " .. homedecor.gettext("Loaded!"))
print("[HomeDecor] " .. S("Loaded!"))

45
homedecor/intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

View File

@ -2,6 +2,8 @@
local S = homedecor.gettext
local function N_(x) return x end
-- steel-textured fridge
homedecor.register("refrigerator_steel", {
mesh = "homedecor_refrigerator.obj",
@ -112,7 +114,7 @@ homedecor.register("coffee_maker", {
"homedecor_coffeemaker_cup.png",
"homedecor_coffeemaker_case.png",
},
description = "Coffee Maker",
description = S("Coffee Maker"),
inventory_image = "homedecor_coffeemaker_inv.png",
walkable = false,
groups = {snappy=3},
@ -159,7 +161,7 @@ minetest.register_abm({
})
homedecor.register("toaster", {
description = "Toaster",
description = S("Toaster"),
tiles = { "homedecor_toaster_sides.png" },
inventory_image = "homedecor_toaster_inv.png",
walkable = false,
@ -211,7 +213,7 @@ homedecor.register("toaster_loaf", {
homedecor.register("dishwasher", {
description = "Dishwasher",
description = S("Dishwasher"),
drawtype = "nodebox",
tiles = {
"homedecor_dishwasher_top.png",
@ -235,11 +237,11 @@ homedecor.register("dishwasher", {
groups = { snappy = 3 },
})
local materials = {"granite", "marble", "steel", "wood"}
local materials = { N_("granite"), N_("marble"), N_("steel"), N_("wood") }
for _, m in ipairs(materials) do
homedecor.register("dishwasher_"..m, {
description = "Dishwasher ("..m..")",
description = S("Dishwasher (@1)", S(m)),
tiles = {
"homedecor_kitchen_cabinet_top_"..m..".png",
"homedecor_dishwasher_bottom.png",

View File

@ -2,17 +2,20 @@
local S = homedecor.gettext
local counter_materials = { "", "granite", "marble", "steel" }
local cabinet_sides = "(default_wood.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png"
local cabinet_bottom = "(default_wood.png^[colorize:#000000:100)^(homedecor_kitchen_cabinet_bevel.png^[colorize:#46321580)"
local function N_(x) return x end
local counter_materials = { "", N_("granite"), N_("marble"), N_("steel") }
for _, mat in ipairs(counter_materials) do
local desc = S("Kitchen Cabinet")
local material = ""
if mat ~= "" then
desc = S("Kitchen Cabinet ("..mat.." top)")
desc = S("Kitchen Cabinet (@1 top)", S(mat))
material = "_"..mat
end
@ -144,7 +147,7 @@ homedecor.register("paper_towel", {
"default_wood.png"
},
inventory_image = "homedecor_paper_towel_inv.png",
description = "Paper towels",
description = S("Paper towels"),
groups = { snappy=3 },
walkable = false,
selection_box = {

View File

@ -4,7 +4,9 @@ local dirs2 = { 9, 18, 7, 12 }
local S = homedecor.gettext
local colors = {"yellow","white"}
local function N_(x) return x end
local colors = { N_("yellow"), N_("white") }
for i in ipairs(colors) do
local color = colors[i]
@ -68,7 +70,7 @@ local glowlight_nodebox = {
}
homedecor.register("glowlight_half_"..color, {
description = S("Thick Glowlight ("..color..")"),
description = S("Thick Glowlight (@1)", S(color)),
tiles = {
"homedecor_glowlight_"..color.."_top.png",
"homedecor_glowlight_"..color.."_bottom.png",
@ -86,7 +88,7 @@ homedecor.register("glowlight_half_"..color, {
})
homedecor.register("glowlight_quarter_"..color, {
description = S("Thin Glowlight ("..color..")"),
description = S("Thin Glowlight (@1)", S(color)),
tiles = {
"homedecor_glowlight_"..color.."_top.png",
"homedecor_glowlight_"..color.."_bottom.png",
@ -106,7 +108,7 @@ homedecor.register("glowlight_quarter_"..color, {
-- Glowlight "cubes"
homedecor.register("glowlight_small_cube_"..color, {
description = S("Small Glowlight Cube ("..color..")"),
description = S("Small Glowlight Cube (@1)", S(color)),
tiles = {
"homedecor_glowlight_cube_"..color.."_tb.png",
"homedecor_glowlight_cube_"..color.."_tb.png",
@ -126,7 +128,7 @@ homedecor.register("glowlight_small_cube_"..color, {
end
homedecor.register("plasma_lamp", {
description = "Plasma Lamp",
description = S("Plasma Lamp"),
drawtype = "glasslike_framed",
tiles = {"default_gold_block.png","homedecor_glass_face_clean.png"},
special_tiles = {
@ -146,7 +148,7 @@ homedecor.register("plasma_lamp", {
})
homedecor.register("plasma_ball", {
description = "Plasma Ball",
description = S("Plasma Ball"),
mesh = "homedecor_plasma_ball.obj",
tiles = {
"homedecor_generic_plastic_black.png",
@ -394,12 +396,12 @@ homedecor.register("lattice_lantern_small", {
local repl = { off="low", low="med", med="hi", hi="max", max="off", }
local lamp_colors = {
{"white", "#ffffffe0:175"},
{"blue", "#2626c6e0:200"},
{"green", "#27a927e0:200"},
{"pink", "#ff8fb7e0:200"},
{"red", "#ad2323e0:200"},
{"violet", "#7f29d7e0:200"}
{ N_("white"), "#ffffffe0:175" },
{ N_("blue"), "#2626c6e0:200" },
{ N_("green"), "#27a927e0:200" },
{ N_("pink"), "#ff8fb7e0:200" },
{ N_("red"), "#ad2323e0:200" },
{ N_("violet"), "#7f29d7e0:200" },
}
local tlamp_cbox = {
@ -414,20 +416,14 @@ local slamp_cbox = {
local function reg_lamp(suffix, nxt, tilesuffix, light, color)
local lampcolor = "_"..color[1]
local colordesc = " ("..color[1]..")"
local colordesc = S(color[1])
local woolcolor = color[1]
local invcolor = color[2]
local wool_brighten = (light or 0) * 7
local bulb_brighten = (light or 0) * 14
if color == "" then
lampcolor = ""
colordesc = " (white)"
woolcolor = "white"
end
homedecor.register("table_lamp"..lampcolor.."_"..suffix, {
description = S("Table Lamp "..colordesc),
description = S("Table Lamp (@1)", colordesc),
mesh = "homedecor_table_lamp.obj",
tiles = {
"wool_"..woolcolor..".png^[colorize:#ffffff:"..wool_brighten,
@ -453,7 +449,7 @@ local function reg_lamp(suffix, nxt, tilesuffix, light, color)
-- standing lamps
homedecor.register("standing_lamp"..lampcolor.."_"..suffix, {
description = S("Standing Lamp"..colordesc),
description = S("Standing Lamp (@1)", colordesc),
mesh = "homedecor_standing_lamp.obj",
tiles = {
"wool_"..woolcolor..".png^[colorize:#ffffff:"..wool_brighten,
@ -499,11 +495,11 @@ local dlamp_cbox = {
fixed = { -0.2, -0.5, -0.15, 0.32, 0.12, 0.15 },
}
local dlamp_colors = { "red","blue","green","violet" }
local dlamp_colors = { N_("red"), N_("blue"), N_("green"), N_("violet") }
for _, color in ipairs(dlamp_colors) do
homedecor.register("desk_lamp_"..color, {
description = S("Desk Lamp ("..color..")"),
description = S("Desk Lamp (@1)", S(color)),
mesh = "homedecor_desk_lamp.obj",
tiles = {
"homedecor_table_standing_lamp_lightbulb.png^[colorize:#ffffff:200",

View File

@ -1,5 +1,8 @@
local S = homedecor.gettext
local function N_(x) return x end
homedecor.register("ceiling_paint", {
description = S("Textured Ceiling Paint"),
drawtype = 'signlike',
@ -25,14 +28,13 @@ homedecor.register("ceiling_tile", {
})
local rug_types = {
{ "small", "homedecor_small_rug.obj" },
{ "large", homedecor.box.slab_y(0.0625)},
{ "persian", homedecor.box.slab_y(0.0625)}
{ N_("small"), "homedecor_small_rug.obj" },
{ N_("large"), homedecor.box.slab_y(0.0625) },
{ N_("persian"), homedecor.box.slab_y(0.0625) },
}
for i in ipairs(rug_types) do
s = rug_types[i][1]
m = rug_types[i][2]
for _, rt in ipairs(rug_types) do
local s, m = unpack(rt)
local mesh = m
local nodebox = nil
@ -52,7 +54,7 @@ for i in ipairs(rug_types) do
end
homedecor.register("rug_"..s, {
description = S("Rug ("..s..")"),
description = S("Rug (@1)", S(s)),
mesh = mesh,
tiles = tiles,
node_box = nodebox,
@ -64,11 +66,11 @@ for i in ipairs(rug_types) do
})
end
local pot_colors = {"black", "green", "terracotta"}
local pot_colors = { N_("black"), N_("green"), N_("terracotta") }
for _, p in ipairs(pot_colors) do
homedecor.register("flower_pot_"..p, {
description = S("Flower Pot ("..p..")"),
description = S("Flower Pot (@1)", S(p)),
mesh = "homedecor_flowerpot.obj",
tiles = {
"homedecor_flower_pot_"..p..".png",
@ -80,23 +82,21 @@ homedecor.register("flower_pot_"..p, {
end
local flowers_list = {
{ "Rose", "rose", "flowers:rose" },
{ "Tulip", "tulip", "flowers:tulip" },
{ "Yellow Dandelion", "dandelion_yellow", "flowers:dandelion_yellow" },
{ "White Dandelion", "dandelion_white", "flowers:dandelion_white" },
{ "Blue Geranium", "geranium", "flowers:geranium" },
{ "Viola", "viola", "flowers:viola" },
{ "Cactus", "cactus", "default:cactus" },
{ "Bonsai", "bonsai", "default:sapling" }
{ S("Rose"), "rose", "flowers:rose" },
{ S("Tulip"), "tulip", "flowers:tulip" },
{ S("Yellow Dandelion"), "dandelion_yellow", "flowers:dandelion_yellow" },
{ S("White Dandelion"), "dandelion_white", "flowers:dandelion_white" },
{ S("Blue Geranium"), "geranium", "flowers:geranium" },
{ S("Viola"), "viola", "flowers:viola" },
{ S("Cactus"), "cactus", "default:cactus" },
{ S("Bonsai"), "bonsai", "default:sapling" }
}
for i in ipairs(flowers_list) do
local flowerdesc = flowers_list[i][1]
local flower = flowers_list[i][2]
local craftwith = flowers_list[i][3]
for _, f in ipairs(flowers_list) do
local flowerdesc, flower, craftwith = unpack(f)
homedecor.register("potted_"..flower, {
description = S("Potted flower ("..flowerdesc..")"),
description = S("Potted flower (@1)", flowerdesc),
mesh = "homedecor_potted_plant.obj",
tiles = {
"homedecor_flower_pot_terracotta.png",
@ -164,7 +164,7 @@ local ft_cbox = {
}
homedecor.register("fishtank", {
description = "Fishtank",
description = S("Fishtank"),
mesh = "homedecor_fishtank.obj",
tiles = {
"homedecor_generic_plastic_black.png",
@ -186,7 +186,7 @@ homedecor.register("fishtank", {
})
homedecor.register("fishtank_lighted", {
description = "Fishtank (lighted)",
description = S("Fishtank (lighted)"),
mesh = "homedecor_fishtank.obj",
tiles = {
"homedecor_generic_plastic_black.png",
@ -244,7 +244,7 @@ homedecor.register("cardboard_box", {
})
homedecor.register("dvd_cd_cabinet", {
description = "DVD/CD cabinet",
description = S("DVD/CD cabinet"),
mesh = "homedecor_dvd_cabinet.obj",
tiles = {
"default_wood.png",
@ -270,7 +270,7 @@ homedecor.register("pool_table", {
"homedecor_pool_table_balls.png",
"homedecor_generic_wood_luxury.png^[colorize:#000000:90"
},
description = "Pool Table",
description = S("Pool Table"),
inventory_image = "homedecor_pool_table_inv.png",
groups = {snappy=3},
selection_box = pooltable_cbox,
@ -295,7 +295,7 @@ homedecor.register("piano", {
"homedecor_generic_metal_brass.png",
},
inventory_image = "homedecor_piano_inv.png",
description = "Piano",
description = S("Piano"),
groups = { snappy = 3 },
selection_box = piano_cbox,
collision_box = piano_cbox,
@ -313,7 +313,7 @@ local tr_cbox = {
}
homedecor.register("trophy", {
description = "Trophy",
description = S("Trophy"),
mesh = "homedecor_trophy.obj",
tiles = {
"default_wood.png",
@ -331,7 +331,7 @@ local sb_cbox = {
}
homedecor.register("sportbench", {
description = "Sport bench",
description = S("Sport bench"),
mesh = "homedecor_sport_bench.obj",
tiles = {
"homedecor_generic_metal_wrought_iron.png",
@ -356,7 +356,7 @@ homedecor.register("skateboard", {
mesh = "homedecor_skateboard.obj",
tiles = { "homedecor_skateboard.png" },
inventory_image = "homedecor_skateboard_inv.png",
description = "Skateboard",
description = S("Skateboard"),
groups = {snappy=3},
selection_box = skate_cbox,
walkable = false,
@ -365,7 +365,7 @@ homedecor.register("skateboard", {
})
homedecor.register("tool_cabinet", {
description = "Metal tool cabinet and work table",
description = S("Metal tool cabinet and work table"),
mesh = "homedecor_tool_cabinet.obj",
tiles = {
"homedecor_generic_metal_black.png^[colorize:#ff0000:150",
@ -421,7 +421,7 @@ local p_cbox = {
for i = 1,20 do
homedecor.register("painting_"..i, {
description = "Decorative painting #"..i,
description = S("Decorative painting #@1", i),
mesh = "homedecor_painting.obj",
tiles = {
"default_wood.png",
@ -437,7 +437,7 @@ end
homedecor.banister_materials = {
{ "wood",
"wood",
S("wood"),
"default_wood.png",
"default_wood.png",
"group:wood",
@ -446,7 +446,7 @@ homedecor.banister_materials = {
""
},
{ "white_dark",
"dark topped",
S("dark topped"),
homedecor.white_wood,
homedecor.dark_wood,
"group:wood",
@ -455,7 +455,7 @@ homedecor.banister_materials = {
"dye:white"
},
{ "brass",
"brass",
S("brass"),
homedecor.white_wood,
"homedecor_generic_metal_brass.png",
"technic:brass_ingot",
@ -464,7 +464,7 @@ homedecor.banister_materials = {
"dye:white"
},
{ "wrought_iron",
"wrought iron",
S("wrought iron"),
"homedecor_generic_metal_wrought_iron.png",
"homedecor_generic_metal_wrought_iron.png",
"homedecor:pole_wrought_iron",
@ -476,9 +476,11 @@ homedecor.banister_materials = {
for _, side in ipairs({"diagonal_left", "diagonal_right", "horizontal"}) do
for i in ipairs(homedecor.banister_materials) do
local sidedesc = side:match("^diagonal") and S("diagonal") or S("horizontal")
local name = homedecor.banister_materials[i][1]
for _, mat in ipairs(homedecor.banister_materials) do
local name, matdesc, tile1, tile2 = unpack(mat)
local nodename = "banister_"..name.."_"..side
local groups = { snappy = 3, not_in_creative_inventory = 1 }
@ -498,11 +500,11 @@ for _, side in ipairs({"diagonal_left", "diagonal_right", "horizontal"}) do
end
homedecor.register(nodename, {
description = S("Banister for Stairs ("..homedecor.banister_materials[i][2]..", "..side..")"),
description = S("Banister for Stairs (@1, @2)", matdesc, sidedesc),
mesh = "homedecor_banister_"..side..".obj",
tiles = {
homedecor.banister_materials[i][3],
homedecor.banister_materials[i][4]
tile1,
tile2,
},
inventory_image = "homedecor_banister_"..name.."_inv.png",
groups = groups,
@ -571,7 +573,7 @@ homedecor.register("spiral_staircase", {
if #minetest.find_nodes_in_area(minp, maxp, "air") < 11 then
minetest.set_node(pos, {name = "air"})
minetest.chat_send_player(placer:get_player_name(), "This object takes up a 2x3x2 block of space (the bottom step goes in the forward-right corner), and some of it is occupied!" )
minetest.chat_send_player(placer:get_player_name(), S("not enough space"))
return true
end

View File

@ -1,7 +1,7 @@
local S = homedecor.gettext
homedecor.register("filing_cabinet", {
description = S("Filing Cabinet"),
description = S("Filing cabinet"),
mesh = "homedecor_filing_cabinet.obj",
tiles = {
homedecor.plain_wood,

View File

@ -1,5 +1,8 @@
local S = homedecor.gettext
local function N_(x) return x end
minetest.register_node("homedecor:skylight", {
description = S("Glass Skylight"),
drawtype = "raillike",
@ -25,9 +28,9 @@ minetest.register_node("homedecor:skylight_frosted", {
selection_box = homedecor.nodebox.slab_y(0.1),
})
for _, s in pairs({"asphalt", "terracotta", "wood"}) do
for _, s in pairs({ N_("asphalt"), N_("terracotta"), N_("wood") }) do
minetest.register_node("homedecor:shingles_"..s, {
description = S("Shingles ("..s..")"),
description = S("Shingles (@1)", S(s)),
drawtype = "raillike",
tiles = { "homedecor_shingles_"..s..".png" },
wield_image = "homedecor_shingles_"..s..".png",
@ -81,7 +84,7 @@ homedecor.register_outer_corner = function(modname, subname, groups, slope_image
end
minetest.register_node(modname..":shingle_outer_corner_" .. subname, {
description = S(description.. " (outer corner)"),
description = S("@1 (outer corner)", description),
drawtype = "mesh",
mesh = "homedecor_slope_outer_corner.obj",
tiles = tiles,
@ -103,7 +106,7 @@ homedecor.register_inner_corner = function(modname, subname, groups, slope_image
end
minetest.register_node(modname..":shingle_inner_corner_" .. subname, {
description = S(description.. " (inner corner)"),
description = S("@1 (inner corner)", description),
drawtype = "mesh",
mesh = "homedecor_slope_inner_corner.obj",
tiles = tiles,
@ -124,7 +127,7 @@ homedecor.register_slope = function(modname, subname, recipeitem, groups, slope_
end
minetest.register_node(modname..":shingle_side_" .. subname, {
description = S(description),
description = description,
drawtype = "mesh",
mesh = "homedecor_slope.obj",
tiles = tiles,
@ -259,19 +262,19 @@ end
homedecor.register_roof("homedecor", "wood",
{ snappy = 3 },
{ "homedecor_shingles_wood.png" },
"Wood Shingles"
S("Wood Shingles")
)
homedecor.register_roof("homedecor", "asphalt",
{ snappy = 3 },
{ "homedecor_shingles_asphalt.png" },
"Asphalt Shingles"
S("Asphalt Shingles")
)
homedecor.register_roof("homedecor", "terracotta",
{ snappy = 3 },
{ "homedecor_shingles_terracotta.png" },
"Terracotta Shingles"
S("Terracotta Shingles")
)
-- register just the slopes
@ -280,33 +283,33 @@ homedecor.register_slope("homedecor", "wood",
"homedecor:shingles_wood",
{ snappy = 3 },
{ "homedecor_shingles_wood.png" },
"Wood Shingles"
S("Wood Shingles")
)
homedecor.register_slope("homedecor", "asphalt",
"homedecor:shingles_asphalt",
{ snappy = 3 },
{ "homedecor_shingles_asphalt.png" },
"Asphalt Shingles"
S("Asphalt Shingles")
)
homedecor.register_slope("homedecor", "terracotta",
"homedecor:shingles_terracotta",
{ snappy = 3 },
{ "homedecor_shingles_terracotta.png" },
"Terracotta Shingles"
S("Terracotta Shingles")
)
homedecor.register_slope("homedecor", "glass",
"homedecor:shingles_glass",
{ snappy = 3 },
{ "homedecor_shingles_glass.png", "homedecor_shingles_wood.png" },
"Glass Shingles"
S("Glass Shingles")
)
homedecor.register("chimney", {
description = "Chimney",
description = S("Chimney"),
mesh = "homedecor_chimney.obj",
tiles = {
"homedecor_chimney_tb.png",

View File

@ -3,17 +3,17 @@
local S = homedecor.gettext
local shutters = {
{"oak", "Unpainted oak", "#bf8a51:200" },
{"mahogany", "Mahogany", "#822606:200" },
{"red", "Red", "#d00000:150" },
{"yellow", "Yellow", "#ffff00:150" },
{"forest_green", "Forest green", "#006000:150" },
{"light_blue", "Light blue", "#1963c7:150" },
{"violet", "Violet", "#6000ff:150" },
{"black", "Black", "#000000:200" },
{"dark_grey", "Dark grey", "#202020:200" },
{"grey", "Grey", "#c0c0c0:150" },
{"white", "White", "#ffffff:150" },
{"oak", S("unpainted oak"), "#bf8a51:200" },
{"mahogany", S("mahogany"), "#822606:200" },
{"red", S("red"), "#d00000:150" },
{"yellow", S("yellow"), "#ffff00:150" },
{"forest_green", S("forest green"), "#006000:150" },
{"light_blue", S("light blue"), "#1963c7:150" },
{"violet", S("violet"), "#6000ff:150" },
{"black", S("black"), "#000000:200" },
{"dark_grey", S("dark grey"), "#202020:200" },
{"grey", S("grey"), "#c0c0c0:150" },
{"white", S("white"), "#ffffff:150" },
}
local shutter_cbox = {
@ -23,10 +23,8 @@ local shutter_cbox = {
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 }
}
for i in ipairs(shutters) do
local name = shutters[i][1]
local desc = shutters[i][2]
local hue = shutters[i][3]
for _, s in ipairs(shutters) do
local name, desc, hue = unpack(s)
local tile = "homedecor_window_shutter.png^[colorize:"..hue
local inv = "homedecor_window_shutter_inv.png^[colorize:"..hue
@ -34,7 +32,7 @@ for i in ipairs(shutters) do
homedecor.register("shutter_"..name, {
mesh = "homedecor_window_shutter.obj",
tiles = { tile },
description = S("Wooden Shutter ("..desc..")"),
description = S("Wooden Shutter (@1)", desc),
inventory_image = inv,
wield_image = inv,
paramtype2 = "wallmounted",

View File

@ -3,8 +3,16 @@ local S = homedecor.gettext
-- Various kinds of tables
local materials = {
{"glass","Glass"},
{"wood","Wood"}
{ "glass",
S("Small square glass table"),
S("Small round glass table"),
S("Large glass table piece"),
},
{ "wood",
S("Small square wooden table"),
S("Small round wooden table"),
S("Large wooden table piece"),
}
}
local tables_cbox = {
@ -12,9 +20,8 @@ local tables_cbox = {
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
}
for i in ipairs(materials) do
local m = materials[i][1]
local d = materials[i][2]
for i, mat in ipairs(materials) do
local m, small_s, small_r, large = unpack(mat)
local s
if m == "glass" then
@ -26,7 +33,7 @@ for i in ipairs(materials) do
-- small square tables
homedecor.register(m.."_table_small_square", {
description = S(d.." Table (Small, Square)"),
description = small_s,
mesh = "homedecor_table_small_square.obj",
tiles = { 'homedecor_'..m..'_table_small_square.png' },
wield_image = 'homedecor_'..m..'_table_small_square_inv.png',
@ -41,7 +48,7 @@ for i in ipairs(materials) do
-- small round tables
homedecor.register(m..'_table_small_round', {
description = S(d.." Table (Small, Round)"),
description = small_r,
mesh = "homedecor_table_small_round.obj",
tiles = { "homedecor_"..m.."_table_small_round.png" },
wield_image = 'homedecor_'..m..'_table_small_round_inv.png',
@ -56,7 +63,7 @@ for i in ipairs(materials) do
-- Large square table pieces
homedecor.register(m..'_table_large', {
description = S(d.." Table Piece (large)"),
description = large,
tiles = {
'homedecor_'..m..'_table_large_tb.png',
'homedecor_'..m..'_table_large_tb.png',
@ -154,15 +161,20 @@ homedecor.register("utility_table_top", {
-- Various kinds of table legs
materials = {"brass", "wrought_iron"}
-- local above
materials = {
{ "brass", S("brass") },
{ "wrought_iron", S("wrought iron") },
}
for _, t in ipairs(materials) do
homedecor.register("table_legs_"..t, {
description = S("Table Legs ("..t..")"),
local name, desc = unpack(t)
homedecor.register("table_legs_"..name, {
description = S("Table Legs (@1)", desc),
drawtype = "plantlike",
tiles = {"homedecor_table_legs_"..t..".png"},
inventory_image = "homedecor_table_legs_"..t..".png",
wield_image = "homedecor_table_legs_"..t..".png",
tiles = {"homedecor_table_legs_"..name..".png"},
inventory_image = "homedecor_table_legs_"..name..".png",
wield_image = "homedecor_table_legs_"..name..".png",
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),

View File

@ -1,7 +1,10 @@
local S = homedecor.gettext
local function N_(x) return x end
homedecor.register("window_quartered", {
description = "Window (quartered)",
description = S("Window (quartered)"),
tiles = {
"homedecor_window_sides.png",
"homedecor_window_sides.png",
@ -32,7 +35,7 @@ homedecor.register("window_quartered", {
})
homedecor.register("window_plain", {
description = "Window (plain)",
description = S("Window (plain)"),
tiles = {
"homedecor_window_sides.png",
"homedecor_window_sides.png",
@ -66,7 +69,7 @@ local wb1_cbox = {
}
homedecor.register("blinds_thick", {
description = "Window Blinds (thick)",
description = S("Window Blinds (thick)"),
mesh = "homedecor_windowblind_thick.obj",
inventory_image = "homedecor_windowblind_thick_inv.png",
tiles = {
@ -85,7 +88,7 @@ local wb2_cbox = {
}
homedecor.register("blinds_thin", {
description = "Window Blinds (thin)",
description = S("Window Blinds (thin)"),
mesh = "homedecor_windowblind_thin.obj",
inventory_image = "homedecor_windowblind_thin_inv.png",
tiles = {
@ -99,21 +102,19 @@ homedecor.register("blinds_thin", {
})
local curtaincolors = {
{ "red", "#ad2323e0:175" },
{ "green", "#27a927e0:175" },
{ "blue", "#2626c6e0:175" },
{ "white", "#ffffffe0:175" },
{ "pink", "#ff8fb7e0:175" },
{ "violet", "#7f29d7e0:175" },
{ N_("red"), "#ad2323e0:175" },
{ N_("green"), "#27a927e0:175" },
{ N_("blue"), "#2626c6e0:175" },
{ N_("white"), "#ffffffe0:175" },
{ N_("pink"), "#ff8fb7e0:175" },
{ N_("violet"), "#7f29d7e0:175" },
}
for c in ipairs(curtaincolors) do
local color = curtaincolors[c][1]
local hue = curtaincolors[c][2]
local color_d = S(curtaincolors[c][1])
for _, c in ipairs(curtaincolors) do
local color, hue = unpack(c)
homedecor.register("curtain_"..color, {
description = S("Curtains (%s)"):format(color_d),
description = S("Curtains (@1)", S(color)),
tiles = { "homedecor_curtain.png^[colorize:"..hue },
inventory_image = "homedecor_curtain.png^[colorize:"..hue,
wield_image = "homedecor_curtain.png^[colorize:"..hue,
@ -124,10 +125,10 @@ for c in ipairs(curtaincolors) do
sounds = default.node_sound_leaves_defaults(),
paramtype2 = 'wallmounted',
selection_box = { type = "wallmounted" },
-- Open the curtains
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
-- Open the curtains
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_open_"..color, param2 = fdir })
end
@ -136,7 +137,7 @@ for c in ipairs(curtaincolors) do
})
homedecor.register("curtain_open_"..color, {
description = S("Curtains (%s)"):format(color_d),
description = S("Curtains (@1)", S(color)),
tiles = { "homedecor_curtain_open.png^[colorize:"..hue },
inventory_image = "homedecor_curtain_open.png^[colorize:"..hue,
wield_image = "homedecor_curtain_open.png^[colorize:"..hue,
@ -147,10 +148,10 @@ for c in ipairs(curtaincolors) do
sounds = default.node_sound_leaves_defaults(),
paramtype2 = 'wallmounted',
selection_box = { type = "wallmounted" },
-- Close the curtains
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
-- Close the curtains
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_"..color, param2 = fdir })
end
@ -161,19 +162,17 @@ for c in ipairs(curtaincolors) do
end
local mats = {
{ "brass", "Brass", "homedecor_generic_metal_brass.png" },
{ "wrought_iron", "Wrought iron", "homedecor_generic_metal_wrought_iron.png" },
{ "wood", "Wooden", "default_wood.png" }
{ "brass", S("brass"), "homedecor_generic_metal_brass.png" },
{ "wrought_iron", S("wrought iron"), "homedecor_generic_metal_wrought_iron.png" },
{ "wood", S("wood"), "default_wood.png" }
}
for i in ipairs(mats) do
local material = mats[i][1]
local mat_name = mats[i][2]
local texture = mats[i][3]
for _, m in ipairs(mats) do
local material, mat_name, texture = unpack(m)
homedecor.register("curtainrod_"..material, {
tiles = { texture },
inventory_image = "homedecor_curtainrod_"..material.."_inv.png",
description = "Curtain Rod ("..mat_name..")",
description = S("Curtain Rod (@1)", mat_name),
groups = { snappy = 3 },
node_box = {
type = "fixed",
@ -187,7 +186,7 @@ for i in ipairs(mats) do
end
homedecor.register("window_flowerbox", {
description = "Window flowerbow",
description = S("Window flowerbox"),
tiles = {
"homedecor_flowerbox_top.png",
"homedecor_flowerbox_bottom.png",
@ -207,7 +206,7 @@ homedecor.register("window_flowerbox", {
})
homedecor.register("stained_glass", {
description = "Stained Glass",
description = S("Stained Glass"),
tiles = {"homedecor_stained_glass.png"},
inventory_image = "homedecor_stained_glass.png",
groups = {snappy=3},