2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2017-05-31 15:02:25 +00:00
|
|
|
/*
|
|
|
|
* Author: Dystopian
|
|
|
|
* Create actions for nearest vehicles with cargo.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Target <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2017-09-29 20:00:47 +00:00
|
|
|
* Child actions <ARRAY>
|
2017-05-31 15:02:25 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2017-09-29 20:00:47 +00:00
|
|
|
* [cursorObject] call ace_cargo_fnc_addCargoVehiclesActions
|
2017-05-31 15:02:25 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2017-09-29 20:00:47 +00:00
|
|
|
params ["_target"];
|
2017-05-31 22:54:57 +00:00
|
|
|
|
2017-05-31 15:02:25 +00:00
|
|
|
private _statement = {
|
2017-09-29 20:00:47 +00:00
|
|
|
params ["_target", "_player", "_vehicle"];
|
2017-05-31 15:02:25 +00:00
|
|
|
[_player, _target, _vehicle] call FUNC(startLoadIn);
|
|
|
|
};
|
|
|
|
|
2017-11-10 14:28:12 +00:00
|
|
|
private _vehicles = (nearestObjects [_target, GVAR(cargoHolderTypes), (MAX_LOAD_DISTANCE + 10)]) select {
|
2017-09-29 20:00:47 +00:00
|
|
|
private _hasCargoConfig = 1 == getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(hasCargo));
|
2017-05-31 22:54:57 +00:00
|
|
|
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
2019-02-23 00:54:55 +00:00
|
|
|
(_hasCargoConfig || {_hasCargoPublic}) && {_x != _target} && {alive _x} && {locked _x < 2} &&
|
2017-11-10 14:28:12 +00:00
|
|
|
{([_target, _x] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
|
2017-09-29 20:00:47 +00:00
|
|
|
};
|
2017-05-31 15:02:25 +00:00
|
|
|
|
2017-09-29 20:00:47 +00:00
|
|
|
[_vehicles, _statement, _target] call EFUNC(interact_menu,createVehiclesActions)
|