mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Handling the spectatable unit list
This commit is contained in:
parent
147571c76f
commit
7f04164653
@ -9,6 +9,7 @@ PREP(handleMouse);
|
||||
PREP(handleRespawn);
|
||||
PREP(moduleSpectator);
|
||||
PREP(setSpectator);
|
||||
PREP(updateUnits);
|
||||
PREP(updateView);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -137,7 +137,7 @@ switch (toLower _mode) do {
|
||||
(_display displayCtrl IDC_VIEW) ctrlSetText (["FREE","FIRST","THIRD"] select GVAR(camMode));
|
||||
|
||||
// Populate unit tree
|
||||
//["onload",_display displayCtrl IDC_TREE] call FUNC(updateUnits);
|
||||
call FUNC(updateUnits);
|
||||
|
||||
// Hacky way to enable keybindings
|
||||
//_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}];
|
||||
|
29
addons/spectator/functions/fnc_updateUnits.sqf
Normal file
29
addons/spectator/functions/fnc_updateUnits.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Remove dead and null units
|
||||
GVAR(unitList) - [objNull];
|
||||
GVAR(unitList) - allDead;
|
||||
|
||||
// Fetch new units for list
|
||||
{
|
||||
if (
|
||||
(simulationEnabled _x) &&
|
||||
{(side _x) in [west,east,resistance,civilian] } &&
|
||||
//{!isObjectHidden _unit} && // (currently dev branch only)
|
||||
{!(_x getVariable [QGVAR(isSpectator), false])} // Who watches the watchmen?
|
||||
) then {
|
||||
GVAR(unitList) pushBack _x;
|
||||
};
|
||||
} forEach (allUnits - GVAR(unitList));
|
||||
|
||||
disableSerialization;
|
||||
_display = GETUVAR(GVAR(display),displayNull);
|
||||
_ctrl = _display displayCtrl IDC_TREE;
|
||||
|
||||
// Clear the tree
|
||||
_ctrl tvCollapse [];
|
||||
|
||||
// Update the tree
|
||||
{
|
||||
// _ctrl tvAdd [[,_forEachIndex], name _x];
|
||||
} forEach GVAR(unitList);
|
Loading…
Reference in New Issue
Block a user