ACE3/addons/attach/functions/fnc_openAttachUI.sqf

66 lines
1.6 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
2015-01-11 18:26:40 +00:00
/*
Name: AGM_Attach_fnc_openAttachUI
2015-01-11 18:26:40 +00:00
Author: Garth de Wet (LH)
2015-01-11 18:26:40 +00:00
Description:
Opens the UI for attaching objects.
Parameters:
2015-01-11 18:26:40 +00:00
0: OBJECT - unit
2015-01-11 18:26:40 +00:00
Returns:
Nothing
2015-01-11 18:26:40 +00:00
Example:
[player] call AGM_Attach_fnc_openAttachUI;
*/
private ["_unit", "_actions", "_attachables", "_item"];
_unit = _this select 0;
_listed = [];
_attachables = magazines _unit;
_actions = [localize "STR_AGM_Attach_AttachDetach", localize "STR_AGM_Attach_Attach"] call EFUNC(interaction,prepareSelectMenu);
2015-01-11 18:26:40 +00:00
{
if !(_x in _listed) then {
_item = ConfigFile >> "CfgMagazines" >> _x;
if (getNumber (_item >> "AGM_Attachable") == 1) then {
_actions = [
_actions,
getText(_item >> "displayName"),
getText(_item >> "picture"),
_x
] call EFUNC(interaction,addSelectableItem);
2015-01-11 18:26:40 +00:00
};
_listed pushBack _x;
};
} forEach _attachables;
_attachables = items _unit;
{
if !(_x in _listed) then {
_item = ConfigFile >> "CfgWeapons" >> _x;
if (getNumber (_item >> "AGM_Attachable") == 1) then {
_actions = [
_actions,
getText(_item >> "displayName"),
getText(_item >> "picture"),
_x
] call EFUNC(interaction,addSelectableItem);
2015-01-11 18:26:40 +00:00
};
_listed pushBack _x;
};
} forEach _attachables;
[
_actions,
{
[AGM_player, _this] call FUNC(attach);
call EFUNC(interaction,hideMenu);
2015-01-11 18:26:40 +00:00
},
{
call EFUNC(interaction,hideMenu);
if !(profileNamespace getVariable [EQGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)};
2015-01-11 18:26:40 +00:00
}
] call EFUNC(interaction,openSelectMenu);