mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2025-07-22 23:30:21 +02:00
Use new intllib API.
This commit is contained in:
@ -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},
|
||||
|
Reference in New Issue
Block a user