Add hostile sides filter

This commit is contained in:
SilentSpike 2015-07-19 20:19:26 +01:00
parent ac56702e33
commit e406a794f2
4 changed files with 17 additions and 16 deletions

View File

@ -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)};
};
};

View File

@ -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;
};
};
};

View File

@ -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 {
_sides = [];
_cond = [{_this == playerSide},{(_this getFriend playerSide) >= 0.6},{(_this getFriend playerSide) < 0.6},{true}] select GVAR(filterSides);
{
if ((_x getFriend _playerSide) < 0.6) then {
_sides = _sides - [_x];
};
} forEach _sides;
};
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 {

View File

@ -37,6 +37,9 @@
<Key ID="STR_ACE_Spectator_sides_friendly">
<English>Friendly sides</English>
</Key>
<Key ID="STR_ACE_Spectator_sides_hostile">
<English>Hostile sides</English>
</Key>
<Key ID="STR_ACE_Spectator_sides_all">
<English>All sides</English>
</Key>