2015-01-19 04:08:34 +00:00
|
|
|
/*
|
2015-02-21 20:11:03 +00:00
|
|
|
* Author: commy2 and NouberNou
|
|
|
|
* Add an ACE action to an object or inside a parent action. Note: This function is NOT global.
|
2015-01-19 04:08:34 +00:00
|
|
|
*
|
|
|
|
* Argument:
|
2015-02-21 20:11:03 +00:00
|
|
|
* 0: Object the action should be assigned to or parent action <OBJECT> or <ARRAY>
|
2015-02-19 21:03:14 +00:00
|
|
|
* 1: Name of the action shown in the menu <STRING>
|
|
|
|
* 2: Icon <STRING>
|
|
|
|
* 3: Position (Position or Selection Name) <POSITION> or <STRING>
|
|
|
|
* 4: Statement <CODE>
|
|
|
|
* 5: Condition <CODE>
|
|
|
|
* 6: Distance <NUMBER>
|
2015-01-19 04:08:34 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
2015-02-19 21:03:14 +00:00
|
|
|
* The entry array, which can be used to remove the entry, or add children entries <ARRAY>.
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-19 04:08:34 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-02-21 20:11:03 +00:00
|
|
|
EXPLODE_7_PVT(_this,_object,_displayName,_icon,_position,_statement,_condition,_distance);
|
2015-01-19 04:08:34 +00:00
|
|
|
|
2015-02-21 20:11:03 +00:00
|
|
|
|
|
|
|
private ["_actions","_entry"];
|
2015-01-19 04:08:34 +00:00
|
|
|
_actions = [];
|
|
|
|
if(IS_OBJECT(_object)) then {
|
|
|
|
_actions = _object getVariable [QUOTE(GVAR(actionData)), []];
|
2015-01-28 18:18:19 +00:00
|
|
|
if((count _actions) == 0) then {
|
|
|
|
_object setVariable [QUOTE(GVAR(actionData)), _actions]
|
|
|
|
};
|
2015-01-19 04:08:34 +00:00
|
|
|
} else {
|
|
|
|
if(IS_ARRAY(_object)) then {
|
|
|
|
_actions = _object select 6;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_entry = [
|
|
|
|
_displayName,
|
|
|
|
_icon,
|
|
|
|
_position,
|
|
|
|
_statement,
|
|
|
|
_condition,
|
|
|
|
_distance,
|
|
|
|
[],
|
|
|
|
GVAR(uidCounter)
|
|
|
|
];
|
|
|
|
GVAR(uidCounter) = GVAR(uidCounter) + 1;
|
|
|
|
_actions pushBack _entry;
|
2015-02-21 20:11:03 +00:00
|
|
|
_entry;
|