ACE3/addons/explosives/functions/fnc_getDetonators.sqf
mharis001 803d497d8a Improve checking of unit items (#6350)
* Add uniqueItems function

* Optimize dogtag children actions function

* Optimize getDetonators item search

* Store CfgWeapons lookup in getDetonators

* Update items to use new function

* Update items to use new function 2

* More optimization of uniqueItems function

* Update items to use new function 3
2018-09-17 14:03:28 -05:00

23 lines
516 B
Plaintext

/*
* Author: Garth 'L-H' de Wet, mharis001
* Returns all detonators the given unit has.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Config names of detonators <ARRAY>
*
* Example:
* [_player] call ace_explosives_fnc_getDetonators
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit"];
TRACE_1("Getting detonators",_unit);
private _cfgWeapons = configFile >> "CfgWeapons";
(_unit call EFUNC(common,uniqueItems)) select {getNumber (_cfgWeapons >> _x >> QGVAR(Detonator)) == 1};