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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
|
local S = homedecor.gettext
homedecor.register("ceiling_paint", {
description = S("Textured Ceiling Paint"),
drawtype = 'signlike',
tiles = { 'homedecor_ceiling_paint.png' },
inventory_image = 'homedecor_ceiling_paint_roller.png',
wield_image = 'homedecor_ceiling_paint_roller.png',
walkable = false,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
selection_box = { type = "wallmounted" },
})
homedecor.register("ceiling_tile", {
description = S("Drop-Ceiling Tile"),
drawtype = 'signlike',
tiles = { 'homedecor_ceiling_tile.png' },
wield_image = 'homedecor_ceiling_tile.png',
inventory_image = 'homedecor_ceiling_tile.png',
walkable = false,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
selection_box = { type = "wallmounted" },
})
local rug_types = {
{ "small", "homedecor_small_rug.obj" },
{ "large", homedecor.box.slab_y(0.0625)},
{ "persian", homedecor.box.slab_y(0.0625)}
}
for i in ipairs(rug_types) do
s = rug_types[i][1]
m = rug_types[i][2]
local mesh = m
local nodebox = nil
local tiles = { "homedecor_rug_"..s..".png", "wool_grey.png" }
if type(m) == "table" then
mesh = nil
nodebox = {
type = "fixed",
fixed = m
}
tiles = {
"homedecor_rug_"..s..".png",
"wool_grey.png",
"homedecor_rug_"..s..".png"
}
end
homedecor.register("rug_"..s, {
description = S("Rug ("..s..")"),
mesh = mesh,
tiles = tiles,
node_box = nodebox,
paramtype2 = "wallmounted",
walkable = false,
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
selection_box = { type = "wallmounted" },
})
end
local pot_colors = {"black", "green", "terracotta"}
for _, p in ipairs(pot_colors) do
homedecor.register("flower_pot_"..p, {
description = S("Flower Pot ("..p..")"),
mesh = "homedecor_flowerpot.obj",
tiles = {
"homedecor_flower_pot_"..p..".png",
"default_dirt.png^[colorize:#000000:175"
},
groups = { snappy = 3, potting_soil=1 },
sounds = default.node_sound_stone_defaults(),
})
end
local flowers_list = {
{ "Rose", "rose", "flowers:rose" },
{ "Tulip", "tulip", "flowers:tulip" },
{ "Yellow Dandelion", "dandelion_yellow", "flowers:dandelion_yellow" },
{ "White Dandelion", "dandelion_white", "flowers:dandelion_white" },
{ "Blue Geranium", "geranium", "flowers:geranium" },
{ "Viola", "viola", "flowers:viola" },
{ "Cactus", "cactus", "default:cactus" },
{ "Bonsai", "bonsai", "default:sapling" }
}
for i in ipairs(flowers_list) do
local flowerdesc = flowers_list[i][1]
local flower = flowers_list[i][2]
local craftwith = flowers_list[i][3]
homedecor.register("potted_"..flower, {
description = S("Potted flower ("..flowerdesc..")"),
mesh = "homedecor_potted_plant.obj",
tiles = {
"homedecor_flower_pot_terracotta.png",
"default_dirt.png^[colorize:#000000:175",
"flowers_"..flower..".png"
},
walkable = false,
groups = {snappy = 3},
sounds = default.node_sound_glass_defaults(),
selection_box = {
type = "fixed",
fixed = { -0.2, -0.5, -0.2, 0.2, 0.3, 0.2 }
}
})
minetest.register_craft({
type = "shapeless",
output = "homedecor:potted_"..flower,
recipe = { craftwith, "homedecor:flower_pot_small" }
})
minetest.register_alias("flowers:flower_"..flower.."_pot", "homedecor:potted_"..flower)
minetest.register_alias("flowers:potted_"..flower, "homedecor:potted_"..flower)
minetest.register_alias("flowers:flower_pot", "homedecor:flower_pot_small")
end
homedecor.register("pole_brass", {
description = S("Brass Pole"),
mesh = "homedecor_round_pole.obj",
tiles = {"homedecor_generic_metal_brass.png^homedecor_generic_metal_lines_overlay.png",},
inventory_image = "homedecor_pole_brass_inv.png",
wield_image = "homedecor_pole_brass_inv.png",
selection_box = {
type = "fixed",
fixed = { -0.125, -0.5, -0.125, 0.125, 0.5, 0.125 },
},
collision_box = {
type = "fixed",
fixed = { -0.125, -0.5, -0.125, 0.125, 0.5, 0.125 },
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
})
homedecor.register("pole_wrought_iron", {
description = S("Wrought Iron Pole"),
tiles = { "homedecor_generic_metal_wrought_iron.png^homedecor_generic_metal_lines_overlay.png" },
inventory_image = "homedecor_pole_wrought_iron_inv.png",
wield_image = "homedecor_pole_wrought_iron_inv.png",
selection_box = {
type = "fixed",
fixed = {-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625}
},
node_box = {
type = "fixed",
fixed = {-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625}
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
})
local ft_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.375, 0.5, 0.3125, 0.375 }
}
homedecor.register("fishtank", {
description = "Fishtank",
mesh = "homedecor_fishtank.obj",
tiles = {
"homedecor_generic_plastic_black.png",
"homedecor_fishtank_filter.png",
"homedecor_fishtank_fishes.png",
"homedecor_fishtank_gravel.png",
"homedecor_fishtank_water_top.png",
"homedecor_fishtank_sides.png",
},
use_texture_alpha = true,
selection_box = ft_cbox,
collision_box = ft_cbox,
groups = {cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
on_rightclick = function(pos, node, clicker)
minetest.set_node(pos, {name = "homedecor:fishtank_lighted", param2 = node.param2})
end
})
homedecor.register("fishtank_lighted", {
description = "Fishtank (lighted)",
mesh = "homedecor_fishtank.obj",
tiles = {
"homedecor_generic_plastic_black.png",
"homedecor_fishtank_filter.png",
"homedecor_fishtank_fishes_lighted.png",
"homedecor_fishtank_gravel_lighted.png",
"homedecor_fishtank_water_top_lighted.png",
"homedecor_fishtank_sides_lighted.png",
},
light_source = LIGHT_MAX-4,
use_texture_alpha = true,
selection_box = ft_cbox,
collision_box = ft_cbox,
groups = {cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
sounds = default.node_sound_glass_defaults(),
on_rightclick = function(pos, node, clicker)
minetest.set_node(pos, {name = "homedecor:fishtank", param2 = node.param2})
end,
drop = "homedecor:fishtank",
})
homedecor.register("cardboard_box_big", {
description = S("Cardboard box (big)"),
tiles = {
'homedecor_cardbox_big_tb.png',
'homedecor_cardbox_big_tb.png',
'homedecor_cardbox_big_sides.png',
},
groups = { snappy = 3 },
infotext=S("Cardboard box"),
inventory = {
size=24,
},
})
homedecor.register("cardboard_box", {
description = S("Cardboard box"),
tiles = {
'homedecor_cardbox_tb.png',
'homedecor_cardbox_tb.png',
'homedecor_cardbox_sides.png',
},
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, 0, 0.3125},
}
},
groups = { snappy = 3 },
infotext=S("Cardboard box"),
inventory = {
size=8,
},
})
homedecor.register("dvd_cd_cabinet", {
description = "DVD/CD cabinet",
mesh = "homedecor_dvd_cabinet.obj",
tiles = {
"default_wood.png",
"homedecor_dvdcd_cabinet_front.png",
"homedecor_dvdcd_cabinet_back.png"
},
selection_box = homedecor.nodebox.slab_z(-0.5),
groups = {choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
})
local pooltable_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.3125, 1.5 }
}
homedecor.register("pool_table", {
mesh = "homedecor_pool_table.obj",
tiles = {
"homedecor_pool_table_cue.png",
"homedecor_pool_table_baize.png",
"homedecor_pool_table_pockets.png",
"homedecor_pool_table_balls.png",
"homedecor_generic_wood_luxury.png^[colorize:#000000:90"
},
description = "Pool Table",
inventory_image = "homedecor_pool_table_inv.png",
groups = {snappy=3},
selection_box = pooltable_cbox,
collision_box = pooltable_cbox,
expand = { forward="placeholder" },
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow
})
minetest.register_alias("homedecor:pool_table_2", "air")
local piano_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.125, 1.5, 0.5, 0.5 }
}
homedecor.register("piano", {
mesh = "homedecor_piano.obj",
tiles = {
"homedecor_generic_wood_luxury.png^[colorize:#000000:175",
"homedecor_piano_keys.png",
"homedecor_generic_metal_brass.png",
},
inventory_image = "homedecor_piano_inv.png",
description = "Piano",
groups = { snappy = 3 },
selection_box = piano_cbox,
collision_box = piano_cbox,
expand = { right="placeholder" },
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow
})
minetest.register_alias("homedecor:piano_left", "homedecor:piano")
minetest.register_alias("homedecor:piano_right", "air")
local tr_cbox = {
type = "fixed",
fixed = { -0.3125, -0.5, -0.1875, 0.3125, 0.125, 0.1875 }
}
homedecor.register("trophy", {
description = "Trophy",
mesh = "homedecor_trophy.obj",
tiles = {
"default_wood.png",
"homedecor_generic_metal_gold.png"
},
inventory_image = "homedecor_trophy_inv.png",
groups = { snappy=3 },
walkable = false,
selection_box = tr_cbox,
})
local sb_cbox = {
type = "fixed",
fixed = { -0.4, -0.5, -0.5, 0.4, 0.375, 0.5 }
}
homedecor.register("sportbench", {
description = "Sport bench",
mesh = "homedecor_sport_bench.obj",
tiles = {
"homedecor_generic_metal_wrought_iron.png",
"homedecor_generic_metal_bright.png",
"homedecor_generic_metal_black.png",
"wool_black.png"
},
inventory_image = "homedecor_sport_bench_inv.png",
groups = { snappy=3 },
selection_box = sb_cbox,
walkable = false,
sounds = default.node_sound_wood_defaults(),
})
local skate_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.15, 0.5, -0.3, 0.15 }
}
homedecor.register("skateboard", {
drawtype = "mesh",
mesh = "homedecor_skateboard.obj",
tiles = { "homedecor_skateboard.png" },
inventory_image = "homedecor_skateboard_inv.png",
description = "Skateboard",
groups = {snappy=3},
selection_box = skate_cbox,
walkable = false,
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
homedecor.register("tool_cabinet", {
description = "Metal tool cabinet and work table",
mesh = "homedecor_tool_cabinet.obj",
tiles = {
"homedecor_generic_metal_black.png^[colorize:#ff0000:150",
"homedecor_tool_cabinet_drawers.png",
"homedecor_generic_metal_black.png^[colorize:#006000:150",
"homedecor_generic_metal_black.png^[brighten",
"homedecor_generic_metal_bright.png",
"homedecor_tool_cabinet_misc.png",
},
inventory_image = "homedecor_tool_cabinet_inv.png",
on_rotate = screwdriver.rotate_simple,
groups = { snappy=3 },
selection_box = homedecor.nodebox.slab_y(2),
expand = { top="placeholder" },
inventory = {
size=24,
}
})
minetest.register_alias("homedecor:tool_cabinet_bottom", "homedecor:tool_cabinet")
minetest.register_alias("homedecor:tool_cabinet_top", "air")
local pframe_cbox = {
type = "fixed",
fixed = { -0.18, -0.5, -0.08, 0.18, -0.08, 0.18 }
}
local n = { 1, 2 }
for _, i in ipairs(n) do
homedecor.register("picture_frame"..i, {
description = S("Picture Frame"),
mesh = "homedecor_picture_frame.obj",
tiles = {
"homedecor_picture_frame_image"..i..".png",
"homedecor_generic_wood_luxury.png^[colorize:#000000:50",
"homedecor_picture_frame_back.png",
},
inventory_image = "homedecor_picture_frame"..i.."_inv.png",
wield_image = "homedecor_picture_frame"..i.."_inv.png",
groups = {snappy = 3},
selection_box = pframe_cbox,
walkable = false,
sounds = default.node_sound_glass_defaults()
})
end
local p_cbox = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 0.4375, 0.5, 0.5, 0.5 }
}
}
for i = 1,20 do
homedecor.register("painting_"..i, {
description = "Decorative painting #"..i,
mesh = "homedecor_painting.obj",
tiles = {
"default_wood.png",
"homedecor_blank_canvas.png",
"homedecor_painting"..i..".png"
},
selection_box = p_cbox,
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
})
end
homedecor.banister_materials = {
{ "wood",
"wood",
"default_wood.png",
"default_wood.png",
"group:wood",
"group:stick",
"",
""
},
{ "white_dark",
"dark topped",
homedecor.white_wood,
homedecor.dark_wood,
"group:wood",
"group:stick",
"dye:brown",
"dye:white"
},
{ "brass",
"brass",
homedecor.white_wood,
"homedecor_generic_metal_brass.png",
"technic:brass_ingot",
"group:stick",
"",
"dye:white"
},
{ "wrought_iron",
"wrought iron",
"homedecor_generic_metal_wrought_iron.png",
"homedecor_generic_metal_wrought_iron.png",
"homedecor:pole_wrought_iron",
"homedecor:pole_wrought_iron",
"",
""
}
}
for _, side in ipairs({"diagonal_left", "diagonal_right", "horizontal"}) do
for i in ipairs(homedecor.banister_materials) do
local name = homedecor.banister_materials[i][1]
local nodename = "banister_"..name.."_"..side
local groups = { snappy = 3, not_in_creative_inventory = 1 }
local cbox = {
type = "fixed",
fixed = { -9/16, -3/16, 5/16, 9/16, 24/16, 8/16 }
}
if side == "horizontal" then
groups = { snappy = 3 }
cbox = {
type = "fixed",
fixed = { -8/16, -8/16, 5/16, 8/16, 8/16, 8/16 }
}
else
minetest.register_alias(string.gsub("homedecor:"..nodename, "diagonal_", ""), "homedecor:"..nodename)
end
homedecor.register(nodename, {
description = S("Banister for Stairs ("..homedecor.banister_materials[i][2]..", "..side..")"),
mesh = "homedecor_banister_"..side..".obj",
tiles = {
homedecor.banister_materials[i][3],
homedecor.banister_materials[i][4]
},
inventory_image = "homedecor_banister_"..name.."_inv.png",
groups = groups,
selection_box = cbox,
collision_box = cbox,
on_place = homedecor.place_banister,
drop = "homedecor:banister_"..name.."_horizontal",
})
end
end
homedecor.register("spiral_staircase", {
description = "Spiral Staircase",
mesh = "homedecor_spiral_staircase.obj",
wield_scale = { x=0.4, y=0.4, z=0.4 },
tiles = {
"homedecor_generic_metal_wrought_iron.png",
},
selection_box = {
type = "fixed",
fixed = { -1.5, -0.5, -1.5, 0.5, 2.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = {
{-0.5625, -0.5, -0.5625, -0.4375, 2.5, -0.4375}, -- NodeBox9
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0}, -- NodeBox14
{-0.5, -0.125, -0.5, -0.25, -0.0625, 0.5}, -- NodeBox15
{-0.25, -0.125, -0.0625, 0, -0.0625, 0.5}, -- NodeBox16
{-1, 0.25, -0.5, -0.5, 0.3125, 0.5}, -- NodeBox17
{-1.5, 0.625, -0.5, -0.5, 0.6875, -0.25}, -- NodeBox18
{-1.5, 0.625, -0.25, -0.9375, 0.6875, 0}, -- NodeBox19
{-1.5, 1, -1, -0.5, 1.0625, -0.5}, -- NodeBox20
{-0.75, 1.375, -1.5, -0.5, 1.4375, -0.5}, -- NodeBox21
{-1, 1.375, -1.5, -0.75, 1.4375, -1}, -- NodeBox22
{-0.5, 1.75, -1.5, 0.0625, 1.8125, -0.5}, -- NodeBox23
{-0.5, 2.125, -0.8125, 0.5, 2.1875, -0.5}, -- NodeBox24
{-0.0625, 2.125, -1.0625, 0.5, 2.1875, -0.75}, -- NodeBox25
{-1.5, -0.125, 0.4375, 0.5, 1.625, 0.5}, -- NodeBox26
{-1.5, 1.5625, -1.5, -1.4375, 2.875, 0.5}, -- NodeBox27
{-1.5, 1.75, -1.5, 0.5, 3.3125, -1.4375}, -- NodeBox28
{0.4375, -0.5, -0.5, 0.5, 0.875, 0.5}, -- NodeBox29
{0.4375, 2.125, -1.5, 0.5, 3.3125, 0.5}, -- NodeBox30
}
},
groups = {cracky = 1},
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local leftx = homedecor.fdir_to_left[fdir+1][1]
local leftz = homedecor.fdir_to_left[fdir+1][2]
local revx = -homedecor.fdir_to_fwd[fdir+1][1]
local revz = -homedecor.fdir_to_fwd[fdir+1][2]
local corner1 = { x = pos.x + leftx + revx, y = pos.y, z = pos.z + leftz + revz}
local corner2 = { x = pos.x, y = pos.y + 2, z = pos.z }
local minp = { x = math.min(corner1.x, corner2.x),
y = math.min(corner1.y, corner2.y),
z = math.min(corner1.z, corner2.z) }
local maxp = { x = math.max(corner1.x, corner2.x),
y = math.max(corner1.y, corner2.y),
z = math.max(corner1.z, corner2.z) }
if #minetest.find_nodes_in_area(minp, maxp, "air") < 11 then
minetest.set_node(pos, {name = "air"})
minetest.chat_send_player(placer:get_player_name(), "This object takes up a 2x3x2 block of space (the bottom step goes in the forward-right corner), and some of it is occupied!" )
return true
end
local belownode = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z })
if belownode and belownode.name == "homedecor:spiral_staircase" then
local newpos = { x = pos.x, y = pos.y + 2, z = pos.z }
minetest.set_node(pos, { name = "air" })
minetest.set_node(newpos, { name = "homedecor:spiral_staircase", param2 = belownode.param2 })
end
end
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
local belownode = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z })
if newnode.name ~= "homedecor:spiral_staircase"
and belownode
and belownode.name == "homedecor:spiral_staircase" then
minetest.set_node(pos, { name = "air" })
local newpos = { x = pos.x, y = pos.y + 2, z = pos.z }
local checknode = minetest.get_node(newpos)
if checknode and checknode.name == "air" then
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(newpos, { name = newnode.name, param2 = fdir })
else
return true
end
end
end)
|