1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-07-02 23:00:22 +02:00

fix missing protection on sofas and coffee tables

add some informative messages
This commit is contained in:
Vanessa Ezekowitz
2015-07-21 05:08:40 -04:00
parent b20b3bb8e9
commit e492780510
4 changed files with 59 additions and 28 deletions

View File

@ -8,19 +8,32 @@ lrfurn.fdir_to_fwd = {
{ -1, 0 },
}
function lrfurn.check_forward(pos, fdir, long)
function lrfurn.check_forward(pos, fdir, long, placer)
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)
if node2 and node2.name ~= "air" then return false end
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
if long then
local node3 = minetest.get_node(pos3)
if node3 and node3.name ~= "air" then return false end
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
end
return true