2017-01-24 21:43:20 +01:00
|
|
|
|
2017-01-30 00:12:02 +01:00
|
|
|
local S = homedecor_i18n.gettext
|
2014-08-10 23:37:58 +02:00
|
|
|
|
2017-01-24 21:43:20 +01:00
|
|
|
local function N_(x) return x end
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("window_quartered", {
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Window (quartered)"),
|
2014-06-27 02:13:16 +02:00
|
|
|
tiles = {
|
|
|
|
"homedecor_window_sides.png",
|
|
|
|
"homedecor_window_sides.png",
|
|
|
|
"homedecor_window_sides.png",
|
|
|
|
"homedecor_window_sides.png",
|
|
|
|
"homedecor_window_quartered.png",
|
|
|
|
"homedecor_window_quartered.png"
|
|
|
|
},
|
|
|
|
use_texture_alpha = true,
|
2015-01-20 12:13:45 +01:00
|
|
|
groups = {snappy=3},
|
|
|
|
sounds = default.node_sound_glass_defaults(),
|
2014-06-27 02:13:16 +02:00
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, 0.025, 0.5, 0.5, 0}, -- NodeBox1
|
|
|
|
{-0.5, 0.4375, -0.0625, 0.5, 0.5, 0.0625}, -- NodeBox2
|
|
|
|
{-0.5, -0.5, -0.0625, 0.5, -0.4375, 0.0625}, -- NodeBox3
|
2015-01-20 12:13:45 +01:00
|
|
|
{-0.5, -0.0625, -0.025, 0.5, 0.0625, 0.025}, -- NodeBox4
|
2014-06-27 02:13:16 +02:00
|
|
|
{0.4375, -0.5, -0.0625, 0.5, 0.5, 0.0625}, -- NodeBox5
|
|
|
|
{-0.5, -0.5, -0.0625, -0.4375, 0.5, 0.0625}, -- NodeBox6
|
2015-01-20 12:13:45 +01:00
|
|
|
{-0.0625, -0.5, -0.025, 0.0625, 0.5, 0.025}, -- NodeBox7
|
2015-04-30 11:48:15 +02:00
|
|
|
}
|
|
|
|
},
|
2014-06-27 02:13:16 +02:00
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2015-04-30 11:48:15 +02:00
|
|
|
fixed = {-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
|
|
|
|
}
|
2014-06-27 02:13:16 +02:00
|
|
|
})
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("window_plain", {
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Window (plain)"),
|
2014-06-27 02:13:16 +02:00
|
|
|
tiles = {
|
|
|
|
"homedecor_window_sides.png",
|
|
|
|
"homedecor_window_sides.png",
|
|
|
|
"homedecor_window_sides.png",
|
|
|
|
"homedecor_window_sides.png",
|
|
|
|
"homedecor_window_frame.png",
|
|
|
|
"homedecor_window_frame.png"
|
|
|
|
},
|
|
|
|
use_texture_alpha = true,
|
2015-01-20 12:13:45 +01:00
|
|
|
groups = {snappy=3},
|
|
|
|
sounds = default.node_sound_glass_defaults(),
|
2014-06-27 02:13:16 +02:00
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, 0.025, 0.5, 0.5, 0}, -- NodeBox1
|
|
|
|
{-0.5, 0.4375, -0.0625, 0.5, 0.5, 0.0625}, -- NodeBox2
|
|
|
|
{-0.5, -0.5, -0.0625, 0.5, -0.4375, 0.0625}, -- NodeBox3
|
2015-01-20 12:13:45 +01:00
|
|
|
{0.4375, -0.5, -0.0625, 0.5, 0.5, 0.0625}, -- NodeBox4
|
|
|
|
{-0.5, -0.5, -0.0625, -0.4375, 0.5, 0.0625}, -- NodeBox5
|
2015-04-30 11:48:15 +02:00
|
|
|
}
|
|
|
|
},
|
2014-06-27 02:13:16 +02:00
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2015-04-30 11:48:15 +02:00
|
|
|
fixed = {-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
|
|
|
|
}
|
2014-06-27 02:13:16 +02:00
|
|
|
})
|
|
|
|
|
2015-03-29 07:48:10 +02:00
|
|
|
local wb1_cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -8/16, -8/16, 5/16, 8/16, 8/16, 8/16 },
|
|
|
|
}
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("blinds_thick", {
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Window Blinds (thick)"),
|
2015-03-29 07:48:10 +02:00
|
|
|
mesh = "homedecor_windowblind_thick.obj",
|
2015-03-29 13:13:17 +02:00
|
|
|
inventory_image = "homedecor_windowblind_thick_inv.png",
|
2015-03-29 07:48:10 +02:00
|
|
|
tiles = {
|
|
|
|
"homedecor_windowblind_strings.png",
|
|
|
|
"homedecor_windowblinds.png"
|
|
|
|
},
|
2014-06-27 02:13:16 +02:00
|
|
|
walkable = false,
|
2015-01-20 12:13:45 +01:00
|
|
|
groups = {snappy=3},
|
2015-01-20 19:49:46 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2015-04-30 11:48:15 +02:00
|
|
|
selection_box = wb1_cbox
|
2014-06-27 02:13:16 +02:00
|
|
|
})
|
|
|
|
|
2015-03-29 07:48:10 +02:00
|
|
|
local wb2_cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -8/16, -8/16, 6/16, 8/16, 8/16, 8/16 },
|
|
|
|
}
|
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("blinds_thin", {
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Window Blinds (thin)"),
|
2015-03-29 07:48:10 +02:00
|
|
|
mesh = "homedecor_windowblind_thin.obj",
|
2015-05-27 21:19:49 +02:00
|
|
|
inventory_image = "homedecor_windowblind_thin_inv.png",
|
2015-03-29 07:48:10 +02:00
|
|
|
tiles = {
|
|
|
|
"homedecor_windowblind_strings.png",
|
|
|
|
"homedecor_windowblinds.png"
|
|
|
|
},
|
2014-06-27 02:13:16 +02:00
|
|
|
walkable = false,
|
2015-01-20 12:13:45 +01:00
|
|
|
groups = {snappy=3},
|
2015-01-20 19:49:46 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2015-04-30 11:48:15 +02:00
|
|
|
selection_box = wb2_cbox
|
2014-06-27 02:13:16 +02:00
|
|
|
})
|
|
|
|
|
2017-01-29 03:51:29 +01:00
|
|
|
minetest.register_node("homedecor:curtain_closed", {
|
|
|
|
description = S("Curtains"),
|
|
|
|
tiles = { "homedecor_curtain.png" },
|
|
|
|
inventory_image = "homedecor_curtain.png",
|
|
|
|
drawtype = 'signlike',
|
|
|
|
use_texture_alpha = true,
|
|
|
|
walkable = false,
|
2017-02-05 01:41:36 +01:00
|
|
|
groups = { snappy = 3, ud_param2_colorable = 1 },
|
2017-01-29 03:51:29 +01:00
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2017-01-31 01:58:39 +01:00
|
|
|
paramtype = "light",
|
2017-01-29 03:51:29 +01:00
|
|
|
paramtype2 = "colorwallmounted",
|
|
|
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
|
|
|
selection_box = { type = "wallmounted" },
|
|
|
|
after_dig_node = unifieddyes.after_dig_node,
|
2017-01-29 09:45:58 +01:00
|
|
|
after_place_node = homedecor.fix_rotation,
|
2017-01-29 03:51:29 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
|
|
local itemname = itemstack:get_name()
|
2017-02-05 01:41:36 +01:00
|
|
|
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", param2 = fdir })
|
2014-08-11 08:23:26 +02:00
|
|
|
end
|
2017-02-05 01:41:36 +01:00
|
|
|
return itemstack
|
2017-01-29 03:51:29 +01:00
|
|
|
end
|
|
|
|
})
|
2014-08-10 23:37:58 +02:00
|
|
|
|
2017-01-29 03:51:29 +01:00
|
|
|
minetest.register_node("homedecor:curtain_open", {
|
|
|
|
description = S("Curtains"),
|
|
|
|
tiles = { "homedecor_curtain_open.png" },
|
|
|
|
inventory_image = "homedecor_curtain_open.png",
|
|
|
|
drawtype = 'signlike',
|
|
|
|
use_texture_alpha = true,
|
|
|
|
walkable = false,
|
2017-02-05 01:41:36 +01:00
|
|
|
groups = { snappy = 3, ud_param2_colorable = 1 },
|
2017-01-29 03:51:29 +01:00
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2017-01-31 01:58:39 +01:00
|
|
|
paramtype = "light",
|
2017-01-29 03:51:29 +01:00
|
|
|
paramtype2 = "colorwallmounted",
|
|
|
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
|
|
|
selection_box = { type = "wallmounted" },
|
|
|
|
after_dig_node = unifieddyes.after_dig_node,
|
2017-01-29 09:45:58 +01:00
|
|
|
after_place_node = homedecor.fix_rotation,
|
2017-01-29 03:51:29 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
|
|
local itemname = itemstack:get_name()
|
2017-02-05 01:41:36 +01:00
|
|
|
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_closed", param2 = fdir })
|
2014-08-11 08:23:26 +02:00
|
|
|
end
|
2017-02-05 01:41:36 +01:00
|
|
|
return itemstack
|
2017-01-29 03:51:29 +01:00
|
|
|
end
|
|
|
|
})
|
2014-08-10 23:37:58 +02:00
|
|
|
|
|
|
|
local mats = {
|
2017-01-24 21:43:20 +01:00
|
|
|
{ "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" }
|
2014-08-10 23:37:58 +02:00
|
|
|
}
|
|
|
|
|
2017-01-24 21:43:20 +01:00
|
|
|
for _, m in ipairs(mats) do
|
|
|
|
local material, mat_name, texture = unpack(m)
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("curtainrod_"..material, {
|
2014-08-10 23:37:58 +02:00
|
|
|
tiles = { texture },
|
|
|
|
inventory_image = "homedecor_curtainrod_"..material.."_inv.png",
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Curtain Rod (@1)", mat_name),
|
2014-08-10 23:37:58 +02:00
|
|
|
groups = { snappy = 3 },
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, 0.375, 0.5, -0.4375, 0.4375},
|
|
|
|
{-0.4375, -0.5, 0.4375, -0.375, -0.4375, 0.5},
|
|
|
|
{0.375, -0.5, 0.4375, 0.4375, -0.4375, 0.5}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
2014-09-11 14:01:48 +02:00
|
|
|
|
2015-01-24 00:34:02 +01:00
|
|
|
homedecor.register("window_flowerbox", {
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Window flowerbox"),
|
2014-09-11 14:01:48 +02:00
|
|
|
tiles = {
|
|
|
|
"homedecor_flowerbox_top.png",
|
|
|
|
"homedecor_flowerbox_bottom.png",
|
|
|
|
"homedecor_flowerbox_sides.png"
|
|
|
|
},
|
|
|
|
inventory_image = "homedecor_flowerbox_inv.png",
|
2015-04-29 14:14:36 +02:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2014-09-11 14:01:48 +02:00
|
|
|
groups = { snappy = 3 },
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
2015-01-23 22:14:00 +01:00
|
|
|
{-0.375, 0.25, -0.125, 0.375, 0.5, 0.375}, -- NodeBox1
|
2014-09-11 14:01:48 +02:00
|
|
|
{-0.3125, 0.4375, 0.375, -0.25, 0.4875, 0.5}, -- NodeBox2
|
|
|
|
{0.25, 0.4375, 0.375, 0.3125, 0.4875, 0.5}, -- NodeBox3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2015-05-13 00:03:02 +02:00
|
|
|
|
|
|
|
homedecor.register("stained_glass", {
|
2017-01-24 21:43:20 +01:00
|
|
|
description = S("Stained Glass"),
|
2015-05-13 00:03:02 +02:00
|
|
|
tiles = {"homedecor_stained_glass.png"},
|
|
|
|
inventory_image = "homedecor_stained_glass.png",
|
|
|
|
groups = {snappy=3},
|
|
|
|
use_texture_alpha = true,
|
|
|
|
light_source = 3,
|
|
|
|
sounds = default.node_sound_glass_defaults(),
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { {-0.5, -0.5, 0.46875, 0.5, 0.5, 0.5} }
|
|
|
|
}
|
|
|
|
})
|
2017-01-29 03:51:29 +01:00
|
|
|
|
|
|
|
-- Convert old curtain nodes to param2-colorization
|
|
|
|
|
|
|
|
local curtaincolors = {
|
|
|
|
{ N_("red"), "ad2323" },
|
|
|
|
{ N_("green"), "27a927" },
|
|
|
|
{ N_("blue"), "2626c6" },
|
|
|
|
{ N_("white"), "ffffff" },
|
|
|
|
{ N_("pink"), "ff8fb7" },
|
|
|
|
{ N_("violet"), "7f29d7" },
|
|
|
|
}
|
|
|
|
|
|
|
|
homedecor.old_static_curtain_nodes = {}
|
|
|
|
|
|
|
|
for _, i in ipairs(curtaincolors) do
|
|
|
|
local color,hue = unpack(i)
|
|
|
|
table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_"..color)
|
|
|
|
table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_open_"..color)
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_lbm({
|
|
|
|
name = "homedecor:convert_curtains",
|
|
|
|
label = "Convert static curtain nodes to use param2 color",
|
|
|
|
run_at_every_load = true,
|
|
|
|
nodenames = homedecor.old_static_curtain_nodes,
|
|
|
|
action = function(pos, node)
|
|
|
|
local name = node.name
|
|
|
|
local color = string.sub(name, 19)
|
|
|
|
local openclose = "closed"
|
|
|
|
|
|
|
|
if string.find(color, "open") then
|
|
|
|
color = string.sub(color, 6)
|
|
|
|
openclose = "open"
|
|
|
|
end
|
|
|
|
|
|
|
|
local metadye = "medium_"..color
|
|
|
|
if color == "white" then
|
|
|
|
metadye = "white"
|
|
|
|
end
|
|
|
|
|
|
|
|
local newnode = "homedecor:curtain_"..openclose
|
|
|
|
local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..metadye, "wallmounted")
|
|
|
|
local newparam2 = paletteidx + (node.param2 % 8)
|
|
|
|
|
|
|
|
minetest.set_node(pos, { name = newnode, param2 = newparam2 })
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("dye", "unifieddyes:"..metadye)
|
|
|
|
end
|
|
|
|
})
|