From f865cba98fb10ec1fff22b9e9c5f6a6a0f8a2da5 Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Sun, 10 Sep 2023 20:02:34 -0400 Subject: [PATCH 01/10] initial commit --- .../functions/fnc_onSelChangedRight.sqf | 12 +++++ addons/arsenal/functions/fnc_scanConfig.sqf | 10 ++++ addons/compat_rhs_afrf3/XEH_postInit.sqf | 30 +++++++++++ .../compat_rhs_afrf3_arsenal/CfgWeapons.hpp | 4 ++ .../compat_rhs_afrf3_arsenal/config.cpp | 18 +++++++ .../script_component.hpp | 5 ++ addons/compat_rhs_usf3/XEH_postInit.sqf | 31 +++++++++++ .../CfgEventHandlers.hpp | 5 ++ .../compat_rhs_usf3_arsenal/CfgWeapons.hpp | 51 +++++++++++++++++++ .../compat_rhs_usf3_arsenal/config.cpp | 19 +++++++ .../script_component.hpp | 5 ++ docs/wiki/framework/arsenal-framework.md | 1 + 12 files changed, 191 insertions(+) create mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp create mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp create mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/script_component.hpp create mode 100644 addons/compat_rhs_usf3/XEH_postInit.sqf create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgEventHandlers.hpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/script_component.hpp diff --git a/addons/arsenal/functions/fnc_onSelChangedRight.sqf b/addons/arsenal/functions/fnc_onSelChangedRight.sqf index c0cf00d0d90..59098e4a37c 100644 --- a/addons/arsenal/functions/fnc_onSelChangedRight.sqf +++ b/addons/arsenal/functions/fnc_onSelChangedRight.sqf @@ -57,6 +57,9 @@ switch (_currentItemsIndex) do { }; }; + // Call event for compatibility + [QGVAR(weaponItemChanged), [primaryWeapon GVAR(center), _item, _itemIndex]] call CBA_fnc_localEvent; + // Update currentItems (getUnitLoadout GVAR(center) select IDX_LOADOUT_PRIMARY_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"]; GVAR(currentItems) set [IDX_CURR_PRIMARY_WEAPON_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine param [0, ""], _secondaryMagazine param [0, ""]]]; @@ -102,6 +105,9 @@ switch (_currentItemsIndex) do { }; }; + // Call event for compatibility + [QGVAR(weaponItemChanged), [secondaryWeapon GVAR(center), _item, _itemIndex]] call CBA_fnc_localEvent; + // Update currentItems if !(_isDisposable && {_itemIndex >= 4}) then { (getUnitLoadout GVAR(center) select IDX_LOADOUT_SECONDARY_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"]; @@ -141,6 +147,9 @@ switch (_currentItemsIndex) do { }; }; + // Call event for compatibility + [QGVAR(weaponItemChanged), [handgunWeapon GVAR(center), _item, _itemIndex]] call CBA_fnc_localEvent; + // Update currentItems (getUnitLoadout GVAR(center) select IDX_LOADOUT_HANDGUN_WEAPON) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"]; GVAR(currentItems) set [IDX_CURR_HANDGUN_WEAPON_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine param [0, ""], _secondaryMagazine param [0, ""]]]; @@ -178,6 +187,9 @@ switch (_currentItemsIndex) do { }; }; + // Call event for compatibility + [QGVAR(weaponItemChanged), [binocular GVAR(center), _item, _itemIndex]] call CBA_fnc_localEvent; + // Update currentItems (getUnitLoadout GVAR(center) select IDX_LOADOUT_BINO) params ["", "_muzzle", "_flashlight", "_optics", "_primaryMagazine", "_secondaryMagazine", "_bipod"]; GVAR(currentItems) set [IDX_CURR_BINO_ITEMS, [_muzzle, _flashlight, _optics, _bipod, _primaryMagazine param [0, ""], _secondaryMagazine param [0, ""]]]; diff --git a/addons/arsenal/functions/fnc_scanConfig.sqf b/addons/arsenal/functions/fnc_scanConfig.sqf index 335089534c7..40dc16bdea5 100644 --- a/addons/arsenal/functions/fnc_scanConfig.sqf +++ b/addons/arsenal/functions/fnc_scanConfig.sqf @@ -280,3 +280,13 @@ uiNamespace setVariable [QGVAR(putCache), _putList]; uiNamespace setVariable [QGVAR(magazineMiscItems), _magazineMiscItems]; uiNamespace setVariable [QGVAR(CBAdisposableLaunchers), _launchers]; uiNamespace setVariable [QGVAR(configItemsTools), _toolList]; + +// Compatibility: Override baseWeapon for RHS optics +// No good way to do this via script for other attachments, needs manual compat +private _baseWeaponCache = uiNamespace getVariable QGVAR(baseWeaponNameCache); +{ + private _baseAttachment = configName (_cfgWeapons >> getText (_x >> "rhs_optic_base")); + if (_baseAttachment != "") then { + _baseWeaponCache set [toLower configName _x, _baseAttachment]; + }; +} forEach (toString {getText (_x >> "rhs_optic_base") != ""} configClasses _cfgWeapons); diff --git a/addons/compat_rhs_afrf3/XEH_postInit.sqf b/addons/compat_rhs_afrf3/XEH_postInit.sqf index be180179a55..ee325390c45 100644 --- a/addons/compat_rhs_afrf3/XEH_postInit.sqf +++ b/addons/compat_rhs_afrf3/XEH_postInit.sqf @@ -23,3 +23,33 @@ private _russianRankIcons = [ "rhs_faction_vvs_c", "rhs_faction_rva" ]; + +if ("ace_compat_rhs_afrf3_arsenal" call EFUNC(common,isModLoaded)) then { + + #define ITEM_INDEX_SIDE 1 + #define ITEM_INDEX_OPTIC 2 + #define ITEM_INDEX_BIPOD 3 + + // Compatibility for attachments + // Will only work for ACE_player, different arsenal centers will be ignored + [QEGVAR(arsenal,weaponItemChanged), { + params ["_weapon", "_item", "_itemIndex"]; + if (EGVAR(arsenal,center) != ACE_player) exitWith {}; + + switch (_itemIndex) do { + case ITEM_INDEX_SIDE: { + call rhs_fnc_anpeq15_rail; + }; + case ITEM_INDEX_OPTIC: { + [] call rhs_fnc_preferredOptic; + }; + case ITEM_INDEX_BIPOD: { + // Need this call to make sure RHS's functions are set + call rhs_fnc_accGripod; + if (getText (configFile >> "CfgWeapons" >> _item >> "rhs_grip_type") == "") then { + call rhs_grip_deinitialize; + }; + }; + }; + }] call CBA_fnc_addEventHandler; +}; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp new file mode 100644 index 00000000000..46a30a06f7d --- /dev/null +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp @@ -0,0 +1,4 @@ +class CfgWeapons { + // Last update: RHSAFRF 0.5.6 + +}; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp new file mode 100644 index 00000000000..fafa78ebe27 --- /dev/null +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + addonRootClass = QUOTE(COMPONENT); + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "rhs_main_loadorder", + "ace_arsenal" + }; + skipWhenMissingDependencies = 1; + VERSION_CONFIG; + }; +}; + +//#include "CfgWeapons.hpp" diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/script_component.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/script_component.hpp new file mode 100644 index 00000000000..422bba994cb --- /dev/null +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/script_component.hpp @@ -0,0 +1,5 @@ +#include "\z\ace\addons\compat_rhs_afrf3\script_component.hpp" + +#define SUBCOMPONENT arsenal +#undef ADDON +#define ADDON TRIPLES(PREFIX,COMPONENT,SUBCOMPONENT) diff --git a/addons/compat_rhs_usf3/XEH_postInit.sqf b/addons/compat_rhs_usf3/XEH_postInit.sqf new file mode 100644 index 00000000000..6b1ae7bb94a --- /dev/null +++ b/addons/compat_rhs_usf3/XEH_postInit.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" + +// Don't duplicate the event +if ("ace_compat_rhs_afrf3_arsenal" call EFUNC(common,isModLoaded)) exitWith {}; + +#define ITEM_INDEX_SIDE 1 +#define ITEM_INDEX_OPTIC 2 +#define ITEM_INDEX_BIPOD 3 + +// Compatibility for attachments +// Will only work for players or RC unit, different arsenal centers will be ignored +[QEGVAR(arsenal,weaponItemChanged), { + params ["_weapon", "_item", "_itemIndex"]; + if (EGVAR(arsenal,center) != ACE_player) exitWith {}; + + switch (_itemIndex) do { + case ITEM_INDEX_SIDE: { + call rhs_fnc_anpeq15_rail; + }; + case ITEM_INDEX_OPTIC: { + [] call rhs_fnc_preferredOptic; + }; + case ITEM_INDEX_BIPOD: { + // Need this call to make sure RHS's functions are set + call rhs_fnc_accGripod; + if (getText (configFile >> "CfgWeapons" >> _item >> "rhs_grip_type") == "") then { + call rhs_grip_deinitialize; + }; + }; + }; +}] call CBA_fnc_addEventHandler; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgEventHandlers.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgEventHandlers.hpp new file mode 100644 index 00000000000..9cc1b0427bc --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp new file mode 100644 index 00000000000..b4d3311f39b --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp @@ -0,0 +1,51 @@ +class CfgWeapons { + // Last update: RHSUSAF 0.5.6 + class acc_pointer_IR; + class rhsusf_acc_anpeq15: acc_pointer_IR { + baseWeapon = "rhsusf_acc_anpeq15"; + }; + class rhsusf_acc_anpeq15; + class rhsusf_acc_anpeq15_bk: rhsusf_acc_anpeq15 { + baseWeapon = "rhsusf_acc_anpeq15_bk"; + }; + class rhsusf_acc_anpeq15_light; + class rhsusf_acc_anpeq15_bk_light: rhsusf_acc_anpeq15_light { + baseWeapon = "rhsusf_acc_anpeq15_bk"; + }; + class rhsusf_acc_anpeq15_wmx: rhsusf_acc_anpeq15 { + baseWeapon = "rhsusf_acc_anpeq15_wmx"; + }; + class rhsusf_acc_anpeq15_wmx_light: rhsusf_acc_anpeq15_light { + baseWeapon = "rhsusf_acc_anpeq15_wmx"; + }; + class rhsusf_acc_M952V: rhsusf_acc_anpeq15_light { + baseWeapon = "rhsusf_acc_M952V"; + }; + class rhsusf_acc_wmx: rhsusf_acc_M952V { + baseWeapon = "rhsusf_acc_wmx"; + }; + class rhsusf_acc_wmx_bk: rhsusf_acc_M952V { + baseWeapon = "rhsusf_acc_wmx_bk"; + }; + class rhsusf_acc_anpeq15A: acc_pointer_IR { + baseWeapon = "rhsusf_acc_anpeq15A"; + }; + class rhsusf_acc_anpeq15side: acc_pointer_IR { + baseWeapon = "rhsusf_acc_anpeq15side"; + }; + class rhsusf_acc_anpeq15side_bk: rhsusf_acc_anpeq15side { + baseWeapon = "rhsusf_acc_anpeq15side_bk"; + }; + class rhsusf_acc_anpeq16a: rhsusf_acc_anpeq15 { + baseWeapon = "rhsusf_acc_anpeq16a"; + }; + class rhsusf_acc_anpeq16a_light: rhsusf_acc_anpeq15_light { + baseWeapon = "rhsusf_acc_anpeq16a"; + }; + class rhsusf_acc_anpeq16a_top: rhsusf_acc_anpeq16a { + baseWeapon = "rhsusf_acc_anpeq16a_top"; + }; + class rhsusf_acc_anpeq16a_light_top: rhsusf_acc_anpeq16a_light { + baseWeapon = "rhsusf_acc_anpeq16a_top"; + }; +}; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp new file mode 100644 index 00000000000..63665577967 --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + addonRootClass = QUOTE(COMPONENT); + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "rhsusf_main_loadorder", + "ace_arsenal" + }; + skipWhenMissingDependencies = 1; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/script_component.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/script_component.hpp new file mode 100644 index 00000000000..08143e6e280 --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/script_component.hpp @@ -0,0 +1,5 @@ +#include "\z\ace\addons\compat_rhs_usf3\script_component.hpp" + +#define SUBCOMPONENT arsenal +#undef ADDON +#define ADDON TRIPLES(PREFIX,COMPONENT,SUBCOMPONENT) diff --git a/docs/wiki/framework/arsenal-framework.md b/docs/wiki/framework/arsenal-framework.md index 75a59bc9b80..2aef93c2363 100644 --- a/docs/wiki/framework/arsenal-framework.md +++ b/docs/wiki/framework/arsenal-framework.md @@ -501,6 +501,7 @@ All are local. | ace_arsenal_loadoutsDisplayClosed | None | 3.12.3 | | ace_arsenal_loadoutsTabChanged | loadouts screen display (DISPLAY), tab control (CONTROL) | 3.12.3 | | ace_arsenal_loadoutsListFilled | loadouts screen display (DISPLAY), tab control (CONTROL) | 3.12.3 | +| ace_arsenal_weaponItemChanged | weapon classname (STRING), item classname (STRING), item index (NUMBER, 0-5: muzzle, optic, side, bipod, magazine, underbarrel) | 3.16.0 | ## 9. Custom sub item categories From 875cc7667d0f6032438672383b02341b59bf03f3 Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Sun, 10 Sep 2023 20:09:36 -0400 Subject: [PATCH 02/10] remove toString --- addons/arsenal/functions/fnc_scanConfig.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/arsenal/functions/fnc_scanConfig.sqf b/addons/arsenal/functions/fnc_scanConfig.sqf index 40dc16bdea5..41ae340b58c 100644 --- a/addons/arsenal/functions/fnc_scanConfig.sqf +++ b/addons/arsenal/functions/fnc_scanConfig.sqf @@ -289,4 +289,4 @@ private _baseWeaponCache = uiNamespace getVariable QGVAR(baseWeaponNameCache); if (_baseAttachment != "") then { _baseWeaponCache set [toLower configName _x, _baseAttachment]; }; -} forEach (toString {getText (_x >> "rhs_optic_base") != ""} configClasses _cfgWeapons); +} forEach ("getText (_x >> 'rhs_optic_base') != ''" configClasses _cfgWeapons); From c7ad84d5070d54ed8b9c457dcfdfd212b3d6cf38 Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Sun, 10 Sep 2023 20:18:51 -0400 Subject: [PATCH 03/10] add RHSAFRF attachments --- .../compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp index 46a30a06f7d..994af4f6677 100644 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp @@ -1,4 +1,7 @@ class CfgWeapons { // Last update: RHSAFRF 0.5.6 - + class rhs_acc_perst3; + class rhs_acc_perst3_2dp: rhs_acc_perst3 { + baseWeapon = "rhs_acc_perst3_2dp"; + }; }; From db0caa50ac0ae8e024034f6f361a20c83bc0d89e Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Sun, 10 Sep 2023 20:33:01 -0400 Subject: [PATCH 04/10] fix duplicate entry --- addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp index b4d3311f39b..7888e52393d 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp @@ -4,7 +4,6 @@ class CfgWeapons { class rhsusf_acc_anpeq15: acc_pointer_IR { baseWeapon = "rhsusf_acc_anpeq15"; }; - class rhsusf_acc_anpeq15; class rhsusf_acc_anpeq15_bk: rhsusf_acc_anpeq15 { baseWeapon = "rhsusf_acc_anpeq15_bk"; }; From 770e36ef3ff9c09f716c55713e7cb4488ab46214 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 23 Sep 2023 12:53:34 -0500 Subject: [PATCH 05/10] use `SUBADDON` --- addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp | 2 +- .../compat_rhs_afrf3_arsenal/script_component.hpp | 6 ++---- addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp | 2 +- .../compat_rhs_usf3_arsenal/script_component.hpp | 6 ++---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp index fafa78ebe27..bb2e1bf3a2f 100644 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp @@ -1,7 +1,7 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { + class SUBADDON { addonRootClass = QUOTE(COMPONENT); units[] = {}; weapons[] = {}; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/script_component.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/script_component.hpp index 422bba994cb..9de14c499cf 100644 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/script_component.hpp +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/script_component.hpp @@ -1,5 +1,3 @@ -#include "\z\ace\addons\compat_rhs_afrf3\script_component.hpp" - #define SUBCOMPONENT arsenal -#undef ADDON -#define ADDON TRIPLES(PREFIX,COMPONENT,SUBCOMPONENT) +#define SUBCOMPONENT_BEAUTIFIED Arsenal +#include "..\script_component.hpp" diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp index 63665577967..361d5073fad 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp @@ -1,7 +1,7 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { + class SUBADDON { addonRootClass = QUOTE(COMPONENT); units[] = {}; weapons[] = {}; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/script_component.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/script_component.hpp index 08143e6e280..9de14c499cf 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/script_component.hpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/script_component.hpp @@ -1,5 +1,3 @@ -#include "\z\ace\addons\compat_rhs_usf3\script_component.hpp" - #define SUBCOMPONENT arsenal -#undef ADDON -#define ADDON TRIPLES(PREFIX,COMPONENT,SUBCOMPONENT) +#define SUBCOMPONENT_BEAUTIFIED Arsenal +#include "..\script_component.hpp" From 41a5001fe5a05d847094b178bccf600cd2a92daf Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 23 Sep 2023 14:05:46 -0400 Subject: [PATCH 06/10] Update XEH_postInit.sqf --- addons/compat_rhs_usf3/XEH_postInit.sqf | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/compat_rhs_usf3/XEH_postInit.sqf b/addons/compat_rhs_usf3/XEH_postInit.sqf index 6b1ae7bb94a..268ad26b0f6 100644 --- a/addons/compat_rhs_usf3/XEH_postInit.sqf +++ b/addons/compat_rhs_usf3/XEH_postInit.sqf @@ -17,9 +17,6 @@ if ("ace_compat_rhs_afrf3_arsenal" call EFUNC(common,isModLoaded)) exitWith {}; case ITEM_INDEX_SIDE: { call rhs_fnc_anpeq15_rail; }; - case ITEM_INDEX_OPTIC: { - [] call rhs_fnc_preferredOptic; - }; case ITEM_INDEX_BIPOD: { // Need this call to make sure RHS's functions are set call rhs_fnc_accGripod; From 492658152a0526b454c85c646b4587adf44cf66c Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 23 Sep 2023 14:06:08 -0400 Subject: [PATCH 07/10] Update XEH_postInit.sqf --- addons/compat_rhs_afrf3/XEH_postInit.sqf | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/compat_rhs_afrf3/XEH_postInit.sqf b/addons/compat_rhs_afrf3/XEH_postInit.sqf index ee325390c45..fe9907d2d63 100644 --- a/addons/compat_rhs_afrf3/XEH_postInit.sqf +++ b/addons/compat_rhs_afrf3/XEH_postInit.sqf @@ -40,9 +40,6 @@ if ("ace_compat_rhs_afrf3_arsenal" call EFUNC(common,isModLoaded)) then { case ITEM_INDEX_SIDE: { call rhs_fnc_anpeq15_rail; }; - case ITEM_INDEX_OPTIC: { - [] call rhs_fnc_preferredOptic; - }; case ITEM_INDEX_BIPOD: { // Need this call to make sure RHS's functions are set call rhs_fnc_accGripod; From dcfa37fa3da462d3d4fa4ae45e5a0741de72d2e2 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 23 Sep 2023 14:38:36 -0400 Subject: [PATCH 08/10] fix documentation --- docs/wiki/framework/arsenal-framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiki/framework/arsenal-framework.md b/docs/wiki/framework/arsenal-framework.md index 2aef93c2363..329b445d2ea 100644 --- a/docs/wiki/framework/arsenal-framework.md +++ b/docs/wiki/framework/arsenal-framework.md @@ -501,7 +501,7 @@ All are local. | ace_arsenal_loadoutsDisplayClosed | None | 3.12.3 | | ace_arsenal_loadoutsTabChanged | loadouts screen display (DISPLAY), tab control (CONTROL) | 3.12.3 | | ace_arsenal_loadoutsListFilled | loadouts screen display (DISPLAY), tab control (CONTROL) | 3.12.3 | -| ace_arsenal_weaponItemChanged | weapon classname (STRING), item classname (STRING), item index (NUMBER, 0-5: muzzle, optic, side, bipod, magazine, underbarrel) | 3.16.0 | +| ace_arsenal_weaponItemChanged | weapon classname (STRING), item classname (STRING), item index (NUMBER, 0-5: muzzle, side, optic, bipod, magazine, underbarrel) | 3.16.0 | ## 9. Custom sub item categories From 1f54f110aacda02f0b5cdcd50bef5cc2a61e4b94 Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Sat, 23 Sep 2023 14:43:14 -0400 Subject: [PATCH 09/10] move to arsenal component directly --- addons/arsenal/XEH_postInit.sqf | 26 +++++++++++++++++ addons/arsenal/defines.hpp | 8 ++++++ addons/compat_rhs_afrf3/XEH_postInit.sqf | 27 ------------------ addons/compat_rhs_usf3/XEH_postInit.sqf | 28 ------------------- .../CfgEventHandlers.hpp | 5 ---- .../compat_rhs_usf3_arsenal/config.cpp | 1 - 6 files changed, 34 insertions(+), 61 deletions(-) delete mode 100644 addons/compat_rhs_usf3/XEH_postInit.sqf delete mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgEventHandlers.hpp diff --git a/addons/arsenal/XEH_postInit.sqf b/addons/arsenal/XEH_postInit.sqf index 1aaa0203b11..47e6d921c06 100644 --- a/addons/arsenal/XEH_postInit.sqf +++ b/addons/arsenal/XEH_postInit.sqf @@ -149,3 +149,29 @@ GVAR(lastSortDirectionRight) = DESCENDING; }; }; }] call CBA_fnc_addEventHandler; + +#define ITEM_INDEX_SIDE 1 +#define ITEM_INDEX_OPTIC 2 +#define ITEM_INDEX_BIPOD 3 + +// Compatibility for RHS attachment system. Also used by NIArms. +// Will only work for ACE_player, different arsenal centers will be ignored. RHS limitation. +if (!isNil "rhs_fnc_accGripod") then { + [QEGVAR(arsenal,weaponItemChanged), { + params ["_weapon", "_item", "_itemIndex"]; + if (EGVAR(arsenal,center) != ACE_player) exitWith {}; + + switch (_itemIndex) do { + case ITEM_INDEX_SIDE: { + call rhs_fnc_anpeq15_rail; + }; + case ITEM_INDEX_BIPOD: { + // Need this call to make sure RHS's functions are set + call rhs_fnc_accGripod; + if (getText (configFile >> "CfgWeapons" >> _item >> "rhs_grip_type") == "") then { + call rhs_grip_deinitialize; + }; + }; + }; + }] call CBA_fnc_addEventHandler; +}; diff --git a/addons/arsenal/defines.hpp b/addons/arsenal/defines.hpp index cfc12df3d3a..73116dde765 100644 --- a/addons/arsenal/defines.hpp +++ b/addons/arsenal/defines.hpp @@ -22,6 +22,14 @@ // Favorites #define FAVORITES_COLOR (GVAR(favoritesColor) + [1]) +// Attachments +#define ITEM_INDEX_MUZZLE 0 +#define ITEM_INDEX_SIDE 1 +#define ITEM_INDEX_OPTIC 2 +#define ITEM_INDEX_BIPOD 3 +#define ITEM_INDEX_MAGAZINE 4 +#define ITEM_INDEX_MAGAZINE_SECONDARY 5 + // IDCs #define IDD_ace_arsenal 1127001 #define IDC_mouseArea 0 diff --git a/addons/compat_rhs_afrf3/XEH_postInit.sqf b/addons/compat_rhs_afrf3/XEH_postInit.sqf index fe9907d2d63..be180179a55 100644 --- a/addons/compat_rhs_afrf3/XEH_postInit.sqf +++ b/addons/compat_rhs_afrf3/XEH_postInit.sqf @@ -23,30 +23,3 @@ private _russianRankIcons = [ "rhs_faction_vvs_c", "rhs_faction_rva" ]; - -if ("ace_compat_rhs_afrf3_arsenal" call EFUNC(common,isModLoaded)) then { - - #define ITEM_INDEX_SIDE 1 - #define ITEM_INDEX_OPTIC 2 - #define ITEM_INDEX_BIPOD 3 - - // Compatibility for attachments - // Will only work for ACE_player, different arsenal centers will be ignored - [QEGVAR(arsenal,weaponItemChanged), { - params ["_weapon", "_item", "_itemIndex"]; - if (EGVAR(arsenal,center) != ACE_player) exitWith {}; - - switch (_itemIndex) do { - case ITEM_INDEX_SIDE: { - call rhs_fnc_anpeq15_rail; - }; - case ITEM_INDEX_BIPOD: { - // Need this call to make sure RHS's functions are set - call rhs_fnc_accGripod; - if (getText (configFile >> "CfgWeapons" >> _item >> "rhs_grip_type") == "") then { - call rhs_grip_deinitialize; - }; - }; - }; - }] call CBA_fnc_addEventHandler; -}; diff --git a/addons/compat_rhs_usf3/XEH_postInit.sqf b/addons/compat_rhs_usf3/XEH_postInit.sqf deleted file mode 100644 index 268ad26b0f6..00000000000 --- a/addons/compat_rhs_usf3/XEH_postInit.sqf +++ /dev/null @@ -1,28 +0,0 @@ -#include "script_component.hpp" - -// Don't duplicate the event -if ("ace_compat_rhs_afrf3_arsenal" call EFUNC(common,isModLoaded)) exitWith {}; - -#define ITEM_INDEX_SIDE 1 -#define ITEM_INDEX_OPTIC 2 -#define ITEM_INDEX_BIPOD 3 - -// Compatibility for attachments -// Will only work for players or RC unit, different arsenal centers will be ignored -[QEGVAR(arsenal,weaponItemChanged), { - params ["_weapon", "_item", "_itemIndex"]; - if (EGVAR(arsenal,center) != ACE_player) exitWith {}; - - switch (_itemIndex) do { - case ITEM_INDEX_SIDE: { - call rhs_fnc_anpeq15_rail; - }; - case ITEM_INDEX_BIPOD: { - // Need this call to make sure RHS's functions are set - call rhs_fnc_accGripod; - if (getText (configFile >> "CfgWeapons" >> _item >> "rhs_grip_type") == "") then { - call rhs_grip_deinitialize; - }; - }; - }; -}] call CBA_fnc_addEventHandler; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgEventHandlers.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgEventHandlers.hpp deleted file mode 100644 index 9cc1b0427bc..00000000000 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgEventHandlers.hpp +++ /dev/null @@ -1,5 +0,0 @@ -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); - }; -}; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp index 361d5073fad..93e0f332890 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/config.cpp @@ -15,5 +15,4 @@ class CfgPatches { }; }; -#include "CfgEventHandlers.hpp" #include "CfgWeapons.hpp" From 3bfb2d09dafff74c3b7860a3d0762932a0cdb9a6 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 23 Sep 2023 14:48:48 -0400 Subject: [PATCH 10/10] remove macro redef --- addons/arsenal/XEH_postInit.sqf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/addons/arsenal/XEH_postInit.sqf b/addons/arsenal/XEH_postInit.sqf index 47e6d921c06..ee03bff9a98 100644 --- a/addons/arsenal/XEH_postInit.sqf +++ b/addons/arsenal/XEH_postInit.sqf @@ -150,10 +150,6 @@ GVAR(lastSortDirectionRight) = DESCENDING; }; }] call CBA_fnc_addEventHandler; -#define ITEM_INDEX_SIDE 1 -#define ITEM_INDEX_OPTIC 2 -#define ITEM_INDEX_BIPOD 3 - // Compatibility for RHS attachment system. Also used by NIArms. // Will only work for ACE_player, different arsenal centers will be ignored. RHS limitation. if (!isNil "rhs_fnc_accGripod") then {