#include "..\script_component.hpp"

// subroutine to gather nearest 50 units every 5 seconds and store in GVAR(drawTargets)
// cleanup
if (!isNil QGVAR(getEntitiesPFH)) then {
	[GVAR(getEntitiesPFH)] call CBA_fnc_removePerFrameHandler;
};
// add pfh
GVAR(getEntitiesPFH) = [{
	GVAR(drawTargets) = (
		(allUnits + allDeadMen) select {
			_x isKindOf "CAManBase" && 
			player distance _x < 50 &&
			!isNull _x &&
			player isNotEqualTo _x
		}
	);
}, 10] call CBA_fnc_addPerFrameHandler;
