mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
9f291c86d8
* Add submenu with vehicles to cargo load menu * replace private ARRAY with keyword * fix ace function macro using * filter vehicles without cargo * add Load condition, clean params, fix param reusing * replace nearEntities with nearestObjects, add macro * optimize, del magic, replace count with forEach * del unused functions * del useless _this parameter
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
/*
|
|
* 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"
|
|
|
|
private _statement = {
|
|
params ["_target", "_player", "_params"];
|
|
_params params ["_vehicle"];
|
|
[_player, _target, _vehicle] call FUNC(startLoadIn);
|
|
};
|
|
|
|
private _actions = [];
|
|
|
|
{
|
|
private _config = configFile >> "CfgVehicles" >> typeOf _x;
|
|
if (
|
|
1 == getNumber (_config >> QGVAR(hasCargo)) &&
|
|
{_x != _target}
|
|
) then {
|
|
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];
|
|
};
|
|
} forEach (nearestObjects [_player, CARGO_VEHICLE_CLASSES, MAX_LOAD_DISTANCE]);
|
|
|
|
_actions
|