Gunbag - Add check for weapon in virtual items on loadout set (#9358)

* add check for weapon in arsenal virtual items

* fix variable

Co-authored-by: BrettMayson <brett@mayson.io>

* add INFO

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

---------

Co-authored-by: BrettMayson <brett@mayson.io>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
Grim 2023-09-01 16:52:45 -04:00 committed by GitHub
parent beb4ec8f06
commit 8439a931e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,13 @@ PREP_RECOMPILE_END;
params ["_unit", "_loadout", "_extendedInfo"]; params ["_unit", "_loadout", "_extendedInfo"];
private _gunbagWeapon = _extendedInfo getOrDefault [QGVAR(gunbagWeapon), []]; private _gunbagWeapon = _extendedInfo getOrDefault [QGVAR(gunbagWeapon), []];
if (_gunbagWeapon isNotEqualTo []) then { if (_gunbagWeapon isNotEqualTo []) then {
if (!isNil QEGVAR(arsenal,virtualItemsFlatAll)) then {
private _weapon = (_gunbagWeapon select 0) call EFUNC(arsenal,baseWeapon);
if !(_weapon in EGVAR(arsenal,virtualItemsFlatAll)) then {
INFO_1("removing [%1] from loadout",_gunbagWeapon);
_gunbagWeapon = [];
};
};
(backpackContainer _unit) setVariable [QGVAR(gunbagWeapon), _gunbagWeapon, true]; (backpackContainer _unit) setVariable [QGVAR(gunbagWeapon), _gunbagWeapon, true];
}; };
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;