2015-07-16 10:15:33 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
2017-08-12 13:25:48 +00:00
|
|
|
* Adds and removed units from the spectator list. Local effect.
|
2015-07-16 10:15:33 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2017-08-12 13:25:48 +00:00
|
|
|
* 0: Units to show in the list <ARRAY>
|
|
|
|
* 1: Units to hide in the list <ARRAY>
|
2015-07-16 10:15:33 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
|
|
|
* Example:
|
2017-08-12 13:25:48 +00:00
|
|
|
* [allPlayers, [player]] call ace_spectator_fnc_updateUnits
|
2015-07-16 10:15:33 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2015-07-15 13:58:38 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-07-19 11:09:57 +00:00
|
|
|
// Function only matters on player clients
|
2015-09-11 14:58:26 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
2015-07-17 17:40:49 +00:00
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
params [["_addUnits",[],[[]]], ["_removeUnits",[],[[], true]]];
|
2015-07-15 13:58:38 +00:00
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
// Deprecated parameter (remember to remove bool from params when removed)
|
|
|
|
if (_removeUnits isEqualType true) then {
|
|
|
|
ACE_DEPRECATED("Boolean parameter","3.12.0","array (see function header or doc)");
|
|
|
|
if (_removeUnits) then {
|
|
|
|
_removeUnits = _addUnits;
|
|
|
|
_addUnits = [];
|
|
|
|
};
|
2016-07-31 10:52:25 +00:00
|
|
|
};
|
2015-07-17 01:30:00 +00:00
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
// Add to the whitelist and prevent list overlap
|
|
|
|
GVAR(unitBlacklist) = GVAR(unitBlacklist) - _addUnits;
|
|
|
|
GVAR(unitWhitelist) append _addUnits;
|
2015-07-24 16:13:03 +00:00
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
// Blacklist overrides the whitelist
|
|
|
|
GVAR(unitWhitelist) = GVAR(unitWhitelist) - _removeUnits;
|
|
|
|
GVAR(unitBlacklist) append _removeUnits;
|