You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
861 B
33 lines
861 B
5 years ago
|
function creative_regions:is_areas_mod(area_id)
|
||
|
area_id = tostring(area_id)
|
||
|
local is_areas_id = string.sub(id, 1, 2) == "a"
|
||
|
local a_id = tonumber( string.sub(id, 2) )
|
||
|
return is_areas_id, a_id
|
||
|
end
|
||
|
|
||
|
function creative_regions:get_areas_area_size(areas_area)
|
||
|
local pos1 = areas_area.pos1
|
||
|
local pos2 = areas_area.pos2
|
||
|
local x = math.abs( pos2.x - pos1.x )
|
||
|
local z = math.abs( pos2.z - pos1.x )
|
||
|
return x*z
|
||
|
end
|
||
|
|
||
|
-- areas mod hud
|
||
|
if minetest.get_modpath("areas") then
|
||
|
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
|
||
|
if astore_id then
|
||
|
table.insert(areas, {
|
||
|
id = "mod:"..astore_id,
|
||
|
name = astore_area.data,
|
||
|
--owner = "",
|
||
|
})
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
areas:registerHudHandler(areas_hud_handler)
|
||
|
end
|