2015-12-07 16:24:52 +00:00
|
|
|
/*
|
|
|
|
Author: Aaron Clark - EpochMod.com
|
|
|
|
|
2017-08-01 02:00:28 +00:00
|
|
|
Contributors: Raimonds Virtoss
|
2015-12-07 16:24:52 +00:00
|
|
|
|
|
|
|
Description:
|
|
|
|
Epoch add item with overflow
|
|
|
|
|
|
|
|
Licence:
|
|
|
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
|
|
|
|
|
|
|
Github:
|
2016-06-13 16:54:19 +00:00
|
|
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fnc_addItemOverflow.sqf
|
2015-12-07 16:24:52 +00:00
|
|
|
|
|
|
|
Example:
|
|
|
|
_fish call EPOCH_fnc_addItemOverflow;
|
|
|
|
|
|
|
|
Parameter(s):
|
2016-04-08 20:21:46 +00:00
|
|
|
_this select 0: STRING - Item Class
|
|
|
|
_this select 1: NUMBER - (Optional) Ammo count
|
2015-12-07 16:24:52 +00:00
|
|
|
|
|
|
|
Returns:
|
2017-08-01 02:00:28 +00:00
|
|
|
BOOL True: item was dropped nearby
|
|
|
|
False: item was added to inventory
|
2015-12-07 16:24:52 +00:00
|
|
|
*/
|
2016-09-01 00:29:08 +00:00
|
|
|
//[[[cog import generate_private_arrays ]]]
|
2017-08-01 02:00:28 +00:00
|
|
|
private ["_dropped","_nearByHolder","_wH","_wHPos"];
|
2016-09-01 00:29:08 +00:00
|
|
|
//[[[end]]]
|
2016-04-24 22:44:11 +00:00
|
|
|
params [["_item","",[""]],["_count",1]];
|
2017-08-01 02:00:28 +00:00
|
|
|
_dropped = false;
|
2016-04-24 22:44:11 +00:00
|
|
|
for "_i" from 1 to _count do
|
|
|
|
{
|
|
|
|
if (player canAdd _item) then {
|
2016-04-08 20:21:46 +00:00
|
|
|
player addItem _item;
|
|
|
|
} else {
|
2016-04-24 22:44:11 +00:00
|
|
|
_wH = objNull;
|
|
|
|
if (isNil "_nearByHolder") then {
|
2017-09-02 22:06:27 +00:00
|
|
|
_nearByHolder = nearestObjects [player,["groundWeaponHolder"],3];
|
2016-04-24 22:44:11 +00:00
|
|
|
};
|
|
|
|
if (_nearByHolder isEqualTo []) then {
|
|
|
|
_wHPos = player modelToWorld [0,1,0];
|
|
|
|
if (surfaceIsWater _wHPos) then {
|
|
|
|
_wHPos = ASLToATL _wHPos;
|
|
|
|
};
|
|
|
|
_wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"];
|
|
|
|
} else {
|
|
|
|
_wH = _nearByHolder select 0;
|
|
|
|
};
|
|
|
|
if !(isNull _wh) then {
|
|
|
|
_wh addItemCargoGlobal [_item,1];
|
|
|
|
};
|
2017-08-01 02:00:28 +00:00
|
|
|
_dropped = true;
|
2016-04-08 20:21:46 +00:00
|
|
|
};
|
2015-10-12 19:15:10 +00:00
|
|
|
};
|
2017-08-01 02:00:28 +00:00
|
|
|
_dropped
|