forked from IDI-Systems/acre2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfnc_getAllRadiosByType.sqf
35 lines (32 loc) · 974 Bytes
/
fnc_getAllRadiosByType.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "script_component.hpp"
/*
* Author: ACRE2Team
* Returns a list of unique radio IDs of local player or unit possesses of a given type.
* In the case of a unit for the second parameter it will find the radio IDs for that unit instead of the local player.
*
* Arguments:
* 0: Radio type <STRING>
* 1: Optional unit or List of String <ARRAY, OBJECT> (default: [])
*
* Return Value:
* Array of Radio IDs <ARRAY>
*
* Example:
* _radioIds = ["ACRE_PRC152"] call acre_api_fnc_getAllRadiosByType
* _radioIds = ["ACRE_PRC152", _unit] call acre_api_fnc_getAllRadiosByType
*
* Public: Yes
*/
params [
["_radioType", "", [""]],
["_array", [], [[], objNull]]
];
if (_array isEqualType objNull) then {
_array = _array call EFUNC(sys_core,getGear);
} else {
if (_array isEqualTo []) then {
_array = [] call FUNC(getCurrentRadioList);
};
};
_array = _array select {[_x, _radioType] call FUNC(isKindOf)};
_array arrayIntersect _array;