52 lines
1.8 KiB
Plaintext
52 lines
1.8 KiB
Plaintext
// diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions];
|
|
|
|
params ["_rootActionID", "_flagCategoryCfg"];
|
|
private _flagCategoryActionID = getText(_flagCategoryCfg >> "actionID");
|
|
private _flagCategoryTitle = getText(_flagCategoryCfg >> "actionTitle");
|
|
|
|
private _flagSubclassesCfgs = _flagCategoryCfg call BIS_fnc_returnChildren;
|
|
|
|
private _flagCategoryAction = [
|
|
_rootActionID + "_" + _flagCategoryActionID, // id
|
|
_flagCategoryTitle, // displayed title
|
|
getText((_flagSubclassesCfgs#0) >> "texture"), // flag icon for category - use first flag option
|
|
{true}, // statement
|
|
{
|
|
params ["_target", "_player", "_params"];
|
|
alive _target;
|
|
// true;
|
|
}, // condition
|
|
{
|
|
// generate child code under category
|
|
// this is the level where actual flag options will be displayed
|
|
params ["_target", "_player", "_params"];
|
|
// these params are passed from the parent action
|
|
_params params ["_rootActionID", "_flagCategoryActionID", "_flagSubclassesCfgs"];
|
|
|
|
private _individualFlagActions = [];
|
|
{ // forEach _flagSubclassesCfgs; // we'll generate flag options for each category
|
|
private _flagOptionCfg = _x;
|
|
|
|
// generate flag option for this flag option
|
|
private _newFlagOption = [
|
|
_target,
|
|
_player,
|
|
_params,
|
|
_flagOptionCfg
|
|
] call FUNC(compileFlagAction);
|
|
|
|
// add flag option to category subactions
|
|
_individualFlagActions pushBack [_newFlagOption, [], _target];
|
|
} forEach _flagSubclassesCfgs;
|
|
|
|
// return the generated flag options to the category as child actions
|
|
_individualFlagActions;
|
|
}, // child code
|
|
[_rootActionID, _flagCategoryActionID, _flagSubclassesCfgs], // params
|
|
nil, // position
|
|
4, // distance
|
|
[false, false, false, false, false], // other params
|
|
nil // modifier function code
|
|
] call ace_interact_menu_fnc_createAction;
|
|
|
|
_flagCategoryAction; |