2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-03-17 19:43:50 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2015-08-09 03:18:26 +00:00
|
|
|
*
|
2015-03-17 19:43:50 +00:00
|
|
|
* Helper function to get all gear of a unit.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Target <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Array of 2 arrays, classnames and count<ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [["ace_bandage"],[2]] = [bob] call ace_disarming_fnc_getAllGearUnit
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-02-23 00:44:33 +00:00
|
|
|
|
2015-08-09 03:18:26 +00:00
|
|
|
params ["_target"];
|
2015-02-23 00:44:33 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _allItems = (((items _target) + (assignedItems _target)) - (weapons _target)) + (weapons _target) + (magazines _target);
|
2015-02-23 00:44:33 +00:00
|
|
|
|
|
|
|
if ((backpack _target) != "") then {
|
|
|
|
_allItems pushBack (backpack _target);
|
|
|
|
};
|
|
|
|
if ((vest _target) != "") then {
|
|
|
|
_allItems pushBack (vest _target);
|
|
|
|
};
|
|
|
|
if ((uniform _target) != "") then {
|
|
|
|
_allItems pushBack (uniform _target);
|
|
|
|
};
|
|
|
|
if ((headgear _target) != "") then {
|
|
|
|
_allItems pushBack (headgear _target);
|
|
|
|
};
|
2015-02-27 21:23:46 +00:00
|
|
|
//What kind of asshole takes a man's glasses?
|
|
|
|
if ((goggles _target) != "") then {
|
|
|
|
_allItems pushBack (goggles _target);
|
|
|
|
};
|
2015-02-23 00:44:33 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _uniqueClassnames = [];
|
|
|
|
private _classnamesCount = [];
|
2015-02-23 00:44:33 +00:00
|
|
|
//Filter unique and count
|
|
|
|
{
|
2017-10-10 14:39:59 +00:00
|
|
|
private _index = _uniqueClassnames find _x;
|
2015-02-23 00:44:33 +00:00
|
|
|
if (_index != -1) then {
|
|
|
|
_classnamesCount set [_index, ((_classnamesCount select _index) + 1)];
|
|
|
|
} else {
|
|
|
|
_uniqueClassnames pushBack _x;
|
|
|
|
_classnamesCount pushBack 1;
|
|
|
|
};
|
2015-08-15 01:13:41 +00:00
|
|
|
} forEach _allItems;
|
2015-02-23 00:44:33 +00:00
|
|
|
|
|
|
|
[_uniqueClassnames, _classnamesCount]
|