From ecfc47e170699bbf7a3c4b4b8a2d2637974821c9 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 7 Aug 2026 21:43:15 -0500 Subject: [PATCH 1/2] Common - Add setter for `hideActions` --- addons/common/XEH_PREP.hpp | 1 + addons/common/functions/fnc_hideAction.sqf | 59 ++++++++++++++++++++++ addons/vehicles/CfgActions.hpp | 7 --- addons/vehicles/config.cpp | 1 - addons/vehicles/initSettings.inc.sqf | 6 +-- 5 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 addons/common/functions/fnc_hideAction.sqf delete mode 100644 addons/vehicles/CfgActions.hpp diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index ffc58cb4d68..d7e620b39fd 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -122,6 +122,7 @@ PREP(hasItem); PREP(hasMagazine); PREP(hasZeusAccess); PREP(headBugFix); +PREP(hideAction); PREP(hideUnit); PREP(interpolateFromArray); PREP(inTransitionAnim); diff --git a/addons/common/functions/fnc_hideAction.sqf b/addons/common/functions/fnc_hideAction.sqf new file mode 100644 index 00000000000..1a6125016b3 --- /dev/null +++ b/addons/common/functions/fnc_hideAction.sqf @@ -0,0 +1,59 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Setter for hideActions command + * + * Arguments: + * 0: Action Index + * 1: Key (case-sensitive) + * 2: Hide action + * 3: Skip if missing (if index doesn't exist and not hiding) (default: true) + * + * Return Value: + * Array of hidden and unhidden action indices + * + * Example: + * [15, "noEngineAction", true] call ace_common_fnc_hideAction + * + * Public: Yes + */ + +if (!hasInterface) exitWith {}; + +params [["_index", 0, [0]], ["_key", "", [""]], ["_hide", false, [false]], ["_skipIfMissing", true, [true]]]; + +private _addEH = if (isNil QGVAR(hideActionHash)) then { + GVAR(hideActionHash) = createHashMap; + true +} else { + false +}; + +if (_skipIfMissing && {!_hide} && {!(_index in GVAR(hideActionHash))}) exitWith { createHashMap }; +private _actionIndex = GVAR(hideActionHash) getOrDefault [_index, createHashMap, true]; +if (_hide) then { + _actionIndex set [_key, true]; +} else { + _actionIndex deleteAt _key; +}; + +private _fnc_update = { + private _hideSelected= []; + private _unhideSelected = []; + { + if (count _y == 0) then { + _unhideSelected pushBack _x; + } else { + _hideSelected pushBack _x; + }; + } forEach GVAR(hideActionHash); + hideActions [false, _unhideSelected]; + hideActions [true, _hideSelected]; + [_hideSelected, _unhideSelected] // final return +}; + +if (_addEH) then { + // need to update whenever the focusOn changes (player or UAV) + addMissionEventHandler ["PlayerViewChanged", _fnc_update]; +}; +call _fnc_update diff --git a/addons/vehicles/CfgActions.hpp b/addons/vehicles/CfgActions.hpp deleted file mode 100644 index a15b9e9a185..00000000000 --- a/addons/vehicles/CfgActions.hpp +++ /dev/null @@ -1,7 +0,0 @@ -class CfgActions { - class None; - class Eject: None { - show = QUOTE(call compile getText (configFile >> 'CfgActions' >> 'Eject' >> 'GVAR(setting)')); - GVAR(setting) = QUOTE(profileNamespace getVariable [ARR_2('GVAR(showEjectAction)',0)]); - }; -}; diff --git a/addons/vehicles/config.cpp b/addons/vehicles/config.cpp index 9ec0d73aef7..9b0d595fc84 100644 --- a/addons/vehicles/config.cpp +++ b/addons/vehicles/config.cpp @@ -21,4 +21,3 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" -#include "CfgActions.hpp" diff --git a/addons/vehicles/initSettings.inc.sqf b/addons/vehicles/initSettings.inc.sqf index eb15ea346fd..c508d45eacf 100644 --- a/addons/vehicles/initSettings.inc.sqf +++ b/addons/vehicles/initSettings.inc.sqf @@ -14,10 +14,10 @@ ELSTRING(common,ACEKeybindCategoryVehicles), true, 2, { - profileNamespace setVariable [QGVAR(showEjectAction), parseNumber !_this]; - saveProfileNamespace; + #define ACTION_ENUM_EJECT 51 + [ACTION_ENUM_EJECT, QUOTE(ADDON), _this] call EFUNC(common,hideAction); }, - true // needs restart + true // needs restart (for ace_aircraft's initEjectAction text color) ] call CBA_fnc_addSetting; [ From ba06c1c67f74eb6d49cc1365cd7cb30d1299e7b7 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 11 Aug 2026 13:02:25 -0500 Subject: [PATCH 2/2] use cba func --- addons/common/XEH_PREP.hpp | 1 - addons/common/functions/fnc_hideAction.sqf | 59 ---------------------- addons/vehicles/initSettings.inc.sqf | 6 ++- 3 files changed, 5 insertions(+), 61 deletions(-) delete mode 100644 addons/common/functions/fnc_hideAction.sqf diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index d7e620b39fd..ffc58cb4d68 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -122,7 +122,6 @@ PREP(hasItem); PREP(hasMagazine); PREP(hasZeusAccess); PREP(headBugFix); -PREP(hideAction); PREP(hideUnit); PREP(interpolateFromArray); PREP(inTransitionAnim); diff --git a/addons/common/functions/fnc_hideAction.sqf b/addons/common/functions/fnc_hideAction.sqf deleted file mode 100644 index 1a6125016b3..00000000000 --- a/addons/common/functions/fnc_hideAction.sqf +++ /dev/null @@ -1,59 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: PabstMirror - * Setter for hideActions command - * - * Arguments: - * 0: Action Index - * 1: Key (case-sensitive) - * 2: Hide action - * 3: Skip if missing (if index doesn't exist and not hiding) (default: true) - * - * Return Value: - * Array of hidden and unhidden action indices - * - * Example: - * [15, "noEngineAction", true] call ace_common_fnc_hideAction - * - * Public: Yes - */ - -if (!hasInterface) exitWith {}; - -params [["_index", 0, [0]], ["_key", "", [""]], ["_hide", false, [false]], ["_skipIfMissing", true, [true]]]; - -private _addEH = if (isNil QGVAR(hideActionHash)) then { - GVAR(hideActionHash) = createHashMap; - true -} else { - false -}; - -if (_skipIfMissing && {!_hide} && {!(_index in GVAR(hideActionHash))}) exitWith { createHashMap }; -private _actionIndex = GVAR(hideActionHash) getOrDefault [_index, createHashMap, true]; -if (_hide) then { - _actionIndex set [_key, true]; -} else { - _actionIndex deleteAt _key; -}; - -private _fnc_update = { - private _hideSelected= []; - private _unhideSelected = []; - { - if (count _y == 0) then { - _unhideSelected pushBack _x; - } else { - _hideSelected pushBack _x; - }; - } forEach GVAR(hideActionHash); - hideActions [false, _unhideSelected]; - hideActions [true, _hideSelected]; - [_hideSelected, _unhideSelected] // final return -}; - -if (_addEH) then { - // need to update whenever the focusOn changes (player or UAV) - addMissionEventHandler ["PlayerViewChanged", _fnc_update]; -}; -call _fnc_update diff --git a/addons/vehicles/initSettings.inc.sqf b/addons/vehicles/initSettings.inc.sqf index c508d45eacf..6ab183a15fa 100644 --- a/addons/vehicles/initSettings.inc.sqf +++ b/addons/vehicles/initSettings.inc.sqf @@ -15,7 +15,11 @@ true, 2, { #define ACTION_ENUM_EJECT 51 - [ACTION_ENUM_EJECT, QUOTE(ADDON), _this] call EFUNC(common,hideAction); + if (isNil "CBA_fnc_hideAction") then { + hideActions [_this, [ACTION_ENUM_EJECT]]; + } else { + [ACTION_ENUM_EJECT, QUOTE(ADDON), _this] call CBA_fnc_hideAction; + }; }, true // needs restart (for ace_aircraft's initEjectAction text color) ] call CBA_fnc_addSetting;