2017-05-31 15:02:25 +00:00
|
|
|
/*
|
|
|
|
* Author: Dystopian
|
|
|
|
* Create actions for nearest vehicles with cargo.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Target <OBJECT>
|
|
|
|
* 1: Player <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Children actions <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [target, player] call ace_cargo_fnc_addCargoVehiclesActions
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2017-05-31 22:54:57 +00:00
|
|
|
params ["_target", "_player"];
|
|
|
|
|
2017-05-31 15:02:25 +00:00
|
|
|
private _statement = {
|
|
|
|
params ["_target", "_player", "_params"];
|
|
|
|
_params params ["_vehicle"];
|
|
|
|
[_player, _target, _vehicle] call FUNC(startLoadIn);
|
|
|
|
};
|
|
|
|
|
|
|
|
private _actions = [];
|
|
|
|
|
|
|
|
{
|
|
|
|
private _config = configFile >> "CfgVehicles" >> typeOf _x;
|
2017-05-31 22:54:57 +00:00
|
|
|
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
|
|
|
private _hasCargoConfig = getNumber (_config >> QGVAR(hasCargo)) == 1;
|
|
|
|
if ((_hasCargoPublic || _hasCargoConfig) && {_x != _target}) then {
|
2017-05-31 15:02:25 +00:00
|
|
|
private _name = getText (_config >> "displayName");
|
|
|
|
private _ownerName = [_x, true] call EFUNC(common,getName);
|
|
|
|
if ("" != _ownerName) then {
|
|
|
|
_name = format ["%1 (%2)", _name, _ownerName];
|
|
|
|
};
|
|
|
|
private _icon = (getText (_config >> "icon")) call BIS_fnc_textureVehicleIcon;
|
|
|
|
private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, [_x]] call EFUNC(interact_menu,createAction);
|
|
|
|
_actions pushBack [_action, [], _target];
|
|
|
|
};
|
2017-06-14 13:36:23 +00:00
|
|
|
} forEach (nearestObjects [_player, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE]);
|
2017-05-31 15:02:25 +00:00
|
|
|
|
|
|
|
_actions
|