ACE3/addons/spectator/functions/fnc_checkUnits.sqf
2015-07-05 00:10:01 +01:00

38 lines
701 B
Plaintext

/*
Author:
voiper
Description:
Compile array of units to spectate.
Arguments:
None.
Example:
call ace_spectator_fnc_checkUnits;
Return Value:
None
Public:
No
*/
#include "script_component.hpp"
_units = allUnits;
_units append allDead;
GVAR(units) = [];
{
_listed = _x getVariable [QGVAR(listed), false];
if (!_listed) then {
[_x] call FUNC(unitVar);
_x addEventHandler ["Killed", {_this call FUNC(killed)}];
_x addEventHandler ["Respawn", {_this call FUNC(respawn)}];
_x setVariable [QGVAR(listed), true];
};
if ([_x] call FUNC(canSpectateUnit)) then {GVAR(units) pushback _x};
} forEach _units;