2017-01-29 22:41:03 +01:00
|
|
|
|
|
|
|
local S = homedecor_i18n.gettext
|
|
|
|
|
2017-02-22 22:38:19 +01:00
|
|
|
--[[
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
local yaw = placer:get_look_yaw()
|
|
|
|
local dir = minetest.yaw_to_dir(yaw-1.5)
|
|
|
|
local fdir = minetest.dir_to_facedir(dir)
|
|
|
|
|
|
|
|
print(placer:get_look_yaw(), yaw)
|
|
|
|
print(node.param2, fdir)
|
|
|
|
|
|
|
|
if lrfurn.check_right(pos, fdir, false, placer) then
|
|
|
|
local pos2 = find_coffee_table_second_node(pos, fdir)
|
|
|
|
]]--
|
|
|
|
|
|
|
|
local function find_second_node(pos, param2)
|
|
|
|
if param2 == 0 then
|
|
|
|
pos.z = pos.z+1
|
|
|
|
elseif param2 == 1 then
|
|
|
|
pos.x = pos.x+1
|
|
|
|
elseif param2 == 2 then
|
|
|
|
pos.z = pos.z-1
|
|
|
|
elseif param2 == 3 then
|
|
|
|
pos.x = pos.x-1
|
|
|
|
end
|
|
|
|
return pos
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_alias("lrfurn:coffeetable_back", "lrfurn:coffeetable")
|
|
|
|
minetest.register_alias("lrfurn:coffeetable_front", "air")
|
|
|
|
|
|
|
|
minetest.register_node("lrfurn:coffeetable", {
|
2017-01-29 22:41:03 +01:00
|
|
|
description = S("Coffee Table"),
|
2014-07-19 01:37:08 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {"lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png", "lrfurn_coffeetable_back.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
--legs
|
2017-02-22 22:38:19 +01:00
|
|
|
{ -0.375, -0.5, -0.375, -0.3125, -0.0625, -0.3125 },
|
|
|
|
{ 0.3125, -0.5, -0.375, 0.375, -0.0625, -0.3125 },
|
|
|
|
{ -0.375, -0.5, 1.3125, -0.3125, -0.0625, 1.375 },
|
|
|
|
{ 0.3125, -0.5, 1.3125, 0.375, -0.0625, 1.375 },
|
2014-07-19 01:37:08 +02:00
|
|
|
--tabletop
|
2017-02-22 22:38:19 +01:00
|
|
|
{-0.4375, -0.0625, -0.4375, 0.4375, 0, 1.4375},
|
2014-07-19 01:37:08 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.4375, -0.5, -0.4375, 0.4375, 0.0, 1.4375},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-07-21 11:08:40 +02:00
|
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
|
|
if minetest.is_protected(pos, placer:get_player_name()) then return true end
|
2014-11-30 18:21:28 +01:00
|
|
|
local node = minetest.get_node(pos)
|
2017-02-22 22:38:19 +01:00
|
|
|
local fdir = node.param2
|
2015-07-21 11:08:40 +02:00
|
|
|
|
2017-02-22 22:38:19 +01:00
|
|
|
if lrfurn.check_right(pos, fdir, false, placer) then
|
|
|
|
minetest.set_node(pos, { name = node.name, param2 = (fdir + 1) % 4 })
|
2015-07-21 11:08:40 +02:00
|
|
|
else
|
2017-01-29 22:41:03 +01:00
|
|
|
minetest.chat_send_player(placer:get_player_name(),
|
2017-02-22 22:38:19 +01:00
|
|
|
S("No room to place the coffee table!"))
|
2015-07-21 11:08:40 +02:00
|
|
|
minetest.set_node(pos, {name = "air"})
|
|
|
|
return true
|
2014-07-19 01:37:08 +02:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "lrfurn:coffeetable",
|
|
|
|
recipe = {
|
|
|
|
{"", "", "", },
|
|
|
|
{"stairs:slab_wood", "stairs:slab_wood", "stairs:slab_wood", },
|
2014-07-31 00:19:42 +02:00
|
|
|
{"group:stick", "", "group:stick", }
|
2014-07-19 01:37:08 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "lrfurn:coffeetable",
|
|
|
|
recipe = {
|
|
|
|
{"", "", "", },
|
|
|
|
{"moreblocks:slab_wood", "moreblocks:slab_wood", "moreblocks:slab_wood", },
|
2014-07-31 00:19:42 +02:00
|
|
|
{"group:stick", "", "group:stick", }
|
2014-07-19 01:37:08 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
if minetest.setting_get("log_mods") then
|
2017-01-29 22:41:03 +01:00
|
|
|
minetest.log("action", "[lrfurn/coffeetable] "..S("Loaded!"))
|
2014-07-19 01:37:08 +02:00
|
|
|
end
|