ACE3/addons/interact_menu/functions/fnc_createAction.sqf

71 lines
2.0 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
2015-03-24 04:18:00 +00:00
* Author: esteldunedain
* Creates an isolated ACE action
* Note: This function is NOT global.
*
2016-06-18 09:50:41 +00:00
* Arguments:
* 0: Action name <STRING>
* 1: Name of the action shown in the menu <STRING>
* 2: Icon file path or Array of icon file path and hex color ("" for default icon) <STRING|ARRAY>
* 3: Statement <CODE>
* 4: Condition <CODE>
* 5: Insert children code <CODE> (default: {})
* 6: Action parameters <ANY> (default: [])
* 7: Position (Position array, Position code or Selection Name) <ARRAY>, <CODE> or <STRING> (default: {[0, 0, 0]})
* 8: Distance <NUMBER> (default: 2)
* 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] <ARRAY> (default: all false)
* 10: Modifier function <CODE> (default: {})
*
2016-06-18 09:50:41 +00:00
* Return Value:
* Action <ARRAY>
*
* Example:
2015-04-15 21:57:15 +00:00
* ["VulcanPinch","Vulcan Pinch","",{_target setDamage 1;},{true},{},[parameters], [0,0,0], 100] call ace_interact_menu_fnc_createAction;
*
* Public: Yes
*/
2016-01-08 04:43:37 +00:00
// IGNORE_PRIVATE_WARNING(_actionName,_displayName,_icon,_statement,_condition,_insertChildren,_customParams,_position,_distance,_params,_modifierFunction);
if (!hasInterface) exitWith { [] };
params [
"_actionName",
"_displayName",
"_icon",
"_statement",
"_condition",
["_insertChildren", {}],
["_customParams", []],
["_position", {[0, 0, 0]}],
["_distance", 2],
["_params", [false, false, false, false, false]],
["_modifierFunction", {}]
];
2015-11-28 03:23:27 +00:00
_position = if (_position isEqualType "") then {
2016-01-08 04:43:37 +00:00
// If the action is set to a selection, create the suitable code - IGNORE_PRIVATE_WARNING(_target);
compile format ["_target selectionPosition '%1'", _position];
} else {
if (_position isEqualType []) then {
// If the action is set to a array position, create the suitable code
compile str _position;
} else {
2016-01-08 04:43:37 +00:00
_position;
};
2016-01-08 04:43:37 +00:00
};
[
_actionName,
_displayName,
_icon,
_statement,
_condition,
_insertChildren,
_customParams,
_position,
_distance,
_params,
_modifierFunction
]