From 4bbb8eb90b3182e334d5521e2e4a92bd181fbbed Mon Sep 17 00:00:00 2001 From: jonpas Date: Thu, 14 Sep 2023 04:04:39 +0200 Subject: [PATCH] Revert inventory monitoring PFH switch to CBA loadout EH --- addons/ace_interact/XEH_postInitClient.sqf | 1 - addons/api/fnc_setItemRadioReplacement.sqf | 4 ++-- addons/sys_core/fnc_arsenalClose.sqf | 2 -- addons/sys_gui/fnc_inventoryListMouseUp.sqf | 1 - addons/sys_radio/XEH_PREP.hpp | 2 +- addons/sys_radio/fnc_monitorRadios.sqf | 4 ++-- ...fnc_monitorRadiosHandler.sqf => fnc_monitorRadiosPFH.sqf} | 5 +++-- 7 files changed, 8 insertions(+), 11 deletions(-) rename addons/sys_radio/{fnc_monitorRadiosHandler.sqf => fnc_monitorRadiosPFH.sqf} (96%) diff --git a/addons/ace_interact/XEH_postInitClient.sqf b/addons/ace_interact/XEH_postInitClient.sqf index 090ace094..12872bf97 100644 --- a/addons/ace_interact/XEH_postInitClient.sqf +++ b/addons/ace_interact/XEH_postInitClient.sqf @@ -10,7 +10,6 @@ if (!hasInterface) exitWith {}; ["ace_arsenal_displayClosed", { EGVAR(sys_core,arsenalOpen) = false; - [] call DFUNC(monitorRadiosHandler); }] call CBA_fnc_addEventHandler; ["ace_arsenal_rightPanelFilled", { diff --git a/addons/api/fnc_setItemRadioReplacement.sqf b/addons/api/fnc_setItemRadioReplacement.sqf index 70dcc4d1a..ac182dd59 100644 --- a/addons/api/fnc_setItemRadioReplacement.sqf +++ b/addons/api/fnc_setItemRadioReplacement.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: ACRE2Team - * DEPRECATED + * DEPRECATED! Replaced by CBA Setting. * Set the radio type to replace "ItemRadio" in unit inventories. By default this is the "ACRE_PRC343" * * Arguments: @@ -13,7 +13,7 @@ * Example: * ["ACRE_PRC148"] call acre_api_fnc_setItemRadioReplacement; * - * Public: No + * Public: Yes */ ACRE_DEPRECATED(QFUNC(setItemRadioReplacement),"2.12","CBA Setting") diff --git a/addons/sys_core/fnc_arsenalClose.sqf b/addons/sys_core/fnc_arsenalClose.sqf index e0f492de9..4fb243e1a 100644 --- a/addons/sys_core/fnc_arsenalClose.sqf +++ b/addons/sys_core/fnc_arsenalClose.sqf @@ -33,5 +33,3 @@ private _weapons = [acre_player] call EFUNC(sys_core,getGear); ACRE_ARSENAL_RADIOS = []; GVAR(arsenalRadios) = []; GVAR(arsenalOpen) = false; - -[] call EFUNC(sys_radio,monitorRadiosHandler); diff --git a/addons/sys_gui/fnc_inventoryListMouseUp.sqf b/addons/sys_gui/fnc_inventoryListMouseUp.sqf index 60367b479..2cc4fa8c8 100644 --- a/addons/sys_gui/fnc_inventoryListMouseUp.sqf +++ b/addons/sys_gui/fnc_inventoryListMouseUp.sqf @@ -23,5 +23,4 @@ params ["", "_button"]; if (_button == 1) then { LOG("inventoryListMouseUp"); ACRE_HOLD_OFF_ITEMRADIO_CHECK = false; - [] call EFUNC(sys_radio,monitorRadiosHandler); }; diff --git a/addons/sys_radio/XEH_PREP.hpp b/addons/sys_radio/XEH_PREP.hpp index d981abb6b..5ee762dd5 100644 --- a/addons/sys_radio/XEH_PREP.hpp +++ b/addons/sys_radio/XEH_PREP.hpp @@ -1,5 +1,5 @@ PREP(monitorRadios); -PREP(monitorRadiosHandler); +PREP(monitorRadiosPFH); PREP(setActiveRadio); PREP(openRadio); diff --git a/addons/sys_radio/fnc_monitorRadios.sqf b/addons/sys_radio/fnc_monitorRadios.sqf index f7fc0c9c6..11df1a107 100644 --- a/addons/sys_radio/fnc_monitorRadios.sqf +++ b/addons/sys_radio/fnc_monitorRadios.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: ACRE2Team - * Sets up the CBA loadout event handler for monitoring the local player inventory for changes. + * Sets up the per frame event handler for monitoring the local player inventory for changes. * * Arguments: * None @@ -22,5 +22,5 @@ GVAR(requestingNewId) = false; LOG("Monitor Inventory Starting"); [{ACRE_DATA_SYNCED && {(!isNil "ACRE_SERVER_INIT")} && {time >= 1}},{ - ["loadout", DFUNC(monitorRadiosHandler), true] call CBA_fnc_addPlayerEventHandler; + [DFUNC(monitorRadiosPFH), 0.25, []] call CBA_fnc_addPerFrameHandler; },[]] call CBA_fnc_waitUntilAndExecute; diff --git a/addons/sys_radio/fnc_monitorRadiosHandler.sqf b/addons/sys_radio/fnc_monitorRadiosPFH.sqf similarity index 96% rename from addons/sys_radio/fnc_monitorRadiosHandler.sqf rename to addons/sys_radio/fnc_monitorRadiosPFH.sqf index 084382cb1..64b0096fe 100644 --- a/addons/sys_radio/fnc_monitorRadiosHandler.sqf +++ b/addons/sys_radio/fnc_monitorRadiosPFH.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [] call acre_sys_radio_fnc_monitorRadiosHandler + * [] call acre_sys_radio_fnc_monitorRadiosPFH * * Public: No */ @@ -67,7 +67,8 @@ private _currentUniqueItems = []; }; }; - if (_radio call EFUNC(sys_radio,isUniqueRadio)) then { + private _isUnique = _radio call EFUNC(sys_radio,isUniqueRadio); + if (_isUnique) then { if !([_radio] call EFUNC(sys_data,isRadioInitialized)) then { WARNING_1("%1 was found in personal inventory but is uninitialized! Trying to collect new ID.",_radio); private _baseRadio = BASECLASS(_radio);