Cache the units near to the camera instead of the player.

Works even when no player exists or is somehow viewing the action remotely.
This commit is contained in:
Nicolás Badano 2015-01-17 23:48:44 -03:00
parent 8683667d24
commit e7ec905892

View File

@ -1,12 +1,14 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
if !(hasInterface) exitWith {};
GVAR(nearUnits) = []; GVAR(nearUnits) = [];
// @todo. Maybe move to common? // @todo. Maybe move to common?
[{ [{
private "_nearUnits"; private "_nearUnits";
_nearUnits = nearestObjects [ACE_player, ["CAManBase"], 50]; _nearUnits = nearestObjects [positionCameraToWorld [0,0,0], ["CAManBase"], 50];
if (count _nearUnits > 10) then { if (count _nearUnits > 10) then {
_nearUnits resize 10; _nearUnits resize 10;