Merge pull request #15 from CloudyProton/patch-3

Fix issue where locked doors can be placed in protected areas
This commit is contained in:
Sokomine 2018-07-30 18:59:11 +02:00 committed by GitHub
commit 9a8c272eb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 27 deletions

View File

@ -142,7 +142,10 @@ 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
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
return itemstack
@ -175,6 +178,7 @@ minetest.register_node("locks:door", {
return ItemStack("")
end
end
})