2015-03-19 16:31:45 +00:00
|
|
|
/*
|
|
|
|
* Author: Garth 'L-H' de Wet and CAA-Picard
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Actions
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
2015-03-31 21:20:32 +00:00
|
|
|
private ["_mags", "_item", "_index", "_children"];
|
2015-03-19 16:31:45 +00:00
|
|
|
|
|
|
|
EXPLODE_1_PVT(_this,_unit);
|
|
|
|
|
|
|
|
_mags = magazines _unit;
|
|
|
|
_list = [];
|
|
|
|
_itemCount = [];
|
|
|
|
{
|
|
|
|
_item = ConfigFile >> "CfgMagazines" >> _x;
|
|
|
|
if (getNumber(_item >> "ACE_Placeable") == 1) then {
|
|
|
|
_index = _list find _item;
|
|
|
|
if (_index != -1) then {
|
|
|
|
_itemCount set [_index, (_itemCount select _index) + 1];
|
|
|
|
} else {
|
|
|
|
_list pushBack _item;
|
|
|
|
_itemCount pushBack 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} forEach _mags;
|
|
|
|
|
|
|
|
_children = [];
|
|
|
|
|
|
|
|
{
|
2015-04-01 17:09:19 +00:00
|
|
|
private "_name";
|
|
|
|
_name = if(isText(_x >> "displayNameShort") && {getText(_x >> "displayNameShort") != ""}) then
|
|
|
|
{getText (_x >> "displayNameShort")}else{getText(_x >> "displayName")};
|
2015-03-31 21:20:32 +00:00
|
|
|
_children pushBack
|
|
|
|
[
|
|
|
|
[
|
|
|
|
format ["Explosive_%1", _forEachIndex],
|
2015-04-01 17:09:19 +00:00
|
|
|
format [_name + " (%1)", _itemCount select _foreachIndex],
|
2015-03-31 21:20:32 +00:00
|
|
|
getText(_x >> "picture"),
|
|
|
|
{(_this select 2) call FUNC(setupExplosive);},
|
|
|
|
{true},
|
|
|
|
{},
|
|
|
|
[_unit, configName _x]
|
|
|
|
] call EFUNC(interact_menu,createAction),
|
|
|
|
[],
|
|
|
|
_unit
|
|
|
|
];
|
2015-03-19 16:31:45 +00:00
|
|
|
} foreach _list;
|
|
|
|
|
|
|
|
_children
|