ACE3/addons/cargo/functions/fnc_startUnload.sqf

36 lines
699 B
Plaintext
Raw Normal View History

2015-08-10 21:07:47 +00:00
/*
* Author: Glowbal
2015-08-16 20:41:35 +00:00
* Start unload action.
2015-08-10 21:07:47 +00:00
*
* Arguments:
* None
*
* Return value:
* None
*
2015-08-16 20:41:35 +00:00
* Example:
* [] call ace_cargo_fnc_startUnload
*
2015-08-10 21:07:47 +00:00
* Public: No
*/
#include "script_component.hpp"
2015-08-14 20:01:14 +00:00
private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
2015-08-16 20:41:35 +00:00
2015-08-10 21:07:47 +00:00
disableSerialization;
2015-08-16 20:41:35 +00:00
_display = uiNamespace getVariable QGVAR(menuDisplay);
if (isnil "_display") exitWith {};
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
if (count _loaded == 0) exitWith {};
2015-08-10 21:07:47 +00:00
_ctrl = _display displayCtrl 100;
_selected = (lbCurSel _ctrl) max 0;
2015-08-16 20:41:35 +00:00
if (count _loaded <= _selected) exitWith {};
2015-08-10 21:07:47 +00:00
_item = _loaded select _selected;
[_item, GVAR(interactionVehicle)] call FUNC(unloadItem);