ACE3/addons/interaction/functions/fnc_openMenuSelectUI.sqf

45 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-01-11 19:32:51 +00:00
// by commy2
2015-01-11 23:13:47 +00:00
#include "script_component.hpp"
2015-01-11 19:32:51 +00:00
private ["_unit", "_vehicle", "_cargo"];
_unit = _this select 0;
_vehicle = _this select 1;
// allow interaction with all cargo slots and all ffv slots
2015-01-13 05:14:27 +00:00
_cargo = [_vehicle, ["cargo", "ffv"], true] call EFUNC(common,getVehicleCrew);
2015-01-11 19:32:51 +00:00
// you can only interact if you are in cargo or ffv yourself. exit otherwise
if !(_unit in _cargo) exitWith {};
2015-01-11 23:13:47 +00:00
GVAR(InteractionMenu_Crew) = _cargo;
2015-01-11 19:32:51 +00:00
// prepare: add header and "OK" button to select menu
private "_actions";
_actions = [localize "STR_ACE_Interaction_InteractionMenu", localize "STR_ACE_Interaction_Interact"] call FUNC(prepareSelectMenu);
2015-01-11 19:32:51 +00:00
// prepare: add all cargo units as options to select menu
{
if (_x != _unit) then {
_actions = [
_actions,
2015-01-13 05:14:27 +00:00
[_x] call EFUNC(common,getName),
QUOTE(PATHTOF(UI\dot_ca.paa)),
2015-01-11 19:32:51 +00:00
_forEachIndex
2015-05-09 01:12:28 +00:00
] call FUNC(addSelectableItem);
2015-01-11 19:32:51 +00:00
};
} forEach _cargo;
// open select menu
[
_actions,
{
2015-01-11 23:13:47 +00:00
call FUNC(hideMenu);
[0, GVAR(InteractionMenu_Crew) select _this, ""] spawn FUNC(showMenu);
GVAR(InteractionMenu_Crew) = nil;
2015-01-11 19:32:51 +00:00
},
{
2015-01-11 23:13:47 +00:00
call FUNC(hideMenu);
2015-01-11 19:32:51 +00:00
}
2015-01-11 23:13:47 +00:00
] call FUNC(openSelectMenu);