Skip to content

Commit

Permalink
use smallest area at position (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
SwissalpS authored Sep 13, 2024
1 parent ef9a9b3 commit fc90237
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions areas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ end
-- protection check
local old_is_protected = minetest.is_protected
function minetest.is_protected(pos, name)
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
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
end
end

return old_is_protected(pos, name)
end
Expand Down

0 comments on commit fc90237

Please sign in to comment.