ACE3/addons/laserpointer/functions/fnc_getNearUnits.sqf
commy2 97a0624375 Optimize Laserpointer (#4859)
* only process one unit every 0.1 seconds

* exitWith to keep indentation low

* use event to determine isIR and isTI

* correctly remove units with turned on lights from their arrays

* handle weaponAccessories command reporting nil
2017-02-10 12:47:08 -06:00

27 lines
443 B
Plaintext

/*
* Author: commy2
* Reports near units.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private _camPosAGL = positionCameraToWorld [0, 0, 0];
// handle RHS / bugged vehicle slots
if !((_camPosAGL select 0) isEqualType 0) exitWith {};
private _nearUnits = [];
{
_nearUnits append crew _x;
} forEach nearestObjects [_camPosAGL, ["AllVehicles"], MAX_LASER_RANGE];
_nearUnits