forked from minetest-mods/areas
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:
7
api.lua
7
api.lua
@ -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
|
||||
|
Reference in New Issue
Block a user