ACE3/addons/interact_menu/functions/fnc_addMainAction.sqf
johnb432 4cf61a026b
Interact Menu - Use hashmaps for interactions (#9920)
* Use hashmaps for interactions

* Update addons/interact_menu/functions/fnc_splitPath.sqf

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>

* Account for case sensitivity

* Update addons/interact_menu/functions/fnc_compileMenu.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2024-05-21 20:18:32 -05:00

30 lines
954 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Jonpas, PabstMirror
* Makes sure there is a ACE_MainActions on the object type
*
* Arguments:
* 0: Object classname <STRING>
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
*
* Return Value:
* None
*
* Example:
* ["Table", 0] call ace_interact_menu_fnc_addMainAction;
*
* Public: No
*/
params ["_objectType", "_typeNum"];
private _namespace = [GVAR(ActNamespace), GVAR(ActSelfNamespace)] select _typeNum;
private _actionTrees = _namespace getOrDefault [_objectType, []];
private _parentNode = [_actionTrees, ["ACE_MainActions"]] call FUNC(findActionNode);
if (isNil "_parentNode") then {
TRACE_2("No Main Action on object",_objectType,_typeNum);
private _mainAction = ["ACE_MainActions", localize ELSTRING(interaction,MainAction), "", {}, {true}] call FUNC(createAction);
[_objectType, _typeNum, [], _mainAction] call EFUNC(interact_menu,addActionToClass);
};