2015-01-19 04:08:34 +00:00
|
|
|
/*
|
2015-02-27 04:55:16 +00:00
|
|
|
* Author: commy2, NouberNou and CAA-Picard
|
|
|
|
* Add an ACE action to an object, under a certain config path
|
|
|
|
* Note: This function is NOT global.
|
2015-01-19 04:08:34 +00:00
|
|
|
*
|
|
|
|
* Argument:
|
2015-02-27 04:55:16 +00:00
|
|
|
* 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>
|
2015-03-11 03:25:45 +00:00
|
|
|
* 9: Other parameters <ARRAY> (Optional)
|
2015-01-19 04:08:34 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
2015-02-27 04:55:16 +00:00
|
|
|
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
|
2015-02-19 21:03:14 +00:00
|
|
|
*
|
2015-02-27 05:20:28 +00:00
|
|
|
* Example:
|
|
|
|
* [cursorTarget,0,["ACE_TapShoulderRight","VulcanPinch"],"Vulcan Pinch","",[0,0,0],{_target setDamage 1;},{true},100] call ace_interact_menu_fnc_addAction;
|
|
|
|
*
|
2015-02-19 21:03:14 +00:00
|
|
|
* Public: No
|
2015-01-19 04:08:34 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-02-27 04:55:16 +00:00
|
|
|
EXPLODE_9_PVT(_this,_object,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance);
|
2015-01-19 04:08:34 +00:00
|
|
|
|
2015-03-11 03:25:45 +00:00
|
|
|
private ["_varName","_actions","_params","_entry"];
|
2015-02-21 20:11:03 +00:00
|
|
|
|
2015-02-27 04:55:16 +00:00
|
|
|
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
|
|
|
|
_actions = _object getVariable [_varName, []];
|
|
|
|
if((count _actions) == 0) then {
|
|
|
|
_object setVariable [_varName, _actions];
|
2015-01-19 04:08:34 +00:00
|
|
|
};
|
|
|
|
|
2015-03-11 03:25:45 +00:00
|
|
|
_params = [false,false,false,false];
|
|
|
|
if (count _this > 9) then {
|
|
|
|
_params = _this select 9;
|
|
|
|
};
|
|
|
|
|
2015-01-19 04:08:34 +00:00
|
|
|
_entry = [
|
2015-03-03 02:29:57 +00:00
|
|
|
[
|
|
|
|
_displayName,
|
|
|
|
_icon,
|
|
|
|
_position,
|
|
|
|
_statement,
|
|
|
|
_condition,
|
|
|
|
_distance,
|
2015-03-11 03:25:45 +00:00
|
|
|
_params,
|
2015-03-03 02:29:57 +00:00
|
|
|
+ _fullPath
|
|
|
|
],
|
|
|
|
[]
|
2015-01-19 04:08:34 +00:00
|
|
|
];
|
2015-02-27 04:55:16 +00:00
|
|
|
|
2015-01-19 04:08:34 +00:00
|
|
|
_actions pushBack _entry;
|
2015-02-27 04:55:16 +00:00
|
|
|
|
|
|
|
_fullPath
|