ACE3/addons/attach/functions/fnc_getChildrenActions.sqf

49 lines
1.6 KiB
Plaintext
Raw Normal View History

/*
* 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
*/
#include "script_component.hpp"
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];
};
} forEach (_player call EFUNC(common,uniqueItems));
_actions