2020-03-08 22:15:00 +01:00
|
|
|
local S = minetest.get_translator("areas")
|
2013-09-02 19:16:14 -04:00
|
|
|
|
2013-12-17 20:31:11 -05:00
|
|
|
local old_is_protected = minetest.is_protected
|
2013-12-15 17:47:56 -05:00
|
|
|
function minetest.is_protected(pos, name)
|
|
|
|
if not areas:canInteract(pos, name) then
|
|
|
|
return true
|
2013-09-03 17:09:11 -04:00
|
|
|
end
|
2013-12-15 17:47:56 -05:00
|
|
|
return old_is_protected(pos, name)
|
|
|
|
end
|
2013-09-03 17:09:11 -04:00
|
|
|
|
2013-12-15 17:47:56 -05:00
|
|
|
minetest.register_on_protection_violation(function(pos, name)
|
|
|
|
if not areas:canInteract(pos, name) then
|
|
|
|
local owners = areas:getNodeOwners(pos)
|
|
|
|
minetest.chat_send_player(name,
|
2020-03-08 22:15:00 +01:00
|
|
|
S("@1 is protected by @2.",
|
2013-12-15 17:47:56 -05:00
|
|
|
minetest.pos_to_string(pos),
|
|
|
|
table.concat(owners, ", ")))
|
2013-09-02 19:16:14 -04:00
|
|
|
end
|
2013-12-15 17:47:56 -05:00
|
|
|
end)
|