Epoch/Sources/epoch_code/compile/functions/EPOCH_fnc_addItemOverflow.sqf

44 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-12-07 16:24:52 +00:00
/*
Author: Aaron Clark - EpochMod.com
Contributors:
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:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/functions/EPOCH_fnc_addItemOverflow.sqf
Example:
_fish call EPOCH_fnc_addItemOverflow;
Parameter(s):
_this: STRING - Item Class
Returns:
2016-01-18 16:52:15 +00:00
BOOL
2015-12-07 16:24:52 +00:00
*/
2015-10-12 19:15:10 +00:00
private ["_wHPos","_wH","_nearByHolder","_item"];
2016-01-18 16:52:15 +00:00
if (_this isEqualTo "") exitWith{false};
2015-10-12 19:15:10 +00:00
_item = _this;
if (player canAdd _item) then {
2016-01-18 16:52:15 +00:00
player addItem _item;
2015-10-12 19:15:10 +00:00
} else {
2016-01-18 16:52:15 +00:00
_wH = objNull;
_nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3];
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;
2015-10-12 19:15:10 +00:00
};
2016-01-18 16:52:15 +00:00
_wh addItemCargoGlobal [_item,1];
2015-10-12 19:15:10 +00:00
};
2016-01-18 16:52:15 +00:00
true