ACE3/addons/cargo/functions/fnc_addCargoItem.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

38 lines
848 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Glowbal, Jonpas
* Adds a cargo item to the vehicle.
*
* Arguments:
* 0: Item to be loaded <STRING> or <OBJECT>
* 1: Holder object (vehicle) <OBJECT>
* 2: Amount <NUMBER> (default: 1)
*
* Return Value:
* None
*
* Example:
* ["ACE_Wheel", cursorObject] call ace_cargo_fnc_addCargoItem
*
* Public: No
*/
params ["_item", "_vehicle", ["_amount", 1]];
TRACE_3("params",_item,_vehicle,_amount);
// Get config sensitive case name
if (_item isEqualType "") then {
_item = _item call EFUNC(common,getConfigName);
for "_i" from 1 to _amount do {
[_item, _vehicle] call FUNC(loadItem);
};
} else {
[_item, _vehicle] call FUNC(loadItem);
_item = typeOf _item;
};
// Invoke listenable event
["ace_cargoAdded", [_item, _vehicle, _amount]] call CBA_fnc_globalEvent;