2015-06-29 02:34:21 +00:00
|
|
|
/*
|
|
|
|
Author:
|
|
|
|
voiper
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Check and record tracking for all units.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
None
|
|
|
|
|
|
|
|
Example:
|
|
|
|
call ace_spectator_fnc_trackUnits;
|
|
|
|
|
|
|
|
Return Value:
|
|
|
|
None
|
|
|
|
|
|
|
|
Public:
|
|
|
|
No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
if (isNil QGVAR(trackingArray)) then {
|
|
|
|
GVAR(trackingArray) = [];
|
|
|
|
};
|
|
|
|
|
|
|
|
if (count GVAR(units) < 1) exitWith {};
|
|
|
|
|
|
|
|
{
|
|
|
|
_unit = _x;
|
|
|
|
_pos = getPos _unit;
|
|
|
|
_pos resize 2;
|
2015-07-04 23:10:01 +00:00
|
|
|
|
2015-06-29 02:34:21 +00:00
|
|
|
_index = -1;
|
|
|
|
|
|
|
|
{if ((_x select 0) == _unit) then {_index = _forEachIndex}} forEach GVAR(trackingArray);
|
|
|
|
if (_index == -1) then {
|
|
|
|
GVAR(trackingArray) pushBack [_unit, [_pos]]
|
|
|
|
} else {
|
|
|
|
_unitArray = GVAR(trackingArray) select _index;
|
|
|
|
_trackingArray = _unitArray select 1;
|
|
|
|
_latestIndex = (count _trackingArray) - 1;
|
|
|
|
_latestPos = _trackingArray select _latestIndex;
|
|
|
|
_diffX = abs((_latestPos select 0) - (_pos select 0));
|
|
|
|
_diffY = abs((_latestPos select 1) - (_pos select 1));
|
2015-07-04 23:10:01 +00:00
|
|
|
|
2015-06-29 02:34:21 +00:00
|
|
|
if !((_diffX < 20) && (_diffY < 20)) then {
|
2015-07-04 23:10:01 +00:00
|
|
|
_trackingArray pushBack _pos;
|
2015-06-29 02:34:21 +00:00
|
|
|
_unitArray set [1, _trackingArray];
|
|
|
|
GVAR(trackingArray) set [_index, _unitArray];
|
|
|
|
};
|
|
|
|
};
|
2015-07-04 23:10:01 +00:00
|
|
|
|
|
|
|
} forEach GVAR(units);
|