diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp index 5c1b71d45c..604efe00e0 100644 --- a/addons/spectator/ACE_Settings.hpp +++ b/addons/spectator/ACE_Settings.hpp @@ -11,10 +11,6 @@ class ACE_Settings { class GVAR(filterSides) { typeName = "SCALAR"; value = 0; - values[] = {"$STR_Special_None", CSTRING(sides_player), CSTRING(sides_friendly), CSTRING(sides_all)}; - }; - class GVAR(endMission) { - typeName = "BOOL"; - value = 0; + values[] = {CSTRING(sides_player), CSTRING(sides_friendly), CSTRING(sides_all)}; }; }; diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp index a25c758bbd..ab90298421 100644 --- a/addons/spectator/CfgVehicles.hpp +++ b/addons/spectator/CfgVehicles.hpp @@ -40,22 +40,18 @@ class CfgVehicles { description = CSTRING(sides_Description); typeName = "NUMBER"; class values { - class none { - name = "$STR_Special_None"; + class player { + name = CSTRING(sides_player); value = 0; default = 1; }; - class player { - name = CSTRING(sides_player); - value = 1; - }; class friendly { name = CSTRING(sides_friendly); - value = 2; + value = 1; }; class all { name = CSTRING(sides_all); - value = 3; + value = 2; }; }; }; diff --git a/addons/spectator/functions/fnc_handleTree.sqf b/addons/spectator/functions/fnc_handleTree.sqf index 2c382df267..489cfedd5b 100644 --- a/addons/spectator/functions/fnc_handleTree.sqf +++ b/addons/spectator/functions/fnc_handleTree.sqf @@ -33,8 +33,8 @@ tvClear _ctrl; // Update the tree from the unit list _cachedGrps = []; { - // Exclude any currently dead units - if ((alive _x) && !(_x getVariable [QGVAR(isSpectator), false])) then { + // Exclude any currently dead/disabled units + if ((alive _x) && (simulationEnabled _x) && !(_x getVariable [QGVAR(isSpectator), false])) then { _grp = group _x; _node = 0; // If group already exists, find existing node diff --git a/addons/spectator/functions/fnc_updateUnits.sqf b/addons/spectator/functions/fnc_updateUnits.sqf index f7c08f7fda..701f0a085a 100644 --- a/addons/spectator/functions/fnc_updateUnits.sqf +++ b/addons/spectator/functions/fnc_updateUnits.sqf @@ -3,7 +3,7 @@ * Adds units to spectator whitelist/blacklist and refreshes the filter units * * Arguments: - * 0: Units to add to the list + * 0: Units to add to the whitelist * 1: Use blacklist * * Return Value: @@ -19,6 +19,9 @@ params [["_newUnits",[],[[]]],["_blacklist",false,[false]]]; +// Function only matter on player clients +if !(hasInterface) exitWith {}; + if !(_newUnits isEqualTo []) then { if (_blacklist) then { GVAR(unitWhitelist) = GVAR(unitWhitelist) - _newUnits; @@ -29,16 +32,33 @@ if !(_newUnits isEqualTo []) then { }; }; -// Get filter units from setting +// Reset the filter list (removes any units that no longer apply) +GVAR(unitList) = []; + +// Unit filter _newUnits = [[],allPlayers,allUnits] select GVAR(filterUnits); -// Append only valid units to the list +// Side filter +private ["_playerSide","_sides"]; +_playerSide = side group player; +_sides = [west,east,resistance,civilian]; + +if (GVAR(filterSides) == 0) then { + _sides = [_playerSide]; +} else { + { + if ((_x getFriend _playerSide) < 0.6) then { + _sides - [_x]; + }; + } forEach _sides; +}; + +// Filter units and append to list { if ( (alive _x) && {(_x isKindOf "CAManBase")} && - {(side _x) in [west,east,resistance,civilian]} && // Side filter - {(simulationEnabled _x)} && + {(side _x) in _sides} && // Side filter {!(_x getVariable [QGVAR(isSpectator), false])} // Who watches the watchmen? ) then { GVAR(unitList) pushBack _x;