mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
b489750d5b
* Optimizations with private, params, and isEqualType * Fixed tab being used instead of space * Fixed tabs inserted by notepad++ * More usage of new private syntax and params - changed a few checks for an array being empty to `_arr isEqualTo []` rather than `count _arr == 0` - added more uses of `private` on the same line as the variable is declared - added more uses of params to assign variables passed as parameters - removed unnecessary parentheses - removed several unnecessary variable declarations with private array syntax * clean up and formatting
61 lines
1.4 KiB
Plaintext
61 lines
1.4 KiB
Plaintext
/*
|
|
* Author: Garth 'L-H' de Wet and CAA-Picard
|
|
* Adds sub actions for all explosive magazines (from insertChildren)
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* Actions
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
params ["_unit"];
|
|
TRACE_1("params",_unit);
|
|
|
|
private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"];
|
|
|
|
_mags = magazines _unit;
|
|
_list = [];
|
|
_itemCount = [];
|
|
{
|
|
_item = ConfigFile >> "CfgMagazines" >> _x;
|
|
if (getNumber(_item >> QGVAR(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 = [];
|
|
|
|
{
|
|
private _name = getText (_x >> "displayNameShort");
|
|
if (_name isEqualTo "") then {
|
|
_name = getText (_x >> "displayName");
|
|
};
|
|
|
|
_children pushBack
|
|
[
|
|
[
|
|
format ["Explosive_%1", _forEachIndex],
|
|
format [_name + " (%1)", _itemCount select _forEachIndex],
|
|
getText(_x >> "picture"),
|
|
{[{_this call FUNC(setupExplosive)}, _this] call CBA_fnc_execNextFrame},
|
|
{true},
|
|
{},
|
|
(configName _x)
|
|
] call EFUNC(interact_menu,createAction),
|
|
[],
|
|
_unit
|
|
];
|
|
} forEach _list;
|
|
|
|
_children
|