Browse Source

support playerfactions

main
Hendrik Langer 3 years ago
parent
commit
a7efdc7a99
  1. 9
      init.lua
  2. 2
      mod.conf

9
init.lua

@ -34,6 +34,7 @@ function creative_regions:update_player(player, initialize)
local areas_owner = false local areas_owner = false
local areas_guest = false local areas_guest = false
local areas_open = false local areas_open = false
local areas_faction_open = false
local areas_individual_override = false local areas_individual_override = false
initialize = initialize or 0 initialize = initialize or 0
@ -61,6 +62,12 @@ function creative_regions:update_player(player, initialize)
areas_owner = true areas_owner = true
elseif areas_area.open then elseif areas_area.open then
areas_open = true 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 else
areas_guest = true areas_guest = true
--continue --continue
@ -91,7 +98,7 @@ function creative_regions:update_player(player, initialize)
end end
-- overwrite -- 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, areas_interact_privs)
creative_regions:add_privs_from_string(new_privs_table, "-arena") creative_regions:add_privs_from_string(new_privs_table, "-arena")
end end

2
mod.conf

@ -1,4 +1,4 @@
name = creative_regions name = creative_regions
description = Toggle privs in areas description = Toggle privs in areas
depends = default, sfinv depends = default, sfinv
optional_depends = areas, unified_inventory, hunger_ng, vehicles optional_depends = areas, unified_inventory, hunger_ng, vehicles, playerfactions

Loading…
Cancel
Save