1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-11-17 23:58:30 +01:00
homedecor_modpack/lrfurn/init.lua

74 lines
2.0 KiB
Lua
Raw Normal View History

2017-01-29 22:41:03 +01:00
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_right = {
2015-04-07 04:49:46 +02:00
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
{ 0, 1 },
2015-04-07 04:49:46 +02:00
}
lrfurn.colors = {
"black",
"brown",
"blue",
"cyan",
"dark_grey",
"dark_green",
"green",
"grey",
"magenta",
"orange",
"pink",
"red",
"violet",
"white",
"yellow",
}
function lrfurn.check_right(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_right[fdir+1][1], y=pos.y, z = pos.z + lrfurn.fdir_to_right[fdir+1][2] }
local pos3 = { x = pos.x + lrfurn.fdir_to_right[fdir+1][1] * 2, y=pos.y, z = pos.z + lrfurn.fdir_to_right[fdir+1][2] * 2 }
2015-04-07 04:49:46 +02:00
local node2 = minetest.get_node(pos2)
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(), S("Someone else owns the spot where other end goes!"))
else
minetest.chat_send_player(placer:get_player_name(), S("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)
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(), S("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
function lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
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_wallmounted(dir)
minetest.swap_node(pos, { name = node.name, param2 = fdir })
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")