item overflow support for spawning count of items or weapons

This commit is contained in:
vbawol 2016-04-24 17:44:11 -05:00
parent 5744be50d3
commit 14ea6a44dc

View File

@ -23,17 +23,16 @@
BOOL BOOL
*/ */
private ["_wHPos","_wH","_nearByHolder"]; private ["_wHPos","_wH","_nearByHolder"];
params [["_item","",[""]],["_count",0]]; params [["_item","",[""]],["_count",1]];
for "_i" from 1 to _count do
{
if (player canAdd _item) then { if (player canAdd _item) then {
if (_count >= 1) then {
player addMagazine [_item, _count];
} else {
player addItem _item; player addItem _item;
};
} else { } else {
_wH = objNull; _wH = objNull;
if (isNil "_nearByHolder") then {
_nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3]; _nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3];
};
if (_nearByHolder isEqualTo []) then { if (_nearByHolder isEqualTo []) then {
_wHPos = player modelToWorld [0,1,0]; _wHPos = player modelToWorld [0,1,0];
if (surfaceIsWater _wHPos) then { if (surfaceIsWater _wHPos) then {
@ -43,11 +42,9 @@ if (player canAdd _item) then {
} else { } else {
_wH = _nearByHolder select 0; _wH = _nearByHolder select 0;
}; };
if !(isNull _wh) then {
if (_count >= 1) then {
_wh addMagazineAmmoCargo[_item, 1, _count];
} else {
_wh addItemCargoGlobal [_item,1]; _wh addItemCargoGlobal [_item,1];
}; };
}; };
};
true true