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", {
|
|
|
|
(_this select 0) params ["_item","_vehicle"];
|
|
|
|
private ["_loaded", "_hint", "_itemName", "_vehicleName"];
|
|
|
|
|
|
|
|
_loaded = [_item, _vehicle] call FUNC(loadItem);
|
|
|
|
|
|
|
|
// Show hint as feedback
|
|
|
|
_hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded;
|
|
|
|
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
|
|
|
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
|
|
|
|
|
|
|
["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", {
|
|
|
|
(_this select 0) params ["_item","_vehicle"];
|
|
|
|
private ["_unloaded", "_itemClass", "_hint", "_itemName", "_vehicleName"];
|
|
|
|
|
|
|
|
_unloaded = [_item, _vehicle] call FUNC(unloadItem);
|
|
|
|
|
2015-11-20 17:40:31 +00:00
|
|
|
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
|
2015-09-27 16:19:40 +00:00
|
|
|
|
|
|
|
// Show hint as feedback
|
|
|
|
_hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded;
|
|
|
|
_itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
|
|
|
|
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
|
|
|
|
|
|
|
["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);
|