2015-08-18 16:48:21 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-22 14:45:50 +00:00
|
|
|
["AddCargoByClass", {_this call FUNC(addCargoItem)}] call EFUNC(common,addEventHandler);
|
2015-09-27 16:19:40 +00:00
|
|
|
|
|
|
|
["LoadCargo", {
|
2016-02-23 23:24:51 +00:00
|
|
|
params ["_item", "_vehicle"];
|
2016-01-27 20:56:25 +00:00
|
|
|
TRACE_2("LoadCargo EH",_item,_vehicle);
|
2015-09-27 16:19:40 +00:00
|
|
|
|
2016-01-19 03:53:48 +00:00
|
|
|
private _loaded = [_item, _vehicle] call FUNC(loadItem);
|
2015-09-27 16:19:40 +00:00
|
|
|
|
|
|
|
// Show hint as feedback
|
2016-01-19 03:53:48 +00:00
|
|
|
private _hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded;
|
|
|
|
private _itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
|
|
|
private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
2015-09-27 16:19:40 +00:00
|
|
|
|
|
|
|
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
|
|
|
|
|
|
|
if (_loaded) then {
|
|
|
|
// Invoke listenable event
|
|
|
|
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
|
|
|
};
|
|
|
|
}] call EFUNC(common,addEventHandler);
|
|
|
|
|
|
|
|
["UnloadCargo", {
|
2016-02-23 23:24:51 +00:00
|
|
|
params ["_item", "_vehicle", ["_unloader", objNull]];
|
2016-01-27 20:56:25 +00:00
|
|
|
TRACE_3("UnloadCargo EH",_item,_vehicle,_unloader);
|
2016-02-23 21:05:15 +00:00
|
|
|
|
2016-01-27 20:56:25 +00:00
|
|
|
private _unloaded = [_item, _vehicle, _unloader] call FUNC(unloadItem); //returns true if sucessful
|
2015-09-27 16:19:40 +00:00
|
|
|
|
2016-01-19 03:53:48 +00:00
|
|
|
private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
|
2015-09-27 16:19:40 +00:00
|
|
|
|
|
|
|
// Show hint as feedback
|
2016-01-19 03:53:48 +00:00
|
|
|
private _hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded;
|
|
|
|
private _itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
|
|
|
|
private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
2015-09-27 16:19:40 +00:00
|
|
|
|
|
|
|
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
|
|
|
|
|
|
|
if (_unloaded) then {
|
|
|
|
// Invoke listenable event
|
|
|
|
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
|
|
|
};
|
|
|
|
|
|
|
|
// TOOO maybe drag/carry the unloaded item?
|
|
|
|
}] call EFUNC(common,addEventHandler);
|
2016-02-23 21:05:15 +00:00
|
|
|
|
|
|
|
["ServerUnloadCargo", {
|
|
|
|
params ["_item", "_emptyPosAGL"];
|
|
|
|
|
|
|
|
_item hideObjectGlobal false;
|
|
|
|
_item setPosASL (AGLtoASL _emptyPosAGL);
|
|
|
|
}] call EFUNC(common,addEventHandler);
|