1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-14 06:20:32 +01:00
server-nalc/mods/homedecor_modpack/lrfurn/longsofas.lua

85 lines
2.3 KiB
Lua
Raw Normal View History

2014-10-28 18:01:32 +01:00
local longsofa_sbox = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 2.5}
}
local longsofa_cbox = {
type = "fixed",
2015-10-15 19:50:55 +02:00
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-10-15 19:50:55 +02:00
for i in ipairs(lrfurn.colors) do
local colour = lrfurn.colors[i][1]
local hue = lrfurn.colors[i][2]
2014-10-28 18:01:32 +01:00
minetest.register_node("lrfurn:longsofa_"..colour, {
2015-10-15 19:50:55 +02:00
description = "Long Sofa ("..colour..")",
drawtype = "mesh",
mesh = "lrfurn_sofa_long.obj",
tiles = {
2015-10-15 19:50:55 +02:00
"lrfurn_bg_white.png^[colorize:"..hue.."^lrfurn_sofa_overlay.png",
"lrfurn_sofa_bottom.png"
},
2014-10-28 18:01:32 +01:00
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3},
2014-10-28 18:01:32 +01:00
sounds = default.node_sound_wood_defaults(),
selection_box = longsofa_sbox,
node_box = longsofa_cbox,
2015-05-15 13:18:20 +02:00
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if minetest.is_protected(pos, placer:get_player_name()) then return true end
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
if lrfurn.check_forward(pos, fdir, true, placer) 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!")
minetest.set_node(pos, { name = "air" })
2014-10-28 18:01:32 +01:00
end
return itemstack
2014-10-28 18:01:32 +01:00
end,
on_rightclick = function(pos, node, clicker)
if not clicker:is_player() then
return
end
pos.y = pos.y-0.5
clicker:setpos(pos)
end
})
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)
2014-10-28 18:01:32 +01:00
minetest.register_craft({
output = "lrfurn:longsofa_"..colour,
recipe = {
{"wool:"..colour, "wool:"..colour, "wool:"..colour, },
{"stairs:slab_wood", "stairs:slab_wood", "stairs:slab_wood", },
{"group:stick", "group:stick", "group:stick", }
}
})
minetest.register_craft({
output = "lrfurn:longsofa_"..colour,
recipe = {
{"wool:"..colour, "wool:"..colour, "wool:"..colour, },
{"moreblocks:slab_wood", "moreblocks:slab_wood", "moreblocks:slab_wood", },
{"group:stick", "group:stick", "group:stick", }
}
})
end
if minetest.setting_get("log_mods") then
minetest.log("action", "long sofas loaded")
end