ACE3/addons/attach/functions/fnc_openAttachUI.sqf

68 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-01-11 20:39:49 +00:00
/*
2015-02-01 20:56:19 +00:00
* Author: Garth de Wet (LH)
* Opens the UI for attaching objects.
*
* Arguments:
* 0: unit <STRING>
* 1: target <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* Nothing
*
* Public: No
*/
#include "script_component.hpp"
2015-01-11 20:39:49 +00:00
private ["_actions", "_attachables", "_item"];
PARAMS_2(_unit,_target);
GVAR(attachTarget) = _target;
2015-01-11 20:39:49 +00:00
_listed = [];
_attachables = magazines _unit;
2015-01-13 23:00:31 +00:00
_actions = [localize "STR_ACE_Attach_AttachDetach", localize "STR_ACE_Attach_Attach"] call EFUNC(interaction,prepareSelectMenu);
2015-01-11 20:39:49 +00:00
{
2015-02-01 20:56:19 +00:00
if !(_x in _listed) then {
_item = ConfigFile >> "CfgMagazines" >> _x;
if (getNumber (_item >> "ACE_Attachable") == 1) then {
_actions = [
_actions,
getText(_item >> "displayName"),
getText(_item >> "picture"),
_x
] call EFUNC(interaction,addSelectableItem);
};
_listed pushBack _x;
2015-01-11 20:39:49 +00:00
};
} forEach _attachables;
_attachables = items _unit;
{
2015-02-01 20:56:19 +00:00
if !(_x in _listed) then {
_item = ConfigFile >> "CfgWeapons" >> _x;
if (getNumber (_item >> "ACE_Attachable") == 1) then {
_actions = [
_actions,
getText(_item >> "displayName"),
getText(_item >> "picture"),
_x
] call EFUNC(interaction,addSelectableItem);
};
_listed pushBack _x;
2015-01-11 20:39:49 +00:00
};
} forEach _attachables;
[
2015-02-15 14:31:09 +00:00
_actions,
{
[ACE_player, GVAR(attachTarget), _this] call FUNC(attach);
call EFUNC(interaction,hideMenu);
},
{
call EFUNC(interaction,hideMenu);
if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)};
}
2015-01-11 20:39:49 +00:00
] call EFUNC(interaction,openSelectMenu);