2015-01-19 04:08:34 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Add an ACE action to an object. Note: This function is NOT global.
|
|
|
|
*
|
|
|
|
* Argument:
|
2015-02-19 21:03:14 +00:00
|
|
|
* 0: Object the action should be assigned to <OBJECT>
|
|
|
|
* 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"
|
|
|
|
|
|
|
|
private ["_object", "_displayName", "_icon", "_position", "_statement", "_condition", "_distance", "_actions", "_entry"];
|
|
|
|
_object = _this select 0;
|
|
|
|
_displayName = _this select 1;
|
|
|
|
_icon = _this select 2;
|
|
|
|
_position = _this select 3;
|
|
|
|
_statement = _this select 4;
|
|
|
|
_condition = _this select 5;
|
|
|
|
_distance = _this select 6;
|
|
|
|
|
|
|
|
_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;
|
|
|
|
_entry;
|