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
|
local armchair_cbox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5 },
{-0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
}
}
for i in ipairs(lrfurn.colors) do
local colour = lrfurn.colors[i][1]
local hue = lrfurn.colors[i][2]
minetest.register_node("lrfurn:armchair_"..colour, {
description = "Armchair ("..colour..")",
drawtype = "mesh",
mesh = "lrfurn_armchair.obj",
tiles = {
"lrfurn_bg_white.png^[colorize:"..hue.."^lrfurn_sofa_overlay.png",
"lrfurn_sofa_bottom.png"
},
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
node_box = armchair_cbox,
on_rightclick = function(pos, node, clicker)
if not clicker:is_player() then
return
end
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_hp(20)
end
})
minetest.register_craft({
output = "lrfurn:armchair_"..colour,
recipe = {
{"wool:"..colour, "", "", },
{"stairs:slab_wood", "", "", },
{"group:stick", "", "", }
}
})
minetest.register_craft({
output = "lrfurn:armchair_"..colour,
recipe = {
{"wool:"..colour, "", "", },
{"moreblocks:slab_wood", "", "", },
{"group:stick", "", "", }
}
})
end
if minetest.setting_get("log_mods") then
minetest.log("action", "armchairs loaded")
end
|