Add require_protection and node_ownership_legacy settings

require_protection: Disallows interactions outside of owned areas
node_ownership_legacy: Skip 9+ year old compatibility code by default
This commit is contained in:
SmallJoker
2022-03-25 22:00:07 +01:00
parent 4018c0d204
commit f52454edec
4 changed files with 38 additions and 18 deletions

View File

@ -84,10 +84,15 @@ end
-- Checks if the area is unprotected or owned by you
function areas:canInteract(pos, name)
if name == "" then
return true -- Mods, namely minetest.item_place_node
end
if minetest.check_player_privs(name, self.adminPrivs) then
return true
end
local owned = false
-- Disallow interaction by default when the restrictive setting is enabled
local owned = areas.config.require_protection
for _, area in pairs(self:getAreasAtPos(pos)) do
if area.owner == name or area.open then
return true