ACE3/addons/laserpointer/XEH_postInit.sqf
Nicolás Badano e7ec905892 Cache the units near to the camera instead of the player.
Works even when no player exists or is somehow viewing the action remotely.
2015-01-17 23:48:44 -03:00

24 lines
467 B
Plaintext

// by commy2
#include "script_component.hpp"
if !(hasInterface) exitWith {};
GVAR(nearUnits) = [];
// @todo. Maybe move to common?
[{
private "_nearUnits";
_nearUnits = nearestObjects [positionCameraToWorld [0,0,0], ["CAManBase"], 50];
if (count _nearUnits > 10) then {
_nearUnits resize 10;
};
GVAR(nearUnits) = _nearUnits;
} , 5, []] call CBA_fnc_addPerFrameHandler;
addMissionEventHandler ["Draw3D", {
call FUNC(onDraw);
}];