areas/interact.lua

20 lines
481 B
Lua
Raw Normal View History

2013-09-02 16:16:14 -07:00
2013-12-15 14:47:56 -08:00
old_is_protected = minetest.is_protected
function minetest.is_protected(pos, name)
if not areas:canInteract(pos, name) then
return true
end
2013-12-15 14:47:56 -08:00
return old_is_protected(pos, name)
end
2013-12-15 14:47:56 -08: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,
("%s is protected by %s."):format(
minetest.pos_to_string(pos),
table.concat(owners, ", ")))
2013-09-02 16:16:14 -07:00
end
2013-12-15 14:47:56 -08:00
end)
2013-09-02 16:16:14 -07:00