2015-07-16 10:15:33 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
2015-07-19 01:25:52 +00:00
|
|
|
* Maintains the spectatable unit list and updates the unit tree accordingly
|
2015-07-18 17:46:46 +00:00
|
|
|
* Also updates current camera unit when status changes
|
2015-07-16 10:15:33 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-07-19 01:25:52 +00:00
|
|
|
* 0: Parameters <ANY>
|
|
|
|
* 1: PFH handle <NUMBER>
|
2015-07-16 10:15:33 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
|
|
|
* Example:
|
2015-07-19 12:40:08 +00:00
|
|
|
* [ace_spectator_fnc_handleUnits, 10, _display] call CBA_fnc_addPerFrameHandler;
|
2015-07-16 10:15:33 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-07-19 01:25:52 +00:00
|
|
|
params ["_display"];
|
|
|
|
|
2015-07-17 01:30:00 +00:00
|
|
|
// Kill PFH when display is closed
|
2015-07-19 01:25:52 +00:00
|
|
|
if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
|
2015-07-16 10:15:33 +00:00
|
|
|
|
2015-07-18 15:50:11 +00:00
|
|
|
// Remove all dead and null units from the list
|
2015-07-19 01:25:52 +00:00
|
|
|
[] call FUNC(updateUnits);
|
2015-07-18 15:50:11 +00:00
|
|
|
|
2015-07-18 17:25:59 +00:00
|
|
|
// Camera shouldn't stay on unit that isn't in the list
|
|
|
|
if !(GVAR(camUnit) in GVAR(unitList)) then {
|
|
|
|
[0,objNull] call FUNC(updateCamera);
|
|
|
|
};
|
|
|
|
|
2015-07-19 12:40:08 +00:00
|
|
|
// Reduce overhead when unit tree is hidden
|
|
|
|
if (GVAR(showUnit) && GVAR(showInterface)) then {
|
|
|
|
// Reduce overhead by spreading across frames
|
|
|
|
[FUNC(handleInterface),["onUnitsUpdate",[_display]],1] call EFUNC(common,waitAndExecute);
|
|
|
|
};
|