diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp index 604efe00e0..48af019059 100644 --- a/addons/spectator/ACE_Settings.hpp +++ b/addons/spectator/ACE_Settings.hpp @@ -11,6 +11,6 @@ class ACE_Settings { class GVAR(filterSides) { typeName = "SCALAR"; value = 0; - values[] = {CSTRING(sides_player), CSTRING(sides_friendly), CSTRING(sides_all)}; + values[] = {CSTRING(sides_player), CSTRING(sides_friendly), CSTRING(sides_hostile), CSTRING(sides_all)}; }; }; diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp index ab90298421..3796b0d3d1 100644 --- a/addons/spectator/CfgVehicles.hpp +++ b/addons/spectator/CfgVehicles.hpp @@ -49,9 +49,13 @@ class CfgVehicles { name = CSTRING(sides_friendly); value = 1; }; + class hostile { + name = CSTRING(sides_hostile); + value = 2; + }; class all { name = CSTRING(sides_all); - value = 2; + value = 3; }; }; }; diff --git a/addons/spectator/functions/fnc_updateUnits.sqf b/addons/spectator/functions/fnc_updateUnits.sqf index e55e1388d2..4c61bb5989 100644 --- a/addons/spectator/functions/fnc_updateUnits.sqf +++ b/addons/spectator/functions/fnc_updateUnits.sqf @@ -33,25 +33,19 @@ if !(_newUnits isEqualTo []) exitWith { }; }; -private ["_playerSide","_sides","_filteredUnits"]; +private ["_sides","_cond","_filteredUnits"]; // Unit setting filter _newUnits = [[],allPlayers,allUnits] select GVAR(filterUnits); // Side setting filter -_playerSide = side group player; -if (GVAR(filterSides) == 0) then { - _sides = [_playerSide]; -} else { - _sides = [west,east,resistance,civilian]; - if (GVAR(filterSides) == 1) then { - { - if ((_x getFriend _playerSide) < 0.6) then { - _sides = _sides - [_x]; - }; - } forEach _sides; +_sides = []; +_cond = [{_this == playerSide},{(_this getFriend playerSide) >= 0.6},{(_this getFriend playerSide) < 0.6},{true}] select GVAR(filterSides); +{ + if (_x call _cond) then { + _sides pushBack _x; }; -}; +} forEach [west,east,resistance,civilian]; // Filter units and append to list _filteredUnits = []; @@ -59,7 +53,7 @@ _filteredUnits = []; if ( (alive _x) && {(_x isKindOf "CAManBase")} && - {(side _x) in _sides} && // Side filter + {(side group _x) in _sides} && // Side filter {simulationEnabled _x} && {!(_x getVariable [QGVAR(isSpectator), false])} // Who watches the watchmen? ) then { diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index e714a3e389..67d5980f4d 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -37,6 +37,9 @@ Friendly sides + + Hostile sides + All sides