1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-12-27 11:45:18 +01:00

[markers] Update

This commit is contained in:
LeMagnesium
2015-11-15 18:10:17 +01:00
parent ab24dc7869
commit 98bf4a6646
4 changed files with 64 additions and 31 deletions

View File

@@ -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
@@ -504,9 +518,9 @@ markers.form_input_handler_areas = function( player, formname, fields)
minetest.chat_send_player( pname, 'Area successfully renamed.');
-- shwo the renamed area
formspec = markers.get_area_desc_formspec( menu_data.selected, player, menu_data.pos );
-- change owner the area
elseif( fields.change_owner
and menu_data.selected
@@ -666,9 +680,9 @@ markers.form_input_handler_areas = function( player, formname, fields)
formspec = markers.get_area_list_formspec(ppos, player, 'player', menu_data.pos, old_owner, nil );
end
elseif( fields.show_parent
elseif( fields.show_parent
and menu_data.selected
and areas.areas[ menu_data.selected ]
and areas.areas[ menu_data.selected ].parent ) then