mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
fix unloading to units with full inventory
This commit is contained in:
parent
39f200b941
commit
78800be9ab
@ -24,7 +24,9 @@ private _carryMaxAmmo = getNumber (configFile >> "CfgMagazines" >> _carryMag >>
|
||||
private _fullMagazines = floor (_ammo / _carryMaxAmmo);
|
||||
private _bulletsRemaining = _ammo % _carryMaxAmmo;
|
||||
|
||||
if (_unloadTo isKindOf "CAManBase") then {
|
||||
private _unloadToUnit = _unloadTo isKindOf "CAManBase";
|
||||
|
||||
if (_unloadToUnit) then {
|
||||
while {(_fullMagazines > 0) && {[_unloadTo, _carryMag] call CBA_fnc_canAddItem}} do {
|
||||
_unloadTo addMagazine [_carryMag, _carryMaxAmmo];
|
||||
_fullMagazines = _fullMagazines - 1;
|
||||
@ -38,7 +40,7 @@ if (_unloadTo isKindOf "CAManBase") then {
|
||||
if ((_fullMagazines == 0) && {_bulletsRemaining == 0}) exitWith {};
|
||||
|
||||
// Try to use object inventory or existing container
|
||||
private _container = _unloadTo;
|
||||
private _container = [_unloadTo, objNull] select _unloadToUnit;
|
||||
if ((maxLoad _container) isEqualTo 0) then {
|
||||
_container = _unloadTo getVariable [QGVAR(container), objNull];
|
||||
if ((_container distance _unloadTo) > 10) then { _container = objNull; };
|
||||
|
Loading…
x
Reference in New Issue
Block a user