2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-03-19 16:31:45 +00:00
|
|
|
/*
|
|
|
|
* Author: Garth 'L-H' de Wet and CAA-Picard
|
2015-08-15 19:35:33 +00:00
|
|
|
* Adds sub actions for all explosive magazines (from insertChildren)
|
2015-03-19 16:31:45 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* Actions <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [bob] call ace_explosives_fnc_addExplosiveActions
|
2015-03-19 16:31:45 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2015-08-15 19:35:33 +00:00
|
|
|
params ["_unit"];
|
|
|
|
TRACE_1("params",_unit);
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _mags = magazines _unit;
|
|
|
|
private _list = [];
|
|
|
|
private _itemCount = [];
|
2015-03-19 16:31:45 +00:00
|
|
|
{
|
2017-10-10 14:39:59 +00:00
|
|
|
private _item = ConfigFile >> "CfgMagazines" >> _x;
|
2016-01-14 22:05:56 +00:00
|
|
|
if (getNumber(_item >> QGVAR(Placeable)) == 1) then {
|
2017-10-10 14:39:59 +00:00
|
|
|
private _index = _list find _item;
|
2015-03-19 16:31:45 +00:00
|
|
|
if (_index != -1) then {
|
|
|
|
_itemCount set [_index, (_itemCount select _index) + 1];
|
|
|
|
} else {
|
|
|
|
_list pushBack _item;
|
|
|
|
_itemCount pushBack 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} forEach _mags;
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _children = [];
|
2015-03-19 16:31:45 +00:00
|
|
|
|
|
|
|
{
|
2016-09-04 14:44:22 +00:00
|
|
|
private _name = getText (_x >> "displayNameShort");
|
|
|
|
if (_name isEqualTo "") then {
|
|
|
|
_name = getText (_x >> "displayName");
|
|
|
|
};
|
|
|
|
|
2015-03-31 21:20:32 +00:00
|
|
|
_children pushBack
|
|
|
|
[
|
|
|
|
[
|
|
|
|
format ["Explosive_%1", _forEachIndex],
|
2015-08-15 19:35:33 +00:00
|
|
|
format [_name + " (%1)", _itemCount select _forEachIndex],
|
2015-03-31 21:20:32 +00:00
|
|
|
getText(_x >> "picture"),
|
2016-05-22 13:27:24 +00:00
|
|
|
{[{_this call FUNC(setupExplosive)}, _this] call CBA_fnc_execNextFrame},
|
2015-03-31 21:20:32 +00:00
|
|
|
{true},
|
|
|
|
{},
|
2015-07-14 05:24:55 +00:00
|
|
|
(configName _x)
|
2015-03-31 21:20:32 +00:00
|
|
|
] call EFUNC(interact_menu,createAction),
|
|
|
|
[],
|
|
|
|
_unit
|
|
|
|
];
|
2015-08-15 19:35:33 +00:00
|
|
|
} forEach _list;
|
2015-03-19 16:31:45 +00:00
|
|
|
|
|
|
|
_children
|