mirror of
https://github.com/Sokomine/locks.git
synced 2025-01-08 06:40:19 +01:00
check place above door for protection as well
This commit is contained in:
parent
81d5b7613a
commit
7846aa3894
@ -142,12 +142,14 @@ minetest.register_node("locks:door", {
|
||||
sunlight_propogates = true,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = pointed_thing.above
|
||||
if minetest.is_protected(above, placer:get_player_name()) then
|
||||
local above1 = {x = above.x, y = above.y + 1, z = above.z};
|
||||
if (minetest.is_protected(above, placer:get_player_name())
|
||||
or minetest.is_protected(above1, placer:get_player_name())) then
|
||||
minetest.chat_send_player(placer:get_player_name(), "This area is protected!")
|
||||
return itemstack
|
||||
else
|
||||
-- there should be 2 empty nodes
|
||||
if minetest.env:get_node({x = above.x, y = above.y + 1, z = above.z}).name ~= "air" then
|
||||
if minetest.env:get_node(above1).name ~= "air" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user