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);
|
2015-09-27 16:19:40 +00:00
|
|
|
if (isNil "_display") exitWith {};
|
2015-08-16 20:41:35 +00:00
|
|
|
|
|
|
|
_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;
|
|
|
|
|
2015-09-27 16:19:40 +00:00
|
|
|
|
|
|
|
// Start progress bar
|
|
|
|
private ["_size", "_itemClass", "_displayName"];
|
|
|
|
|
|
|
|
if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then {
|
|
|
|
_size = [_item] call FUNC(getSizeItem);
|
|
|
|
|
|
|
|
[5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar);
|
|
|
|
} else {
|
|
|
|
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
|
|
|
_displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
|
|
|
|
|
|
|
|
["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
|
|
|
|
};
|