From 25448ccbf16941a90164797efd11e5ddedb1e7b4 Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Mon, 16 Sep 2024 09:50:28 +0200 Subject: [PATCH] be backward compatible --- areas.lua | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/areas.lua b/areas.lua index 5c39b5e..78a24f4 100644 --- a/areas.lua +++ b/areas.lua @@ -9,12 +9,24 @@ end -- protection check local old_is_protected = minetest.is_protected function minetest.is_protected(pos, name) - local _, id = areas:getSmallestAreaAtPos(pos) - if id then - local required_priv = priv_areas[id] - if required_priv and not minetest.check_player_privs(name, required_priv) then - -- required privililege not met, protected - return true + if areas.getSmallestAreaAtPos then + local _, id = areas:getSmallestAreaAtPos(pos) + if id then + local required_priv = priv_areas[id] + if required_priv and not minetest.check_player_privs(name, required_priv) then + -- required privililege not met, protected + return true + end + end + else + local area_list = areas:getAreasAtPos(pos) + for id in pairs(area_list) do + local required_priv = priv_areas[id] + + if required_priv and not minetest.check_player_privs(name, required_priv) then + -- required privililege not met, protected + return true + end end end