Grenades - Use fnc_addToInventory (#8016)

* Try and put converted item back in the same container

* Update addons/grenades/functions/fnc_addChangeFuseItemContextMenuOptions.sqf

Co-authored-by: Dystopian <sddex@ya.ru>

* Update addons/grenades/functions/fnc_addChangeFuseItemContextMenuOptions.sqf

Co-authored-by: Dystopian <sddex@ya.ru>

* Less hacky handling of container names

* Return value convention

Co-authored-by: Dystopian <sddex@ya.ru>
This commit is contained in:
Cyruz143 2020-12-20 23:15:46 +00:00 committed by GitHub
parent 50f740f9be
commit 8eccabbc0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,9 +33,25 @@
}
],
{
params ["_unit", "", "", "", "_magArr"];
_unit addMagazine (_magArr select 1);
false;
params ["_unit", "", "", "_slot", "_magArr"];
private _container = "";
switch _slot do {
case "UNIFORM_CONTAINER": {
_container = "uniform";
};
case "VEST_CONTAINER": {
_container = "vest";
};
case "BACKPACK_CONTAINER": {
_container = "backpack";
};
};
if (_container != "") then {
[_unit, _magArr select 1, _container] call EFUNC(common,addToInventory);
};
false
},
true,
[_mag,_throwableMag]
@ -55,9 +71,25 @@
}
],
{
params ["_unit", "", "", "", "_magArr"];
_unit addMagazine (_magArr select 0);
false;
params ["_unit", "", "", "_slot", "_magArr"];
private _container = "";
switch _slot do {
case "UNIFORM_CONTAINER": {
_container = "uniform";
};
case "VEST_CONTAINER": {
_container = "vest";
};
case "BACKPACK_CONTAINER": {
_container = "backpack";
};
};
if (_container != "") then {
[_unit, _magArr select 0, _container] call EFUNC(common,addToInventory);
};
false
},
true,
[_mag,_throwableMag]