diff options
author | Sokomine <wegwerf@anarres.dyndns.org> | 2015-09-05 17:50:38 +0200 |
---|---|---|
committer | Sokomine <wegwerf@anarres.dyndns.org> | 2015-09-05 17:50:38 +0200 |
commit | 01234ecd2bca88554d68d9f9410b8c6cee30f536 (patch) | |
tree | bacd4dff8a5983a7e9631548349a3e41b1ef7bca /areas.lua | |
parent | 22b833d93d5803b2eedfa1542b79628fa0fe59ae (diff) |
split config values into new config.lua; added markers.AREA_RANGE in order to restrict the amount of areas shown on big servers
Diffstat (limited to 'areas.lua')
-rw-r--r-- | areas.lua | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -92,22 +92,36 @@ markers.get_area_list_formspec = function(ppos, player, mode, pos, mode_data, se -- show only areas that do not have parents elseif( mode=='main_areas' ) then - title = 'All main areas:'; + title = 'All main areas withhin '..tostring( markers.AREA_RANGE )..' m:'; tlabel = '*all main areas*'; for id, area in pairs(areas.areas) do - if( not( area.parent )) then + if( not( area.parent ) + -- ppos is always available + and( (area.pos1.x >= ppos.x-markers.AREA_RANGE and area.pos1.x <= ppos.x+markers.AREA_RANGE ) + or(area.pos2.x >= ppos.x-markers.AREA_RANGE and area.pos2.x <= ppos.x+markers.AREA_RANGE )) + and( (area.pos1.y >= ppos.y-markers.AREA_RANGE and area.pos1.y <= ppos.y+markers.AREA_RANGE ) + or(area.pos2.y >= ppos.y-markers.AREA_RANGE and area.pos2.y <= ppos.y+markers.AREA_RANGE )) + and( (area.pos1.z >= ppos.z-markers.AREA_RANGE and area.pos1.z <= ppos.z+markers.AREA_RANGE ) + or(area.pos2.z >= ppos.z-markers.AREA_RANGE and area.pos2.z <= ppos.z+markers.AREA_RANGE ))) then table.insert( id_list, id ); end end elseif( mode=='all' ) then - title = 'All areas:'; + title = 'All areas withhin '..tostring( markers.AREA_RANGE )..' m:'; tlabel = '*all areas*'; for id, area in pairs(areas.areas) do - table.insert( id_list, id ); + if( ( (area.pos1.x >= ppos.x-markers.AREA_RANGE and area.pos1.x <= ppos.x+markers.AREA_RANGE ) + or(area.pos2.x >= ppos.x-markers.AREA_RANGE and area.pos2.x <= ppos.x+markers.AREA_RANGE )) + and( (area.pos1.y >= ppos.y-markers.AREA_RANGE and area.pos1.y <= ppos.y+markers.AREA_RANGE ) + or(area.pos2.y >= ppos.y-markers.AREA_RANGE and area.pos2.y <= ppos.y+markers.AREA_RANGE )) + and( (area.pos1.z >= ppos.z-markers.AREA_RANGE and area.pos1.z <= ppos.z+markers.AREA_RANGE ) + or(area.pos2.z >= ppos.z-markers.AREA_RANGE and area.pos2.z <= ppos.z+markers.AREA_RANGE ))) then + table.insert( id_list, id ); + end end end |