Browse Source

fix small mistakes

main
Hendrik Langer 5 years ago
parent
commit
5d74f048c2
  1. 10
      init.lua
  2. 2
      region.lua

10
init.lua

@ -29,6 +29,7 @@ function creative_regions:update_player(player)
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_individual_override = false
-- skip for players with protection_bypass -- skip for players with protection_bypass
if minetest.check_player_privs(name, { protection_bypass=true }) then if minetest.check_player_privs(name, { protection_bypass=true }) then
@ -37,7 +38,7 @@ function creative_regions:update_player(player)
-- find active regions -- find active regions
local current_regions = self.astore:get_areas_for_pos(pos, true, true) local current_regions = self.astore:get_areas_for_pos(pos, true, true)
for astore_id, astore_area in pairs( current_areas ) do for astore_id, astore_area in pairs( current_regions ) do
local id = "r"..tostring(astore_id) local id = "r"..tostring(astore_id)
local size = creative_regions:get_region_size(astore_area) local size = creative_regions:get_region_size(astore_area)
table.insert(current_regions_size, { ["id"]=id, ["size"]=size }) table.insert(current_regions_size, { ["id"]=id, ["size"]=size })
@ -71,10 +72,15 @@ function creative_regions:update_player(player)
player_active_region_str = player_active_region_str .. "," .. region.id player_active_region_str = player_active_region_str .. "," .. region.id
if creative_regions.region_privs[region.id] then if creative_regions.region_privs[region.id] then
creative_regions:add_privs_from_string(new_privs_table, creative_regions.region_privs[region.id]) creative_regions:add_privs_from_string(new_privs_table, creative_regions.region_privs[region.id])
if string.sub(region.id, 1, 1) == "a" then
areas_individual_override = true
end
elseif string.sub(region.id, 1, 1) == "r" then elseif string.sub(region.id, 1, 1) == "r" then
creative_regions:add_privs_from_string(new_privs_table, default_privs) creative_regions:add_privs_from_string(new_privs_table, default_privs)
elseif string.sub(region.id, 1, 1) == "a" then elseif string.sub(region.id, 1, 1) == "a" then
creative_regions:add_privs_from_string(new_privs_table, areas_guest_privs) if not areas_individual_override then
creative_regions:add_privs_from_string(new_privs_table, areas_guest_privs)
end
end end
end end

2
region.lua

@ -40,7 +40,7 @@ function creative_regions:decode_privs_table(privs_table)
local privs_grant = {} local privs_grant = {}
local privs_revoke = {} local privs_revoke = {}
table.sort(privs_table) --table is sorted ascending with priority
for _, priv in ipairs(privs_table) do for _, priv in ipairs(privs_table) do
local toggle = string.sub(priv, 1, 1) local toggle = string.sub(priv, 1, 1)
priv = string.sub(priv, 2) priv = string.sub(priv, 2)

Loading…
Cancel
Save