diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp index cfaa6c3259..5c66196f4a 100644 --- a/addons/logistics_wirecutter/CfgWeapons.hpp +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -8,6 +8,7 @@ class CfgWeapons { descriptionShort = CSTRING(wirecutterDescription); model = QPATHTOF(data\ace_wirecutter.p3d); picture = QPATHTOF(ui\item_wirecutter_ca.paa); + ACE_isWirecutter = 1; scope = 2; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 25; diff --git a/addons/logistics_wirecutter/XEH_postInit.sqf b/addons/logistics_wirecutter/XEH_postInit.sqf index a22479e7e1..29dc506396 100644 --- a/addons/logistics_wirecutter/XEH_postInit.sqf +++ b/addons/logistics_wirecutter/XEH_postInit.sqf @@ -7,3 +7,5 @@ if (hasInterface) then { if (isServer) then { [QGVAR(destroyFence), {_this call FUNC(destroyFence)}] call CBA_fnc_addEventHandler; }; + +GVAR(possibleWirecutters) = call (uiNamespace getVariable [QGVAR(possibleWirecutters), {[]}]); diff --git a/addons/logistics_wirecutter/XEH_preStart.sqf b/addons/logistics_wirecutter/XEH_preStart.sqf index 022888575e..75567fe26e 100644 --- a/addons/logistics_wirecutter/XEH_preStart.sqf +++ b/addons/logistics_wirecutter/XEH_preStart.sqf @@ -1,3 +1,7 @@ #include "script_component.hpp" #include "XEH_PREP.hpp" + +// Cache wirecutter item classes, see XEH_postInit.sqf +private _possibleWirecutters = ("getNumber (_x >> 'ACE_isWirecutter') == 1" configClasses (configFile >> "CfgWeapons")) apply {configName _x}; +uiNamespace setVariable [QGVAR(possibleWirecutters), compileFinal str _possibleWirecutters]; diff --git a/addons/logistics_wirecutter/script_component.hpp b/addons/logistics_wirecutter/script_component.hpp index a499b6ae32..7335ef2e57 100644 --- a/addons/logistics_wirecutter/script_component.hpp +++ b/addons/logistics_wirecutter/script_component.hpp @@ -88,7 +88,7 @@ #define CUT_TIME_ENGINEER 7.5 #define HAS_WIRECUTTER(unit) (\ - "ACE_wirecutter" in (unit call EFUNC(common,uniqueItems)) \ + ((unit call EFUNC(common,uniqueItems)) arrayIntersect GVAR(possibleWirecutters)) isNotEqualTo []\ || {getNumber ((configOf (backpackContainer unit)) >> QGVAR(hasWirecutter)) == 1} \ || {getNumber (configFile >> "CfgWeapons" >> (vest unit) >> QGVAR(hasWirecutter)) == 1} \ )