mirror of
https://github.com/Sokomine/locks.git
synced 2025-01-09 23:30:20 +01:00
Add check for is_protected when placing door
This commit is contained in:
parent
2f420ef71a
commit
0458df996e
@ -1,4 +1,4 @@
|
|||||||
-- xDoors² mod by xyz
|
-- xDoors² mod by xyz
|
||||||
-- modified by Sokomine to allow locked doors that can only be opened/closed/dig up by the player who placed them
|
-- modified by Sokomine to allow locked doors that can only be opened/closed/dig up by the player who placed them
|
||||||
-- a little bit modified by addi to allow someone with the priv "opendoors" to open/close/dig all locked doors.
|
-- a little bit modified by addi to allow someone with the priv "opendoors" to open/close/dig all locked doors.
|
||||||
-- Sokomine: modified again so that it uses the new locks-mod
|
-- Sokomine: modified again so that it uses the new locks-mod
|
||||||
@ -139,7 +139,10 @@ minetest.register_node("locks:door", {
|
|||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
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
|
||||||
@ -172,6 +175,7 @@ minetest.register_node("locks:door", {
|
|||||||
|
|
||||||
return ItemStack("")
|
return ItemStack("")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user