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

View File

@ -222,7 +222,7 @@ homedecor.register("shower_head", {
"homedecor_shower_head.png" "homedecor_shower_head.png"
}, },
inventory_image = "homedecor_shower_head_inv.png", inventory_image = "homedecor_shower_head_inv.png",
description = "Shower Head", description = S("Shower Head"),
groups = {snappy=3}, groups = {snappy=3},
selection_box = sh_cbox, selection_box = sh_cbox,
walkable = false, walkable = false,
@ -262,7 +262,7 @@ homedecor.register("bathroom_set", {
"homedecor_bathroom_set_toothpaste.png", "homedecor_bathroom_set_toothpaste.png",
}, },
inventory_image = "homedecor_bathroom_set_inv.png", inventory_image = "homedecor_bathroom_set_inv.png",
description = "Bathroom sundries set", description = S("Bathroom sundries set"),
groups = {snappy=3}, groups = {snappy=3},
selection_box = bs_cbox, selection_box = bs_cbox,
walkable = false, 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 = { local bedcolors = {
{ "black", "#000000:200" }, --new cg72 { S("black"), "black", "#000000:200" }, --new cg72
{ "brown", "#603010:175" }, { S("brown"), "brown", "#603010:175" },
{ "blue", "#0000d0:150" }, { S("blue"), "blue", "#0000d0:150" },
{ "cyan", "#009fa7:150" }, --new cg72 { S("cyan"), "cyan", "#009fa7:150" }, --new cg72
{ "darkgrey", "#101010:175" }, { S("dark grey"), "darkgrey", "#101010:175" },
{ "dark_green", "#007000:150" }, { S("dark green"), "dark_green", "#007000:150" },
{ "green", "#00d000:150" }, --new cg72 { S("green"), "green", "#00d000:150" }, --new cg72
{ "grey", "#101010:100" }, --new cg72 { S("grey"), "grey", "#101010:100" }, --new cg72
{ "magenta", "#e0048b:150" }, --new cg72 { S("magenta"), "magenta", "#e0048b:150" }, --new cg72
{ "orange", "#ff3000:150" }, { S("orange"), "orange", "#ff3000:150" },
{ "pink", "#ff80b0:150" }, { S("pink"), "pink", "#ff80b0:150" },
{ "red", "#d00000:150" }, { S("red"), "red", "#d00000:150" },
{ "violet", "#7000e0:150" }, { S("violet"), "violet", "#7000e0:150" },
{ "white", "#000000:000" }, --new cg72 { S("white"), "white", "#000000:000" }, --new cg72
{ "yellow", "#ffe000:150" } { S("yellow"), "yellow", "#ffe000:150" }
} }
local bed_sbox = { local bed_sbox = {
@ -46,10 +49,9 @@ local kbed_cbox = {
} }
} }
for i in ipairs(bedcolors) do for _, c in ipairs(bedcolors) do
local color = bedcolors[i][1] local colordesc, color, hue = unpack(c)
local color2=color local color2=color
local hue = bedcolors[i][2]
if color == "darkgrey" then if color == "darkgrey" then
color2 = "dark_grey" color2 = "dark_grey"
@ -65,7 +67,7 @@ for i in ipairs(bedcolors) do
"wool_"..color2..".png^[brighten", -- pillow "wool_"..color2..".png^[brighten", -- pillow
}, },
inventory_image = "homedecor_bed_inv.png^(homedecor_bed_overlay_inv.png^[colorize:"..hue..")", 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}, groups = {snappy=3},
selection_box = bed_sbox, selection_box = bed_sbox,
collision_box = bed_cbox, 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..")", inventory_image = "homedecor_bed_kingsize_inv.png^(homedecor_bed_kingsize_overlay_inv.png^[colorize:"..hue..")",
groups = {snappy=3, not_in_creative_inventory=1}, 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}, groups = {snappy=3, not_in_creative_inventory=1},
selection_box = kbed_sbox, selection_box = kbed_sbox,
collision_box = kbed_cbox, collision_box = kbed_cbox,
@ -154,9 +156,9 @@ for i in ipairs(bedcolors) do
end end
for _, w in pairs({"mahogany", "oak"}) do for _, w in pairs({ N_("mahogany"), N_("oak") }) do
homedecor.register("nightstand_"..w.."_one_drawer", { 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', tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY', 'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX', 'homedecor_nightstand_'..w..'_lr.png^[transformFX',
@ -185,7 +187,7 @@ for _, w in pairs({"mahogany", "oak"}) do
}) })
homedecor.register("nightstand_"..w.."_two_drawers", { 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', tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY', 'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX', 'homedecor_nightstand_'..w..'_lr.png^[transformFX',

View File

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

View File

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

View File

@ -109,23 +109,23 @@ minetest.register_craftitem("homedecor:steel_strip", {
}) })
minetest.register_craftitem(":glooptest:chainlink", { minetest.register_craftitem(":glooptest:chainlink", {
description = "Steel chainlink", description = S("Steel chainlink"),
inventory_image = "homedecor_chainlink_steel.png" inventory_image = "homedecor_chainlink_steel.png"
}) })
minetest.register_craftitem("homedecor:chainlink_brass", { minetest.register_craftitem("homedecor:chainlink_brass", {
description = "Brass chainlink", description = S("Brass chainlink"),
inventory_image = "homedecor_chainlink_brass.png" inventory_image = "homedecor_chainlink_brass.png"
}) })
minetest.register_craftitem("homedecor:soda_can", { minetest.register_craftitem("homedecor:soda_can", {
description = "Soda Can", description = S("Soda Can"),
inventory_image = "homedecor_soda_can.png", inventory_image = "homedecor_soda_can.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
}) })
minetest.register_craftitem("homedecor:coin", { 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", inventory_image = "homedecor_coin.png",
}) })

View File

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

View File

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

View File

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

View File

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

View File

@ -1,21 +1,17 @@
local S = homedecor.gettext local S = homedecor.gettext
local table_colors = { local table_colors = {
{ "", homedecor.plain_wood }, { "", S("Table"), homedecor.plain_wood },
{ "_mahogany", homedecor.mahogany_wood }, { "_mahogany", S("Mahogany Table"), homedecor.mahogany_wood },
{ "_white", homedecor.white_wood } { "_white", S("White Table"), homedecor.white_wood }
} }
for i in ipairs(table_colors) do for _, t in ipairs(table_colors) do
local desc = S("Table ("..i..")") local suffix, desc, texture = unpack(t)
if i == 1 then homedecor.register("table"..suffix, {
desc = S("Table")
end
homedecor.register("table"..table_colors[i][1], {
description = desc, description = desc,
tiles = { table_colors[i][2] }, tiles = { texture },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
@ -36,13 +32,13 @@ for i in ipairs(table_colors) do
end end
local chaircolors = { local chaircolors = {
{ "", "plain" }, { "", S("plain") },
{ "black", "Black" }, { "black", S("black") },
{ "red", "Red" }, { "red", S("red") },
{ "pink", "Pink" }, { "pink", S("pink") },
{ "violet", "Violet" }, { "violet", S("violet") },
{ "blue", "Blue" }, { "blue", S("blue") },
{ "dark_green", "Dark Green" }, { "dark_green", S("dark green") },
} }
local kc_cbox = { 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 woolcolor, colordesc = unpack(t)
local color2 = chaircolors[i][1] local color = woolcolor
local name = S(chaircolors[i][2]) local chairtiles
local chairtiles = {
homedecor.plain_wood,
"wool"..color..".png",
}
if chaircolors[i][1] == "" then if woolcolor == "" then
color = ""
chairtiles = { chairtiles = {
homedecor.plain_wood, homedecor.plain_wood,
homedecor.plain_wood homedecor.plain_wood
} }
else
color = "_"..woolcolor
chairtiles = {
homedecor.plain_wood,
"wool"..color..".png",
}
end end
homedecor.register("chair"..color, { homedecor.register("chair"..color, {
description = S("Kitchen chair (%s)"):format(name), description = S("Kitchen chair (@1)", colordesc),
mesh = "homedecor_kitchen_chair.obj", mesh = "homedecor_kitchen_chair.obj",
tiles = chairtiles, tiles = chairtiles,
selection_box = kc_cbox, selection_box = kc_cbox,
@ -93,7 +90,7 @@ for i in ipairs(chaircolors) do
if color ~= "" then if color ~= "" then
homedecor.register("armchair"..color, { homedecor.register("armchair"..color, {
description = S("Armchair (%s)"):format(name), description = S("Armchair (@1)", colordesc),
mesh = "forniture_armchair.obj", mesh = "forniture_armchair.obj",
tiles = { tiles = {
"wool"..color..".png", "wool"..color..".png",
@ -108,9 +105,9 @@ for i in ipairs(chaircolors) do
minetest.register_craft({ minetest.register_craft({
output = "homedecor:armchair"..color.." 2", output = "homedecor:armchair"..color.." 2",
recipe = { recipe = {
{ "wool:"..color2,""}, { "wool:"..woolcolor,""},
{ "group:wood","group:wood" }, { "group:wood","group:wood" },
{ "wool:"..color2,"wool:"..color2 }, { "wool:"..woolcolor,"wool:"..woolcolor },
}, },
}) })
end end
@ -122,7 +119,7 @@ local ob_cbox = {
} }
minetest.register_node(":homedecor:openframe_bookshelf", { minetest.register_node(":homedecor:openframe_bookshelf", {
description = "Bookshelf (open-frame)", description = S("Bookshelf (open-frame)"),
drawtype = "mesh", drawtype = "mesh",
mesh = "homedecor_openframe_bookshelf.obj", mesh = "homedecor_openframe_bookshelf.obj",
tiles = { tiles = {
@ -138,7 +135,7 @@ minetest.register_node(":homedecor:openframe_bookshelf", {
}) })
homedecor.register("wall_shelf", { homedecor.register("wall_shelf", {
description = "Wall Shelf", description = S("Wall Shelf"),
tiles = { tiles = {
"homedecor_wood_table_large_edges.png", "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 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 furnace_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -106,7 +106,7 @@ function homedecor.register_furnace(name, furnacedef)
if listname == "fuel" then if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") 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 end
return stack:get_count() return stack:get_count()
else else
@ -125,7 +125,7 @@ function homedecor.register_furnace(name, furnacedef)
if to_list == "fuel" then if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") 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 end
return count return count
else else
@ -151,7 +151,7 @@ function homedecor.register_furnace(name, furnacedef)
} }
local def_active = { local def_active = {
description = description .. " (active)", description = S("@1 (active)", description),
tiles = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true), tiles = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true),
light_source = 8, light_source = 8,
drop = "homedecor:" .. name, 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 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") / local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100) 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) swap_node(pos,name_active..locked)
meta:set_string("formspec", make_formspec(furnacedef, percent)) meta:set_string("formspec", make_formspec(furnacedef, percent))
return return
@ -251,7 +251,7 @@ function homedecor.register_furnace(name, furnacedef)
end end
if (not fuel) or (fuel.time <= 0) then 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) swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0)) meta:set_string("formspec", make_formspec(furnacedef, 0))
return return
@ -259,7 +259,7 @@ function homedecor.register_furnace(name, furnacedef)
if cooked.item:is_empty() then if cooked.item:is_empty() then
if was_active 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) swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0)) meta:set_string("formspec", make_formspec(furnacedef, 0))
end end
@ -267,7 +267,7 @@ function homedecor.register_furnace(name, furnacedef)
end end
if not inv:room_for_item("dst", cooked.item) then 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) swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0)) meta:set_string("formspec", make_formspec(furnacedef, 0))
return 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.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) 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) player:get_player_name(), name, minetest.pos_to_string(pos)
)) ))
end end
def.on_metadata_inventory_put = def.on_metadata_inventory_put or function(pos, listname, index, stack, player) 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) player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)
)) ))
end end
def.on_metadata_inventory_take = def.on_metadata_inventory_take or function(pos, listname, index, stack, player) 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) player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)
)) ))
end end
@ -107,7 +107,7 @@ function homedecor.handle_inventory(name, def, original_def)
local owner = placer:get_player_name() or "" local owner = placer:get_player_name() or ""
meta:set_string("owner", owner) 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) return after_place_node and after_place_node(pos, placer)
end end
@ -124,7 +124,7 @@ function homedecor.handle_inventory(name, def, original_def)
count count
end 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) playername, name, owner, minetest.pos_to_string(pos)
)) ))
return 0 return 0
@ -142,7 +142,7 @@ function homedecor.handle_inventory(name, def, original_def)
stack:get_count() stack:get_count()
end 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) playername, name, owner, minetest.pos_to_string(pos)
)) ))
return 0 return 0
@ -160,7 +160,7 @@ function homedecor.handle_inventory(name, def, original_def)
stack:get_count() stack:get_count()
end 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) playername, name, owner, minetest.pos_to_string(pos)
)) ))
return 0 return 0
@ -170,7 +170,7 @@ function homedecor.handle_inventory(name, def, original_def)
local lockable = inventory.lockable local lockable = inventory.lockable
if lockable then if lockable then
local locked_def = table.copy(original_def) 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 local locked_inventory = locked_def.inventory
locked_inventory.locked = true locked_inventory.locked = true

View File

@ -9,11 +9,14 @@
local modpath = minetest.get_modpath("homedecor") local modpath = minetest.get_modpath("homedecor")
-- Load support for intllib.
local S, NS = dofile(modpath.."/intllib.lua")
homedecor = { homedecor = {
modpath = modpath, modpath = modpath,
-- Boilerplate to support localized strings if intllib mod is installed. gettext = S,
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end, ngettext = NS,
-- infinite stacks -- infinite stacks
expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory") 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") 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 S = homedecor.gettext
local function N_(x) return x end
-- steel-textured fridge -- steel-textured fridge
homedecor.register("refrigerator_steel", { homedecor.register("refrigerator_steel", {
mesh = "homedecor_refrigerator.obj", mesh = "homedecor_refrigerator.obj",
@ -112,7 +114,7 @@ homedecor.register("coffee_maker", {
"homedecor_coffeemaker_cup.png", "homedecor_coffeemaker_cup.png",
"homedecor_coffeemaker_case.png", "homedecor_coffeemaker_case.png",
}, },
description = "Coffee Maker", description = S("Coffee Maker"),
inventory_image = "homedecor_coffeemaker_inv.png", inventory_image = "homedecor_coffeemaker_inv.png",
walkable = false, walkable = false,
groups = {snappy=3}, groups = {snappy=3},
@ -159,7 +161,7 @@ minetest.register_abm({
}) })
homedecor.register("toaster", { homedecor.register("toaster", {
description = "Toaster", description = S("Toaster"),
tiles = { "homedecor_toaster_sides.png" }, tiles = { "homedecor_toaster_sides.png" },
inventory_image = "homedecor_toaster_inv.png", inventory_image = "homedecor_toaster_inv.png",
walkable = false, walkable = false,
@ -211,7 +213,7 @@ homedecor.register("toaster_loaf", {
homedecor.register("dishwasher", { homedecor.register("dishwasher", {
description = "Dishwasher", description = S("Dishwasher"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
"homedecor_dishwasher_top.png", "homedecor_dishwasher_top.png",
@ -235,11 +237,11 @@ homedecor.register("dishwasher", {
groups = { snappy = 3 }, 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 for _, m in ipairs(materials) do
homedecor.register("dishwasher_"..m, { homedecor.register("dishwasher_"..m, {
description = "Dishwasher ("..m..")", description = S("Dishwasher (@1)", S(m)),
tiles = { tiles = {
"homedecor_kitchen_cabinet_top_"..m..".png", "homedecor_kitchen_cabinet_top_"..m..".png",
"homedecor_dishwasher_bottom.png", "homedecor_dishwasher_bottom.png",

View File

@ -2,17 +2,20 @@
local S = homedecor.gettext local S = homedecor.gettext
local counter_materials = { "", "granite", "marble", "steel" }
local cabinet_sides = "(default_wood.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png" 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 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 for _, mat in ipairs(counter_materials) do
local desc = S("Kitchen Cabinet") local desc = S("Kitchen Cabinet")
local material = "" local material = ""
if mat ~= "" then if mat ~= "" then
desc = S("Kitchen Cabinet ("..mat.." top)") desc = S("Kitchen Cabinet (@1 top)", S(mat))
material = "_"..mat material = "_"..mat
end end
@ -144,7 +147,7 @@ homedecor.register("paper_towel", {
"default_wood.png" "default_wood.png"
}, },
inventory_image = "homedecor_paper_towel_inv.png", inventory_image = "homedecor_paper_towel_inv.png",
description = "Paper towels", description = S("Paper towels"),
groups = { snappy=3 }, groups = { snappy=3 },
walkable = false, walkable = false,
selection_box = { selection_box = {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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