ACE3/addons/spectator/functions/fnc_updateUnits.sqf

41 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-07-16 10:15:33 +00:00
/*
* Author: SilentSpike
* Adds and removed units from the spectator list. Local effect.
2015-07-16 10:15:33 +00:00
*
* Arguments:
* 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:
* [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
if (!hasInterface) exitWith {};
2015-07-17 17:40:49 +00:00
params [["_addUnits",[],[[]]], ["_removeUnits",[],[[], true]]];
2015-07-15 13:58:38 +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 = [];
};
};
2015-07-17 01:30:00 +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
// Blacklist overrides the whitelist
GVAR(unitWhitelist) = GVAR(unitWhitelist) - _removeUnits;
GVAR(unitBlacklist) append _removeUnits;