From 81affed86955205eed4496785ff412d8d044c370 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Sat, 26 Sep 2020 15:39:37 +0200 Subject: [PATCH] Support CBA Optics and MRT Accesories Obsoletes #833 --- .../scripts/client/misc/fn_initArsenal.sqf | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Missionframework/scripts/client/misc/fn_initArsenal.sqf b/Missionframework/scripts/client/misc/fn_initArsenal.sqf index 249ccc3a7..1cda14ada 100644 --- a/Missionframework/scripts/client/misc/fn_initArsenal.sqf +++ b/Missionframework/scripts/client/misc/fn_initArsenal.sqf @@ -2,7 +2,7 @@ File: fn_initArsenal.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2020-05-11 - Last Update: 2020-09-16 + Last Update: 2020-09-26 License: MIT License - http://www.opensource.org/licenses/MIT Description: @@ -81,6 +81,35 @@ if (KPLIB_param_useArsenalPreset) then { KPLIB_arsenalAllowed append _disposableLaunchers; }; + { + // Handle CBA optics, https://github.com/CBATeam/CBA_A3/wiki/Scripted-Optics + if (missionNamespace getVariable ["CBA_optics", false]) then { + private _pipOptic = CBA_optics_PIPOptics getVariable _x; + if (!isNil "_pipOptic") then { + KPLIB_arsenalAllowedExtension pushBackUnique _pipOptic; + }; + + private _nonPipOptic = CBA_optics_NonPIPOptics getVariable _x; + if (!isNil "_nonPipOptic") then { + KPLIB_arsenalAllowedExtension pushBackUnique _nonPipOptic; + }; + }; + + // Handle CBA (MRT) Accessories, https://github.com/CBATeam/CBA_A3/wiki/Accessory-Functions + private _itemCfg = configFile >> "CfgWeapons" >> "CUP_optic_ACOG_TA01B_OD_3D"; + if (!isNull _itemCfg) then { + private _nextItem = getText (_cfg >> "MRT_SwitchItemPrevClass"); + if (_nextItem != "") then { + KPLIB_arsenalAllowedExtension pushBackUnique _nextItem; + }; + + private _prevItem = getText (_cfg >> "MRT_SwitchItemNextClass"); + if (_prevItem != "") then { + KPLIB_arsenalAllowedExtension pushBackUnique _prevItem; + }; + }; + } forEach KPLIB_arsenalAllowed; + KPLIB_arsenalAllowed append KPLIB_arsenalAllowedExtension; if (KPLIB_ace && KPLIB_param_arsenalType) then {[player, KPLIB_arsenalAllowed, false] call ace_arsenal_fnc_addVirtualItems;};