2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2017-09-21 14:19:49 +00:00
|
|
|
/*
|
|
|
|
* Author: 654wak654
|
|
|
|
* Loads the object module is placed on into selected vehicle.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Module logic <OBJECT>
|
|
|
|
* 1: Synchronized units <ARRAY>
|
|
|
|
* 2: Activated <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [LOGIC, [bob, kevin], true] call ace_zeus_fnc_moduleLoadIntoCargo
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2017-10-24 19:11:16 +00:00
|
|
|
if (canSuspend) exitWith {[FUNC(moduleLoadIntoCargo), _this] call CBA_fnc_directCall;};
|
2017-09-21 14:19:49 +00:00
|
|
|
|
2017-12-10 18:29:38 +00:00
|
|
|
params ["_logic"];
|
2017-09-21 14:19:49 +00:00
|
|
|
|
2017-12-10 18:29:38 +00:00
|
|
|
if !(local _logic) exitWith {};
|
2017-09-21 14:19:49 +00:00
|
|
|
|
|
|
|
private _cargo = attachedTo _logic;
|
|
|
|
|
|
|
|
deleteVehicle _logic;
|
|
|
|
|
|
|
|
if !(missionNamespace getVariable [QEGVAR(cargo,enable), false]) exitWith {
|
|
|
|
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
|
|
|
};
|
|
|
|
if (isNull _cargo) exitWith {
|
|
|
|
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
|
|
|
};
|
|
|
|
if (!alive _cargo) exitWith {
|
|
|
|
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
|
|
|
};
|
|
|
|
|
|
|
|
[
|
|
|
|
_cargo,
|
|
|
|
{
|
|
|
|
params ["_successful", "_cargo", "_mousePosASL"];
|
|
|
|
if (!_successful) exitWith {};
|
|
|
|
|
2019-01-31 00:30:42 +00:00
|
|
|
private _holder = (nearestObjects [ASLToAGL _mousePosASL, EGVAR(cargo,cargoHolderTypes), 15, true]) param [0, objNull]; // 2d distance search
|
2017-09-21 14:19:49 +00:00
|
|
|
if (isNull _holder) exitWith {
|
|
|
|
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
|
|
|
};
|
|
|
|
if (!alive _holder) exitWith {
|
|
|
|
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
|
|
|
};
|
|
|
|
|
|
|
|
private _displayName = [_cargo] call EFUNC(common,getName);
|
2018-07-21 23:07:16 +00:00
|
|
|
if ([_cargo, _holder, true] call EFUNC(cargo,loadItem)) then {
|
2017-09-21 14:19:49 +00:00
|
|
|
private _loadedItem = [localize ELSTRING(cargo,LoadedItem), "<br/>", " "] call CBA_fnc_replace;
|
|
|
|
private _holderDisplayName = [_holder] call EFUNC(common,getName);
|
|
|
|
[_loadedItem, _displayName, _holderDisplayName] call FUNC(showMessage);
|
2020-04-18 21:14:54 +00:00
|
|
|
["ace_cargoLoaded", [_cargo, _holder]] call CBA_fnc_globalEvent;
|
2017-09-21 14:19:49 +00:00
|
|
|
} else {
|
|
|
|
private _loadingFailed = [localize ELSTRING(cargo,LoadingFailed), "<br/>", " "] call CBA_fnc_replace;
|
|
|
|
[_loadingFailed, _displayName] call FUNC(showMessage);
|
|
|
|
};
|
|
|
|
},
|
|
|
|
localize LSTRING(ModuleLoadIntoCargo_DisplayName),
|
|
|
|
"a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa"
|
|
|
|
] call FUNC(getModuleDestination);
|