ACE3/addons/interact_menu/functions/fnc_compileMenuZeus.sqf

91 lines
2.9 KiB
Plaintext
Raw Normal View History

/*
* Author: SilentSpike
* Compile the zeus action menu (only to be done once)
*
* Argument:
* nil
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp";
// Exit if the action menu is already compiled for zeus
if !(isNil {missionNamespace getVariable [QGVAR(ZeusActions), nil]}) exitWith {};
2016-01-08 04:43:37 +00:00
private _recurseFnc = {
params ["_actionsCfg"];
2016-01-08 04:43:37 +00:00
private _actions = [];
{
2016-01-08 04:43:37 +00:00
private _entryCfg = _x;
if(isClass _entryCfg) then {
2016-01-08 04:43:37 +00:00
private _displayName = getText (_entryCfg >> "displayName");
2016-01-08 04:43:37 +00:00
private _icon = getText (_entryCfg >> "icon");
private _statement = compile (getText (_entryCfg >> "statement"));
2016-01-08 04:43:37 +00:00
private _condition = getText (_entryCfg >> "condition");
if (_condition == "") then {_condition = "true"};
2016-01-08 04:43:37 +00:00
private _insertChildren = compile (getText (_entryCfg >> "insertChildren"));
private _modifierFunction = compile (getText (_entryCfg >> "modifierFunction"));
2016-01-08 04:43:37 +00:00
private _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
private _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
private _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
private _runOnHover = true;
if (isText (_entryCfg >> "runOnHover")) then {
_runOnHover = compile getText (_entryCfg >> "runOnHover");
} else {
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
};
2016-01-08 04:43:37 +00:00
private _condition = compile _condition;
private _children = [_entryCfg] call _recurseFnc;
2016-01-08 04:43:37 +00:00
private _entry = [
[
configName _entryCfg,
_displayName,
_icon,
_statement,
_condition,
_insertChildren,
{},
[0,0,0],
10, //distace
2016-01-08 04:43:37 +00:00
[_showDisabled,_enableInside,_canCollapse,_runOnHover,false],
_modifierFunction
],
_children
];
_actions pushBack _entry;
};
} forEach (configProperties [_actionsCfg, "isClass _x", true]);
_actions
};
2016-01-08 04:43:37 +00:00
private _actionsCfg = configFile >> "ACE_ZeusActions";
// Create a master action to base zeus actions on
GVAR(ZeusActions) = [
[
[
"ACE_ZeusActions",
localize LSTRING(ZeusActionsRoot),
"\A3\Ui_F_Curator\Data\Logos\arma3_zeus_icon_ca.paa",
{true},
{true},
{},
{},
{[0,0,0]},
10,
2016-01-08 04:43:37 +00:00
[false,true,false,false,false]
],
[_actionsCfg] call _recurseFnc
]
];