1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
local S = homedecor.gettext
homedecor.register("window_quartered", {
description = "Window (quartered)",
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,
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
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
{-0.5, -0.0625, -0.025, 0.5, 0.0625, 0.025}, -- NodeBox4
{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
{-0.0625, -0.5, -0.025, 0.0625, 0.5, 0.025}, -- NodeBox7
}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
}
})
homedecor.register("window_plain", {
description = "Window (plain)",
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,
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
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
{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
}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
}
})
local wb1_cbox = {
type = "fixed",
fixed = { -8/16, -8/16, 5/16, 8/16, 8/16, 8/16 },
}
homedecor.register("blinds_thick", {
description = "Window Blinds (thick)",
mesh = "homedecor_windowblind_thick.obj",
inventory_image = "homedecor_windowblind_thick_inv.png",
tiles = {
"homedecor_windowblind_strings.png",
"homedecor_windowblinds.png"
},
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = wb1_cbox
})
local wb2_cbox = {
type = "fixed",
fixed = { -8/16, -8/16, 6/16, 8/16, 8/16, 8/16 },
}
homedecor.register("blinds_thin", {
description = "Window Blinds (thin)",
mesh = "homedecor_windowblind_thin.obj",
inventory_image = "homedecor_windowblind_thin_inv.png",
tiles = {
"homedecor_windowblind_strings.png",
"homedecor_windowblinds.png"
},
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = wb2_cbox
})
local curtaincolors = {
{ "red", "#ad2323e0:175" },
{ "green", "#27a927e0:175" },
{ "blue", "#2626c6e0:175" },
{ "white", "#ffffffe0:175" },
{ "pink", "#ff8fb7e0:175" },
{ "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])
homedecor.register("curtain_"..color, {
description = S("Curtains (%s)"):format(color_d),
tiles = { "homedecor_curtain.png^[colorize:"..hue },
inventory_image = "homedecor_curtain.png^[colorize:"..hue,
wield_image = "homedecor_curtain.png^[colorize:"..hue,
drawtype = 'signlike',
use_texture_alpha = true,
walkable = false,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
paramtype2 = 'wallmounted',
selection_box = { type = "wallmounted" },
-- Open the curtains
on_rightclick = function(pos, node, clicker, itemstack)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_open_"..color, param2 = fdir })
end
end
})
homedecor.register("curtain_open_"..color, {
description = S("Curtains (%s)"):format(color_d),
tiles = { "homedecor_curtain_open.png^[colorize:"..hue },
inventory_image = "homedecor_curtain_open.png^[colorize:"..hue,
wield_image = "homedecor_curtain_open.png^[colorize:"..hue,
drawtype = 'signlike',
use_texture_alpha = true,
walkable = false,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
paramtype2 = 'wallmounted',
selection_box = { type = "wallmounted" },
-- Close the curtains
on_rightclick = function(pos, node, clicker, itemstack)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_"..color, param2 = fdir })
end
end
})
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" }
}
for i in ipairs(mats) do
local material = mats[i][1]
local mat_name = mats[i][2]
local texture = mats[i][3]
homedecor.register("curtainrod_"..material, {
tiles = { texture },
inventory_image = "homedecor_curtainrod_"..material.."_inv.png",
description = "Curtain Rod ("..mat_name..")",
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
homedecor.register("window_flowerbox", {
description = "Window flowerbow",
tiles = {
"homedecor_flowerbox_top.png",
"homedecor_flowerbox_bottom.png",
"homedecor_flowerbox_sides.png"
},
inventory_image = "homedecor_flowerbox_inv.png",
sounds = default.node_sound_stone_defaults(),
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.375, 0.25, -0.125, 0.375, 0.5, 0.375}, -- NodeBox1
{-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
}
}
})
homedecor.register("stained_glass", {
description = "Stained Glass",
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} }
}
})
|