ACE3/addons/interact_menu/functions/fnc_addAction.sqf
Nicolás Badano 310710b6e2 Major plumbing upgrades on interact_menu:
- Store only one compiled menu per class
- Actions added through apis for invidual objects stored on the object separately
- Replaced the concept of uids by paths. This allows adding/removing actions inside other actions loaded from config seamlessly.
- Temporarily removed caching of nearby actions (probe). We may go back to that if needed pretty easily. This allows the player to move freely with the interaction menu opened.
2015-02-27 01:55:16 -03:00

51 lines
1.4 KiB
Plaintext

/*
* Author: commy2, NouberNou and CAA-Picard
* Add an ACE action to an object, under a certain config path
* Note: This function is NOT global.
*
* Argument:
* 0: Object the action should be assigned to <OBJECT>
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
* 2: Full path of the new action <ARRAY>
* 3: Name of the action shown in the menu <STRING>
* 4: Icon <STRING>
* 5: Position (Position or Selection Name) <POSITION> or <STRING>
* 6: Statement <CODE>
* 7: Condition <CODE>
* 8: Distance <NUMBER>
*
* Return value:
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_9_PVT(_this,_object,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance);
private ["_varName","_actions"];
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
_actions = _object getVariable [_varName, []];
if((count _actions) == 0) then {
_object setVariable [_varName, _actions];
};
private "_entry";
_entry = [
_displayName,
_icon,
_position,
_statement,
_condition,
_distance,
[],
GVAR(uidCounter),
+ _fullPath
];
GVAR(uidCounter) = GVAR(uidCounter) + 1;
_actions pushBack _entry;
_fullPath