diff --git a/mod_areas.lua b/mod_areas.lua index 8e5ec46..7dee4d4 100644 --- a/mod_areas.lua +++ b/mod_areas.lua @@ -21,15 +21,16 @@ if minetest.get_modpath("areas") then areas:registerOnRemove(function(id) local area = areas.areas[id] local area_id = "a"..tostring(id) + creative_regions.set_region_privs(area_id, nil) + creative_regions.save_regions() local protectors_in_area = minetest.find_nodes_in_area(area.pos1, area.pos2, {"creative_regions:protector_nofly", "creative_regions:protector_arena"}) - for pos in ipairs(protectors_in_area) do + for _, pos in ipairs(protectors_in_area) do local meta = minetest.get_meta(pos) local stored_id = meta:get_string("area_id") local privstring = meta:get_string("privstring") local owner = meta:get_string("owner") - creative_regions.set_region_privs(area_id, nil) - creative_regions.save_regions() - if stored_id == area_id and privstring == creative_regions.region_privs[tostring(area_id)] then + + if stored_id == area_id then minetest.remove_node(pos) minetest.chat_send_player(owner, "[creative_regions] "..description.." removed for removed area " .. area_id) end