mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add function to add curator actions (#5620)
This commit is contained in:
parent
f6fd0095f7
commit
65c5e6e38e
@ -1,6 +1,7 @@
|
||||
|
||||
PREP(addActionToClass);
|
||||
PREP(addActionToObject);
|
||||
PREP(addActionToZeus);
|
||||
PREP(addMainAction);
|
||||
PREP(compileMenu);
|
||||
PREP(compileMenuSelfAction);
|
||||
|
45
addons/interact_menu/functions/fnc_addActionToZeus.sqf
Normal file
45
addons/interact_menu/functions/fnc_addActionToZeus.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Insert an ACE action to zeus.
|
||||
* Note: This function is NOT global.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Parent path of the new action (e.g. ["ACE_ZeusActions"]) <ARRAY>
|
||||
* 1: Action <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* The entry full path, which can be used to add children entries <ARRAY>.
|
||||
*
|
||||
* Example:
|
||||
* [["ACE_ZeusActions"], zeusAction] call ace_interact_menu_fnc_addActionToZeus;
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!params [["_parentPath", [], [[]]], ["_action", [], [[]], 11]]) exitWith {ERROR("Bad Params"); []};
|
||||
if ((_parentPath param [0, ""]) != "ACE_ZeusActions") exitWith {ERROR_1("Bad path %1 - should have ACE_ZeusActions as base", _parentPath); []};
|
||||
TRACE_2("addActionToZeus",_parentPath,_action);
|
||||
|
||||
private _currentPath = GVAR(ZeusActions);
|
||||
private _pathValid = false;
|
||||
{
|
||||
private _targetParent = _x;
|
||||
_pathValid = false;
|
||||
{
|
||||
_x params ["_xAction", "_xSubActions"];
|
||||
TRACE_2("",_targetParent,_xAction);
|
||||
if ((_xAction select 0) == _targetParent) exitWith {
|
||||
_pathValid = true;
|
||||
_currentPath = _xSubActions;
|
||||
};
|
||||
} forEach _currentPath;
|
||||
} forEach _parentPath;
|
||||
|
||||
if (!_pathValid) exitWith {ERROR_1("Bad path %1", _parentPath); []};
|
||||
|
||||
TRACE_1("Adding Action",_currentPath);
|
||||
_currentPath pushBack [_action, []];
|
||||
|
||||
// Return the full path
|
||||
(_parentPath + [_action select 0])
|
@ -121,7 +121,19 @@ By default this function will not use inheritance, so actions will only be added
|
||||
*/
|
||||
```
|
||||
|
||||
### 2.4 Examples
|
||||
### 2.4 fnc_addActionToZeus
|
||||
|
||||
`ace_interact_menu_fnc_addActionToZeus`
|
||||
|
||||
```cpp
|
||||
/*
|
||||
* Argument:
|
||||
* 0: Parent path of the new action <ARRAY> (Example: `["ACE_ZeusActions"]`)
|
||||
* 1: Action <ARRAY>
|
||||
*/
|
||||
```
|
||||
|
||||
### 2.5 Examples
|
||||
|
||||
External:
|
||||
|
||||
@ -155,7 +167,17 @@ _action = ["CheckExtTank","Check External Tank","",{hint format ["Ext Tank: %1",
|
||||
["Tank_F", 0, ["ACE_MainActions", "CheckFuel"], _action, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
```
|
||||
|
||||
### 2.5 Advanced Example
|
||||
Zeus:
|
||||
|
||||
```cpp
|
||||
_statement = {
|
||||
playSound3D ["alarm.ogg", theBase]
|
||||
};
|
||||
_action = ["myMissionEvent1","Mission Event: Play Base Alarm","",_statement,{true}] call ace_interact_menu_fnc_createAction;
|
||||
[["ACE_ZeusActions"], _action] call ace_interact_menu_fnc_addActionToZeus;
|
||||
```
|
||||
|
||||
### 2.6 Advanced Example
|
||||
|
||||
This adds an interaction to a unit that allows passing items that the player is carrying.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user