mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
//#define DEBUG_MODE_FULL
|
|
#include "script_component.hpp"
|
|
#include "\ca\editor\Data\Scripts\dikCodes.h"
|
|
|
|
private ["_menuDef", "_target", "_params", "_menuName", "_menuRsc", "_menus"];
|
|
|
|
PARAMS_2(_target,_params);
|
|
|
|
_menuName = "";
|
|
_menuRsc = "buttonList";
|
|
|
|
if (typeName _params == typeName []) then {
|
|
if (count _params < 1) exitWith {diag_log format["Error: Invalid params: %1, %2", _this, __FILE__]};
|
|
_menuName = _params select 0;
|
|
_menuRsc = if (count _params > 1) then {_params select 1} else {_menuRsc};
|
|
} else {
|
|
_menuName = _params;
|
|
};
|
|
_mortarshell_menu = false;
|
|
{
|
|
if (isText(configFile >> "CfgMagazines" >> _x >> "ACE_ARTY_SHELL_VEHICLE")) then {
|
|
_mortarshell_menu = true;
|
|
if (_mortarshell_menu) exitWith {};
|
|
};
|
|
} forEach (magazines player);
|
|
|
|
_menus =
|
|
[
|
|
[
|
|
["main", localize "STR_ACE_MENU_EQUIPPLAYER", _menuRsc],
|
|
[
|
|
[localize "STR_ACE_ARTY_AMMUNITION_PREP_SHELL",
|
|
{ player call ace_sys_arty_ammunition_fnc_convertShell },
|
|
"","","", -1, 1, _mortarshell_menu && {ACE_SELFINTERACTION_RESTRICTED}]
|
|
]
|
|
]
|
|
];
|
|
|
|
_menuDef = [];
|
|
{
|
|
if (_x select 0 select 0 == _menuName) exitWith {_menuDef = _x};
|
|
} forEach _menus;
|
|
|
|
if (count _menuDef == 0) then {
|
|
hintC format ["Error: Menu not found: %1\n%2\n%3", str _menuName, if (_menuName == "") then {_this} else {""}, __FILE__];
|
|
diag_log format ["Error: Menu not found: %1, %2, %3", str _menuName, _this, __FILE__];
|
|
};
|
|
|
|
_menuDef
|