mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Common - Use canAdd for FUNC(addToInventory)
This commit is contained in:
parent
78334e2be4
commit
b8e845a56b
@ -29,16 +29,16 @@ private _addedToUnit = false;
|
|||||||
|
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": {
|
case "vest": {
|
||||||
_canAdd = [_unit, _classname, 1, false, true, false] call CBA_fnc_canAddItem;
|
_canAdd = (vestContainer _unit) canAdd _classname;
|
||||||
};
|
};
|
||||||
case "backpack": {
|
case "backpack": {
|
||||||
_canAdd = [_unit, _classname, 1, false, false, true] call CBA_fnc_canAddItem;
|
_canAdd = (backpackContainer _unit) canAdd _classname;
|
||||||
};
|
};
|
||||||
case "uniform": {
|
case "uniform": {
|
||||||
_canAdd = [_unit, _classname, 1, true, false, false] call CBA_fnc_canAddItem;
|
_canAdd = (uniformContainer _unit) canAdd _classname;
|
||||||
};
|
};
|
||||||
default {
|
default {
|
||||||
_canAdd = [_unit, _classname] call CBA_fnc_canAddItem;
|
_canAdd = [_unit, _classname] call CBA_fnc_canAddItem; // replace with canAdd with ignoreMaxSoldierLoad in 2.18
|
||||||
if (_canAdd) then {
|
if (_canAdd) then {
|
||||||
switch (_type select 1) do {
|
switch (_type select 1) do {
|
||||||
case "primary": {
|
case "primary": {
|
||||||
@ -78,16 +78,10 @@ switch (_type select 0) do {
|
|||||||
_unit addWeaponGlobal _classname;
|
_unit addWeaponGlobal _classname;
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
_x params ["_parameters", "_container"];
|
if (_x canAdd _classname) exitWith {
|
||||||
|
_x addWeaponCargoGlobal [_classname, 1]; // addWeaponGlobal will replace the weapon currently in a slot
|
||||||
if (_parameters call CBA_fnc_canAddItem) exitWith {
|
|
||||||
_container addWeaponCargoGlobal [_classname, 1]; // addWeaponGlobal will replace the weapon currently in a slot
|
|
||||||
};
|
};
|
||||||
} forEach [
|
} forEach [backpackContainer _unit, vestContainer _unit, uniformContainer _unit];
|
||||||
[[_unit, _classname, 1, false, false, true], backpackContainer _unit],
|
|
||||||
[[_unit, _classname, 1, false, true, false], vestContainer _unit],
|
|
||||||
[[_unit, _classname, 1, true, false, false], uniformContainer _unit]
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user