summaryrefslogtreecommitdiff
path: root/areas/interact.lua
blob: 2e5480012abee5853aaa5f0e5ca97de734fed14e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

local old_is_protected = minetest.is_protected
function minetest.is_protected(pos, name)
	if not areas:canInteract(pos, name) then
		return true
	end
	return old_is_protected(pos, name)
end

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, ", ")))
	end
end)