interact.lua 487 B

1234567891011121314151617181920
  1. local old_is_protected = minetest.is_protected
  2. function minetest.is_protected(pos, name)
  3. if not areas:canInteract(pos, name) then
  4. return true
  5. end
  6. return old_is_protected(pos, name)
  7. end
  8. minetest.register_on_protection_violation(function(pos, name)
  9. if not areas:canInteract(pos, name) then
  10. local owners = areas:getNodeOwners(pos)
  11. minetest.chat_send_player(name,
  12. ("%s is protected by %s."):format(
  13. minetest.pos_to_string(pos),
  14. table.concat(owners, ", ")))
  15. end
  16. end)