ACE3/addons/cargo/functions/fnc_addCargoVehiclesActions.sqf
johnb432 d1f0dc5e83
Cargo - Improve various aspects (#9617)
* Update CfgVehicles.hpp

* Cargo cleanup

* Update menu.hpp

* Updated status effect key

* Update fnc_onMenuOpen.sqf

* Update fnc_onMenuOpen.sqf

* fix comment from merge

* nil interaction GVARs on menu close

* fix carry bug

* Fix floating objects in MP

* Updated ace_cargoAdded doc

* Fix progress bar prematurely stopping

* Finer cursor object selection

---------

Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
2023-11-17 20:07:28 -03:00

35 lines
893 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Dystopian
* Creates actions for nearest vehicles with cargo.
*
* Arguments:
* 0: Holder object (vehicle) <OBJECT>
*
* Return Value:
* Child actions <ARRAY>
*
* Example:
* cursorObject call ace_cargo_fnc_addCargoVehiclesActions
*
* Public: No
*/
params ["_vehicle"];
private _statement = {
params ["_item", "_loader", "_vehicle"];
[_loader, _item, _vehicle] call FUNC(startLoadIn);
};
private _vehicles = (nearestObjects [_vehicle, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE + 10]) select {
_x != _vehicle &&
{alive _x} &&
{locked _x < 2} &&
{_x getVariable [QGVAR(hasCargo), getNumber (configOf _x >> QGVAR(hasCargo)) == 1]} &&
{([_vehicle, _x] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
};
[_vehicles, _statement, _vehicle] call EFUNC(interact_menu,createVehiclesActions)