2017-01-29 22:41:03 +01:00
|
|
|
|
|
|
|
local S = homedecor_i18n.gettext
|
|
|
|
|
2015-04-07 04:49:46 +02:00
|
|
|
lrfurn = {}
|
2015-05-15 10:45:21 +02:00
|
|
|
screwdriver = screwdriver or {}
|
2015-04-07 04:49:46 +02:00
|
|
|
|
|
|
|
lrfurn.fdir_to_fwd = {
|
|
|
|
{ 0, 1 },
|
|
|
|
{ 1, 0 },
|
|
|
|
{ 0, -1 },
|
|
|
|
{ -1, 0 },
|
|
|
|
}
|
|
|
|
|
2017-01-25 10:22:28 +01:00
|
|
|
lrfurn.colors = {
|
2017-01-29 22:41:03 +01:00
|
|
|
{ "black", S("black"), 0xff181818 },
|
|
|
|
{ "brown", S("brown"), 0xff251005 },
|
|
|
|
{ "blue", S("blue"), 0xff0000d0 },
|
|
|
|
{ "cyan", S("cyan"), 0xff009fa7 },
|
|
|
|
{ "dark_grey", S("dark grey"), 0xff101010 },
|
|
|
|
{ "dark_green", S("dark green"), 0xff007000 },
|
|
|
|
{ "green", S("green"), 0xff00d000 },
|
|
|
|
{ "grey", S("grey"), 0xff303030 },
|
|
|
|
{ "magenta", S("magenta"), 0xffe0048b },
|
|
|
|
{ "orange", S("orange"), 0xffee9000 },
|
|
|
|
{ "pink", S("pink"), 0xffff90b0 },
|
|
|
|
{ "red", S("red"), 0xff800000 },
|
|
|
|
{ "violet", S("violet"), 0xff9000d0 },
|
|
|
|
{ "white", S("white"), 0xffffffff },
|
|
|
|
{ "yellow", S("yellow"), 0xffdde000 }
|
2015-09-23 07:29:06 +02:00
|
|
|
}
|
|
|
|
|
2015-07-21 11:08:40 +02:00
|
|
|
function lrfurn.check_forward(pos, fdir, long, placer)
|
2015-04-07 04:49:46 +02:00
|
|
|
if not fdir or fdir > 3 then fdir = 0 end
|
|
|
|
|
|
|
|
local pos2 = { x = pos.x + lrfurn.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + lrfurn.fdir_to_fwd[fdir+1][2] }
|
|
|
|
local pos3 = { x = pos.x + lrfurn.fdir_to_fwd[fdir+1][1] * 2, y=pos.y, z = pos.z + lrfurn.fdir_to_fwd[fdir+1][2] * 2 }
|
|
|
|
|
|
|
|
local node2 = minetest.get_node(pos2)
|
2015-07-21 11:08:40 +02:00
|
|
|
if node2 and node2.name ~= "air" then
|
|
|
|
return false
|
|
|
|
elseif minetest.is_protected(pos2, placer:get_player_name()) then
|
|
|
|
if not long then
|
|
|
|
minetest.chat_send_player(placer:get_player_name(), "Someone else owns the spot where other end goes!")
|
|
|
|
else
|
|
|
|
minetest.chat_send_player(placer:get_player_name(), "Someone else owns the spot where the middle or far end goes!")
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
2015-04-07 04:49:46 +02:00
|
|
|
|
|
|
|
if long then
|
|
|
|
local node3 = minetest.get_node(pos3)
|
2015-07-21 11:08:40 +02:00
|
|
|
if node3 and node3.name ~= "air" then
|
|
|
|
return false
|
|
|
|
elseif minetest.is_protected(pos3, placer:get_player_name()) then
|
|
|
|
minetest.chat_send_player(placer:get_player_name(), "Someone else owns the spot where the other end goes!")
|
|
|
|
return false
|
|
|
|
end
|
2015-04-07 04:49:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2014-07-19 01:37:08 +02:00
|
|
|
dofile(minetest.get_modpath("lrfurn").."/longsofas.lua")
|
|
|
|
dofile(minetest.get_modpath("lrfurn").."/sofas.lua")
|
|
|
|
dofile(minetest.get_modpath("lrfurn").."/armchairs.lua")
|
|
|
|
dofile(minetest.get_modpath("lrfurn").."/coffeetable.lua")
|
|
|
|
dofile(minetest.get_modpath("lrfurn").."/endtable.lua")
|