Rope: prevent placing in non-owned protected areas
This commit is contained in:
parent
e04c2bab3b
commit
fda9237654
3
rope.lua
3
rope.lua
@ -7,13 +7,14 @@ minetest.register_on_punchnode(function(pos, oldnode, digger)
|
||||
end
|
||||
end)
|
||||
|
||||
function rope.place(itemstack, _, pointed_thing)
|
||||
function rope.place(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
local under = pointed_thing.under
|
||||
local above = pointed_thing.above
|
||||
local pos = above
|
||||
local oldnode = minetest.get_node(pos)
|
||||
local stackname = itemstack:get_name()
|
||||
if minetest.is_protected(pos, placer:get_player_name()) then return end
|
||||
|
||||
while oldnode.name == "air" and not itemstack:is_empty() do
|
||||
local newnode = {name = stackname, param1 = 0}
|
||||
|
Loading…
x
Reference in New Issue
Block a user