mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
052f1c95a3
* Add checks for cargo via config * Update fnc_initVehicle.sqf * Use loaded number instead of intended number
47 lines
1.2 KiB
Plaintext
47 lines
1.2 KiB
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)
|
|
* 3: Ignore interaction distance and stability checks <BOOL> (default: false)
|
|
*
|
|
* Return Value:
|
|
* Objects loaded <NUMBER>
|
|
*
|
|
* Example:
|
|
* ["ACE_Wheel", cursorObject] call ace_cargo_fnc_addCargoItem
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_item", "_vehicle", ["_amount", 1], ["_ignoreInteraction", false]];
|
|
TRACE_4("params",_item,_vehicle,_amount,_ignoreInteraction);
|
|
|
|
private _loaded = 0;
|
|
|
|
// Get config sensitive case name
|
|
if (_item isEqualType "") then {
|
|
_item = _item call EFUNC(common,getConfigName);
|
|
|
|
for "_i" from 1 to _amount do {
|
|
if !([_item, _vehicle, _ignoreInteraction] call FUNC(loadItem)) exitWith {};
|
|
|
|
_loaded = _loaded + 1;
|
|
};
|
|
} else {
|
|
_loaded = parseNumber ([_item, _vehicle, _ignoreInteraction] call FUNC(loadItem));
|
|
|
|
_item = typeOf _item;
|
|
};
|
|
|
|
TRACE_1("loaded",_loaded);
|
|
|
|
// Invoke listenable event
|
|
["ace_cargoAdded", [_item, _vehicle, _loaded]] call CBA_fnc_globalEvent;
|
|
|
|
_loaded // return
|