Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common - Improve CBA_fnc_addItem, Fix CBA_fnc_addMagazine return #1562

Merged
merged 2 commits into from
Jun 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions addons/common/fnc_addItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,21 @@ if (_verify) then {
_unit addItem _item;
_return = true;
} else {
_unit switchMove "ainvpknlmstpslaywrfldnon_1";
private _vehicle = vehicle _unit;
if (_vehicle isEqualTo _unit) then {
_unit switchMove "ainvpknlmstpslaywrfldnon_1";

private _weaponHolder = nearestObject [_unit, "WeaponHolder"];
private _weaponHolder = nearestObject [_unit, "WeaponHolder"];

if (isNull _weaponHolder || {_unit distance _weaponHolder > 2}) then {
_weaponHolder = createVehicle ["GroundWeaponHolder", [0,0,0], [], 0, "NONE"];
_weaponHolder setPosASL getPosASL _unit;
};
if (isNull _weaponHolder || {_unit distance _weaponHolder > 2}) then {
_weaponHolder = createVehicle ["GroundWeaponHolder", [0,0,0], [], 0, "NONE"];
_weaponHolder setPosASL getPosASL _unit;
};

[_weaponHolder, _item] call CBA_fnc_addItemCargo;
_return = [_weaponHolder, _item, 1, _verify] call CBA_fnc_addItemCargo;
} else {
_return = [_vehicle, _item, 1, _verify] call CBA_fnc_addItemCargo;
};
};
} else {
_unit addItem _item;
Expand Down