|
|
@ -15,8 +15,28 @@ function creative_regions:get_areas_area_size(areas_area) |
|
|
|
return x*z |
|
|
|
end |
|
|
|
|
|
|
|
-- areas mod hud |
|
|
|
if minetest.get_modpath("areas") then |
|
|
|
|
|
|
|
-- remove protector blocks on area removal |
|
|
|
areas:registerOnRemove(function(id) |
|
|
|
local area = areas.areas[id] |
|
|
|
local area_id = "a"..tostring(id) |
|
|
|
local protectors_in_area = minetest.find_nodes_in_area(area.pos1, area.pos2, {"creative_regions:"}) |
|
|
|
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 |
|
|
|
minetest.remove_node(pos) |
|
|
|
minetest.chat_send_player(owner, "[creative_regions] "..description.." removed for removed area " .. area_id) |
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
|
|
|
|
|
-- areas mod hud |
|
|
|
local function areas_hud_handler(pos, areas) |
|
|
|
local current_regions = creative_regions.astore:get_areas_for_pos(pos, false, true) |
|
|
|
for astore_id, astore_area in pairs( current_regions ) do |
|
|
@ -31,4 +51,5 @@ if minetest.get_modpath("areas") then |
|
|
|
end |
|
|
|
|
|
|
|
areas:registerHudHandler(areas_hud_handler) |
|
|
|
|
|
|
|
end |
|
|
|