mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Side filter
This commit is contained in:
parent
c48719a644
commit
832fa1e832
@ -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)};
|
||||
};
|
||||
};
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Adds units to spectator whitelist/blacklist and refreshes the filter units
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Units to add to the list <ARRAY>
|
||||
* 0: Units to add to the whitelist <ARRAY>
|
||||
* 1: Use blacklist <BOOL> <OPTIONAL>
|
||||
*
|
||||
* 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;
|
||||
|
Loading…
Reference in New Issue
Block a user