interact.lua 522 B

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