2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2018-05-31 15:49:38 +00:00
|
|
|
/*
|
|
|
|
* Author: Garth de Wet (LH), PabstMirror, mharis001
|
|
|
|
* Returns children actions for attachable items.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Target <OBJECT>
|
|
|
|
* 1: Player <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Actions <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [_target, _player] call ace_attach_fnc_getChildrenActions
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_target", "_player"];
|
|
|
|
TRACE_2("params",_target,_player);
|
|
|
|
|
|
|
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
|
|
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
|
|
|
|
|
|
|
private _actions = [];
|
|
|
|
|
|
|
|
private _magazines = magazines _player;
|
|
|
|
{
|
|
|
|
private _config = _cfgMagazines >> _x;
|
|
|
|
if (getText (_config >> "ACE_Attachable") != "") then {
|
|
|
|
private _displayName = getText (_config >> "displayName");
|
|
|
|
private _picture = getText (_config >> "picture");
|
|
|
|
private _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, _x] call EFUNC(interact_menu,createAction);
|
|
|
|
_actions pushBack [_action, [], _target];
|
|
|
|
};
|
|
|
|
} forEach (_magazines arrayIntersect _magazines);
|
|
|
|
|
|
|
|
{
|
|
|
|
private _config = _cfgWeapons >> _x;
|
|
|
|
if (getText (_config >> "ACE_Attachable") != "") then {
|
|
|
|
private _displayName = getText (_config >> "displayName");
|
|
|
|
private _picture = getText (_config >> "picture");
|
|
|
|
private _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, _x] call EFUNC(interact_menu,createAction);
|
|
|
|
_actions pushBack [_action, [], _target];
|
|
|
|
};
|
2018-09-17 19:03:28 +00:00
|
|
|
} forEach (_player call EFUNC(common,uniqueItems));
|
2018-05-31 15:49:38 +00:00
|
|
|
|
|
|
|
_actions
|