2014-07-19 01:37:08 +02:00
|
|
|
local longsofas_list = {
|
|
|
|
{ "Red Long Sofa", "red"},
|
2015-01-20 23:59:50 +01:00
|
|
|
{ "Orange Long Sofa", "orange"},
|
2014-07-19 01:37:08 +02:00
|
|
|
{ "Yellow Long Sofa", "yellow"},
|
|
|
|
{ "Green Long Sofa", "green"},
|
|
|
|
{ "Blue Long Sofa", "blue"},
|
|
|
|
{ "Violet Long Sofa", "violet"},
|
|
|
|
{ "Black Long Sofa", "black"},
|
|
|
|
{ "Grey Long Sofa", "grey"},
|
|
|
|
{ "White Long Sofa", "white"},
|
|
|
|
}
|
|
|
|
|
2015-04-30 23:52:23 +02:00
|
|
|
local longsofa_sbox = {
|
2015-04-07 23:28:28 +02:00
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 2.5}
|
|
|
|
}
|
|
|
|
|
2015-04-30 23:52:23 +02:00
|
|
|
local longsofa_cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, -0.5, 0.5, 0, 2.5 },
|
|
|
|
{-0.5, -0.5, 0.5, -0.4, 0.5, 2.5 }
|
|
|
|
}
|
|
|
|
}
|
2015-04-07 23:28:28 +02:00
|
|
|
|
2014-07-19 01:37:08 +02:00
|
|
|
for i in ipairs(longsofas_list) do
|
|
|
|
local longsofadesc = longsofas_list[i][1]
|
|
|
|
local colour = longsofas_list[i][2]
|
|
|
|
|
2015-04-07 03:35:25 +02:00
|
|
|
minetest.register_node("lrfurn:longsofa_"..colour, {
|
2014-07-19 01:37:08 +02:00
|
|
|
description = longsofadesc,
|
2015-04-07 03:35:25 +02:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "lrfurn_sofa_long.obj",
|
|
|
|
tiles = {
|
|
|
|
"lrfurn_sofa_"..colour..".png",
|
|
|
|
"lrfurn_sofa_bottom.png"
|
|
|
|
},
|
2014-07-19 01:37:08 +02:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
2015-04-30 23:52:23 +02:00
|
|
|
groups = {snappy=3},
|
2014-07-19 01:37:08 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2015-04-30 23:52:23 +02:00
|
|
|
selection_box = longsofa_sbox,
|
|
|
|
node_box = longsofa_cbox,
|
2015-04-07 04:49:46 +02:00
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
local pos = pointed_thing.above
|
|
|
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
|
|
|
|
|
|
|
|
if lrfurn.check_forward(pos, fdir, true) then
|
|
|
|
minetest.set_node(pos, {name = "lrfurn:longsofa_"..colour, param2 = fdir})
|
|
|
|
itemstack:take_item()
|
|
|
|
else
|
|
|
|
minetest.chat_send_player(placer:get_player_name(), "No room to place the sofa!")
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end,
|
2014-07-19 01:37:08 +02:00
|
|
|
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
|
|
|
|
})
|
|
|
|
|
2015-04-07 03:35:25 +02:00
|
|
|
minetest.register_alias("lrfurn:longsofa_left_"..colour, "air")
|
|
|
|
minetest.register_alias("lrfurn:longsofa_middle_"..colour, "air")
|
|
|
|
minetest.register_alias("lrfurn:longsofa_right_"..colour, "lrfurn:longsofa_"..colour)
|
2015-01-20 23:59:50 +01:00
|
|
|
|
2014-07-19 01:37:08 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "lrfurn:longsofa_"..colour,
|
|
|
|
recipe = {
|
|
|
|
{"wool:"..colour, "wool:"..colour, "wool:"..colour, },
|
|
|
|
{"stairs:slab_wood", "stairs:slab_wood", "stairs:slab_wood", },
|
2014-07-31 00:19:42 +02:00
|
|
|
{"group:stick", "group:stick", "group:stick", }
|
2014-07-19 01:37:08 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "lrfurn:longsofa_"..colour,
|
|
|
|
recipe = {
|
|
|
|
{"wool:"..colour, "wool:"..colour, "wool:"..colour, },
|
|
|
|
{"moreblocks:slab_wood", "moreblocks:slab_wood", "moreblocks:slab_wood", },
|
2014-07-31 00:19:42 +02:00
|
|
|
{"group:stick", "group:stick", "group:stick", }
|
2014-07-19 01:37:08 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "lrfurn:longsofa_"..colour,
|
|
|
|
recipe = {
|
|
|
|
{"wool:"..colour, "wool:"..colour, "wool:"..colour, },
|
|
|
|
{"group:wood_slab", "group:wood_slab", "group:wood_slab", },
|
2014-07-31 00:19:42 +02:00
|
|
|
{"group:stick", "group:stick", "group:stick", }
|
2014-07-19 01:37:08 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.setting_get("log_mods") then
|
|
|
|
minetest.log("action", "long sofas loaded")
|
|
|
|
end
|