mirror of
https://github.com/Sokomine/locks.git
synced 2024-11-16 15:10:17 +01:00
Merge pull request #15 from CloudyProton/patch-3
Fix issue where locked doors can be placed in protected areas
This commit is contained in:
commit
9a8c272eb4
|
@ -142,7 +142,10 @@ minetest.register_node("locks:door", {
|
||||||
sunlight_propogates = true,
|
sunlight_propogates = true,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local above = pointed_thing.above
|
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
|
-- 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({x = above.x, y = above.y + 1, z = above.z}).name ~= "air" then
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -175,6 +178,7 @@ minetest.register_node("locks:door", {
|
||||||
|
|
||||||
return ItemStack("")
|
return ItemStack("")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user