diff --git a/init.lua b/init.lua index 60ff874..9fe1071 100644 --- a/init.lua +++ b/init.lua @@ -34,6 +34,7 @@ function creative_regions:update_player(player, initialize) local areas_owner = false local areas_guest = false local areas_open = false + local areas_faction_open = false local areas_individual_override = false initialize = initialize or 0 @@ -61,6 +62,12 @@ function creative_regions:update_player(player, initialize) areas_owner = true elseif areas_area.open then areas_open = true + elseif minetest.get_modpath("playerfactions") and areas_area.faction_open then + for _, fname in ipairs(areas_area.faction_open or {}) do + if factions.player_is_in_faction(fname, name) then + areas_faction_open = true + end + end else areas_guest = true --continue @@ -91,7 +98,7 @@ function creative_regions:update_player(player, initialize) end -- overwrite - if areas_owner or areas_open then + if areas_owner or areas_open or areas_faction_open then creative_regions:add_privs_from_string(new_privs_table, areas_interact_privs) creative_regions:add_privs_from_string(new_privs_table, "-arena") end diff --git a/mod.conf b/mod.conf index 804f9eb..e99a65c 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = creative_regions description = Toggle privs in areas depends = default, sfinv -optional_depends = areas, unified_inventory, hunger_ng, vehicles +optional_depends = areas, unified_inventory, hunger_ng, vehicles, playerfactions