From 31e1ad0cff8ec07b6618d9193299b0de772e5c8b Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Fri, 21 Jul 2023 22:39:48 +0300 Subject: [PATCH] Arsenal - Add Tools category and `moveOnOverwrite` parameter to `FUNC(addCustomRightPanelButton)` (#9247) * add tools tab and setting * move to preinit * fix icon, add restart warning * derp Co-authored-by: Dystopian * Update addons/arsenal/stringtable.xml Co-authored-by: PabstMirror * remove setting * add keepIfOverriden parameter * docs again * documentation whitespace * docs grammar, change parameter name * fix docs * more docs fixes * magazine support * deprecate spare barrel item * more docs, improve condition --------- Co-authored-by: Dystopian Co-authored-by: PabstMirror --- addons/arsenal/CfgWeapons.hpp | 10 +++ addons/arsenal/XEH_preInit.sqf | 21 ++--- addons/arsenal/config.cpp | 1 + .../functions/fnc_addRightPanelButton.sqf | 19 ++++- addons/arsenal/functions/fnc_scanConfig.sqf | 10 ++- addons/arsenal/initSettings.sqf | 83 +++++++++++++++++++ addons/arsenal/stringtable.xml | 16 ++++ addons/artillerytables/CfgWeapons.hpp | 1 + addons/atragmx/CfgWeapons.hpp | 1 + addons/chemlights/CfgWeapons.hpp | 1 + addons/dagr/CfgWeapons.hpp | 1 + addons/explosives/CfgWeapons.hpp | 4 + addons/field_rations/XEH_preInit.sqf | 2 +- .../functions/fnc_scanFieldRations.sqf | 4 +- addons/flashlights/CfgWeapons.hpp | 3 + addons/fortify/CfgWeapons.hpp | 1 + addons/huntir/CfgWeapons.hpp | 1 + addons/intelitems/CfgMagazines.hpp | 1 + addons/kestrel4500/CfgWeapons.hpp | 1 + addons/logistics_wirecutter/CfgWeapons.hpp | 1 + addons/maptools/CfgWeapons.hpp | 1 + addons/medical_treatment/XEH_preInit.sqf | 2 +- .../functions/fnc_scanMedicalItems.sqf | 8 +- addons/microdagr/CfgWeapons.hpp | 1 + addons/mk6mortar/CfgWeapons.hpp | 1 + addons/overheating/CfgWeapons.hpp | 5 +- addons/rangecard/CfgWeapons.hpp | 1 + addons/spottingscope/CfgWeapons.hpp | 1 + addons/trenches/CfgWeapons.hpp | 1 + addons/tripod/CfgWeapons.hpp | 1 + docs/wiki/framework/arsenal-framework.md | 42 +++++++--- 31 files changed, 210 insertions(+), 36 deletions(-) create mode 100644 addons/arsenal/CfgWeapons.hpp create mode 100644 addons/arsenal/initSettings.sqf diff --git a/addons/arsenal/CfgWeapons.hpp b/addons/arsenal/CfgWeapons.hpp new file mode 100644 index 0000000000..c45bb7d5ec --- /dev/null +++ b/addons/arsenal/CfgWeapons.hpp @@ -0,0 +1,10 @@ +class CfgWeapons { + class ItemCore; + class ToolKit: ItemCore { + ACE_isTool = 1; // sort in Tools Tab + }; + class DetectorCore; + class MineDetector: DetectorCore { + ACE_isTool = 1; // sort in Tools Tab + }; +}; diff --git a/addons/arsenal/XEH_preInit.sqf b/addons/arsenal/XEH_preInit.sqf index 25f0b22363..08457b5237 100644 --- a/addons/arsenal/XEH_preInit.sqf +++ b/addons/arsenal/XEH_preInit.sqf @@ -1,26 +1,15 @@ #include "script_component.hpp" #include "defines.hpp" +#define TOOLS_TAB_ICON "\A3\ui_f\data\igui\cfg\actions\repair_ca.paa" + ADDON = false; PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; -// Arsenal -[QGVAR(camInverted), "CHECKBOX", LLSTRING(invertCameraSetting), LLSTRING(settingCategory), false] call CBA_fnc_addSetting; -[QGVAR(enableModIcons), "CHECKBOX", [LSTRING(modIconsSetting), LSTRING(modIconsTooltip)], LLSTRING(settingCategory), true] call CBA_fnc_addSetting; -[QGVAR(fontHeight), "SLIDER", [LSTRING(fontHeightSetting), LSTRING(fontHeightTooltip)], LLSTRING(settingCategory), [1, 10, 4.5, 1]] call CBA_fnc_addSetting; -[QGVAR(enableIdentityTabs), "CHECKBOX", LLSTRING(enableIdentityTabsSettings), LLSTRING(settingCategory), true, true] call CBA_fnc_addSetting; - -// Arsenal loadouts -[QGVAR(allowDefaultLoadouts), "CHECKBOX", [LSTRING(allowDefaultLoadoutsSetting), LSTRING(defaultLoadoutsTooltip)], [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], true, true] call CBA_fnc_addSetting; -[QGVAR(allowSharedLoadouts), "CHECKBOX", LLSTRING(allowSharingSetting), [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], true, true] call CBA_fnc_addSetting; -[QGVAR(EnableRPTLog), "CHECKBOX", [LSTRING(printToRPTSetting), LSTRING(printToRPTTooltip)], [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], false, false] call CBA_fnc_addSetting; - -[QGVAR(loadoutsSaveFace), "CHECKBOX", LLSTRING(loadoutsSaveFaceSetting), [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], false] call CBA_fnc_addSetting; -[QGVAR(loadoutsSaveVoice), "CHECKBOX", LLSTRING(loadoutsSaveVoiceSetting), [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], false] call CBA_fnc_addSetting; -[QGVAR(loadoutsSaveInsignia), "CHECKBOX", LLSTRING(loadoutsSaveInsigniaSetting), [LLSTRING(settingCategory), LLSTRING(loadoutSubcategory)], true] call CBA_fnc_addSetting; +#include "initSettings.sqf" // Arsenal events [QGVAR(statsToggle), { @@ -76,4 +65,8 @@ call FUNC(compileSorts); "CBA_disposable_arsenalClosed" call CBA_fnc_localEvent; }] call CBA_fnc_addEventHandler; +// Setup Tools tab +[keys (uiNamespace getVariable [QGVAR(configItemsTools), createHashMap]), LLSTRING(toolsTab), TOOLS_TAB_ICON, -1, true] call FUNC(addRightPanelButton); + + ADDON = true; diff --git a/addons/arsenal/config.cpp b/addons/arsenal/config.cpp index 733328b241..78a07dcfed 100644 --- a/addons/arsenal/config.cpp +++ b/addons/arsenal/config.cpp @@ -19,6 +19,7 @@ class CfgPatches { #include "Display3DEN.hpp" #include "Cfg3DEN.hpp" #include "CfgEventHandlers.hpp" +#include "CfgWeapons.hpp" #include "RscDisplayMain.hpp" #include "ACE_Arsenal_Sorts.hpp" #include "ACE_Arsenal_Stats.hpp" diff --git a/addons/arsenal/functions/fnc_addRightPanelButton.sqf b/addons/arsenal/functions/fnc_addRightPanelButton.sqf index 2cabe7d3e0..848cc7e584 100644 --- a/addons/arsenal/functions/fnc_addRightPanelButton.sqf +++ b/addons/arsenal/functions/fnc_addRightPanelButton.sqf @@ -9,17 +9,19 @@ * 1: Tooltip (default: "") * 2: Picture path (default: QPATHTOF(data\iconCustom.paa)) * 3: Override a specific button (0-9) (default: -1) + * 4: Move button if its position is overridden (default: false) * * Return Value: - * Successful: Number of the slot (0-9); Error: -1 + * Successful: Number of the slot (0-9) + * Error: -1 * * Example: - * [["ACE_bloodIV_500", "ACE_Banana"], "MedicalStuff", "\z\ace\addons\arsenal\data\iconCustom.paa", 5] call ace_arsenal_fnc_addRightPanelButton + * [["ACE_bloodIV_500", "ACE_Banana"], "MedicalStuff", "\z\ace\addons\arsenal\data\iconCustom.paa", 5, false] call ace_arsenal_fnc_addRightPanelButton * * Public: Yes */ -params [["_items", [], [[]]], ["_tooltip", "", [""]], ["_picture", QPATHTOF(data\iconCustom.paa), [""]], ["_override", -1, [0]]]; +params [["_items", [], [[]]], ["_tooltip", "", [""]], ["_picture", QPATHTOF(data\iconCustom.paa), [""]], ["_override", -1, [0]], ["_moveOnOverwrite", false, [false]]]; if (isNil QGVAR(customRightPanelButtons)) then { GVAR(customRightPanelButtons) = [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]; @@ -44,6 +46,15 @@ if (_position < 0 || {_position > 9}) exitWith { -1 }; +// Check if we're overwriting a button that's being force-kept +private _currentButtonInPosition = GVAR(customRightPanelButtons) select _position; +if (!isNil "_currentButtonInPosition") then { + _currentButtonInPosition params ["_cbItems", "_cbPicture", "_cbTooltip", "_cbMove"]; + if (_cbMove) then { + [{_this call FUNC(addRightPanelButton)}, [_cbItems, _cbTooltip, _cbPicture, -1, _cbMove]] call CBA_fnc_execNextFrame; + }; +}; + // If spot found, add items and return position private _cfgWeapons = configFile >> "CfgWeapons"; private _cfgMagazines = configFile >> "CfgMagazines"; @@ -58,6 +69,6 @@ _items = _items select { {getNumber (_cfgMagazines >> _x >> "ACE_isUnique") == 1} }; -GVAR(customRightPanelButtons) set [_position, [_items apply {_x call EFUNC(common,getConfigName)}, _picture, _tooltip]]; +GVAR(customRightPanelButtons) set [_position, [_items apply {_x call EFUNC(common,getConfigName)}, _picture, _tooltip, _moveOnOverwrite]]; _position diff --git a/addons/arsenal/functions/fnc_scanConfig.sqf b/addons/arsenal/functions/fnc_scanConfig.sqf index 80afc46a7b..87cb1c0b9e 100644 --- a/addons/arsenal/functions/fnc_scanConfig.sqf +++ b/addons/arsenal/functions/fnc_scanConfig.sqf @@ -24,6 +24,9 @@ for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do { _configItems set [_index, createHashMap]; }; +// Cache tools for separate tab +private _toolList = createHashMap; + // https://community.bistudio.com/wiki/Arma_3:_Characters_And_Gear_Encoding_Guide#Character_configuration // https://github.com/acemod/ACE3/pull/9040#issuecomment-1597748331 private _filterFunction = toString { @@ -38,6 +41,7 @@ private _configItemInfo = ""; private _hasItemInfo = false; private _itemInfoType = 0; private _isMiscItem = false; +private _isTool = false; // Get weapons and other various items { @@ -47,6 +51,7 @@ private _isMiscItem = false; _hasItemInfo = isClass (_configItemInfo); _itemInfoType = if (_hasItemInfo) then {getNumber (_configItemInfo >> "type")} else {0}; _isMiscItem = _className isKindOf ["CBA_MiscItem", _cfgWeapons]; + _isTool = getNumber (_x >> "ACE_isTool") isEqualTo 1; switch (true) do { // Weapon attachments @@ -130,6 +135,7 @@ private _isMiscItem = false; {_simulationType == "ItemMineDetector"} ): { (_configItems get IDX_VIRT_MISC_ITEMS) set [_className, nil]; + if (_isTool) then {_toolList set [_className, nil]}; }; }; } forEach configProperties [_cfgWeapons, _filterFunction, true]; @@ -160,9 +166,10 @@ private _magazineMiscItems = createHashMap; switch (true) do { // "Misc. items" magazines (e.g. spare barrels, intel, photos) - case (getNumber (_x >> "ACE_isUnique") == 1): { + case (getNumber (_x >> "ACE_isUnique") isEqualTo 1): { (_configItems get IDX_VIRT_MISC_ITEMS) set [_className, nil]; _magazineMiscItems set [_className, nil]; + if (getNumber (_x >> "ACE_isTool") isEqualTo 1) then {_toolList set [_className, nil]}; }; // Grenades case (_className in _grenadeList): { @@ -266,3 +273,4 @@ uiNamespace setVariable [QGVAR(grenadeCache), _grenadeList]; uiNamespace setVariable [QGVAR(putCache), _putList]; uiNamespace setVariable [QGVAR(magazineMiscItems), _magazineMiscItems]; uiNamespace setVariable [QGVAR(CBAdisposableLaunchers), _launchers]; +uiNamespace setVariable [QGVAR(configItemsTools), _toolList]; diff --git a/addons/arsenal/initSettings.sqf b/addons/arsenal/initSettings.sqf new file mode 100644 index 0000000000..ea549528ad --- /dev/null +++ b/addons/arsenal/initSettings.sqf @@ -0,0 +1,83 @@ +// Arsenal +private _category = LLSTRING(settingCategory); +[ + QGVAR(camInverted), + "CHECKBOX", + LLSTRING(invertCameraSetting), + _category, + false +] call CBA_fnc_addSetting; + +[ + QGVAR(enableModIcons), + "CHECKBOX", + [LSTRING(modIconsSetting), LSTRING(modIconsTooltip)], + _category, + true +] call CBA_fnc_addSetting; + +[ + QGVAR(fontHeight), + "SLIDER", + [LSTRING(fontHeightSetting), LSTRING(fontHeightTooltip)], + _category, + [1, 10, 4.5, 1] +] call CBA_fnc_addSetting; + +[ + QGVAR(enableIdentityTabs), + "CHECKBOX", + LLSTRING(enableIdentityTabsSettings), + _category, + true, + true +] call CBA_fnc_addSetting; + +private _loadoutCategory = LLSTRING(loadoutSubcategory); + +// Arsenal loadouts +[QGVAR(allowDefaultLoadouts), + "CHECKBOX", + [LSTRING(allowDefaultLoadoutsSetting), LSTRING(defaultLoadoutsTooltip)], + [_category, _loadoutCategory], + true, + true +] call CBA_fnc_addSetting; + +[QGVAR(allowSharedLoadouts), + "CHECKBOX", + LLSTRING(allowSharingSetting), + [_category, _loadoutCategory], + true, + true +] call CBA_fnc_addSetting; + +[QGVAR(EnableRPTLog), + "CHECKBOX", + [LSTRING(printToRPTSetting), + LSTRING(printToRPTTooltip)], + [_category, _loadoutCategory], + false, + false +] call CBA_fnc_addSetting; + +[QGVAR(loadoutsSaveFace), + "CHECKBOX", + LLSTRING(loadoutsSaveFaceSetting), + [_category, _loadoutCategory], + false +] call CBA_fnc_addSetting; + +[QGVAR(loadoutsSaveVoice), + "CHECKBOX", + LLSTRING(loadoutsSaveVoiceSetting), + [_category, _loadoutCategory], + false +] call CBA_fnc_addSetting; + +[QGVAR(loadoutsSaveInsignia), + "CHECKBOX", + LLSTRING(loadoutsSaveInsigniaSetting), + [_category, _loadoutCategory], + true +] call CBA_fnc_addSetting; diff --git a/addons/arsenal/stringtable.xml b/addons/arsenal/stringtable.xml index ae1a7e9abf..7d8657fe2a 100644 --- a/addons/arsenal/stringtable.xml +++ b/addons/arsenal/stringtable.xml @@ -1489,5 +1489,21 @@ Ascending + + Tools + Nástroje + Werkzeuge + Инструменты + Narzędzia + Strumenti + Herramientas + Outils + 工具 + ツール + 도구 + Ferramentas + 工具 + Araçlar + diff --git a/addons/artillerytables/CfgWeapons.hpp b/addons/artillerytables/CfgWeapons.hpp index 7c4d408673..56aa257b46 100644 --- a/addons/artillerytables/CfgWeapons.hpp +++ b/addons/artillerytables/CfgWeapons.hpp @@ -8,6 +8,7 @@ class CfgWeapons { displayName = CSTRING(rangetable_displayName); descriptionShort = CSTRING(rangetable_description); picture = QPATHTOF(UI\icon_rangeTable.paa); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 0.5; }; diff --git a/addons/atragmx/CfgWeapons.hpp b/addons/atragmx/CfgWeapons.hpp index 2fa31fc628..c6eeb566c6 100644 --- a/addons/atragmx/CfgWeapons.hpp +++ b/addons/atragmx/CfgWeapons.hpp @@ -12,6 +12,7 @@ class CfgWeapons { picture = QPATHTOF(UI\ATRAG_Icon.paa); icon = "iconObject_circle"; mapSize = 0.034; + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 2; diff --git a/addons/chemlights/CfgWeapons.hpp b/addons/chemlights/CfgWeapons.hpp index 8ed9d73583..a3d5ab5afe 100644 --- a/addons/chemlights/CfgWeapons.hpp +++ b/addons/chemlights/CfgWeapons.hpp @@ -54,6 +54,7 @@ class CfgWeapons { model = "\A3\weapons_F\ammo\mag_univ.p3d"; picture = QPATHTOF(UI\ace_chemlight_shield_x_ca.paa); scope = 2; + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 1; }; diff --git a/addons/dagr/CfgWeapons.hpp b/addons/dagr/CfgWeapons.hpp index 55692e7f9a..d114fa448c 100644 --- a/addons/dagr/CfgWeapons.hpp +++ b/addons/dagr/CfgWeapons.hpp @@ -12,6 +12,7 @@ class CfgWeapons { picture = QPATHTOF(UI\DAGR_Icon.paa); icon = "iconObject_circle"; mapSize = 0.034; + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 10; }; diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp index d45b484c59..9a3c3e273b 100644 --- a/addons/explosives/CfgWeapons.hpp +++ b/addons/explosives/CfgWeapons.hpp @@ -26,6 +26,7 @@ class CfgWeapons { GVAR(Range) = 250; GVAR(Detonator) = 1; GVAR(triggerType) = "Command"; + ACE_isTool = 1; class ItemInfo: ACE_ExplosiveItem { mass = 3; @@ -46,6 +47,7 @@ class CfgWeapons { descriptionShort = CSTRING(DefusalKit_description); picture = QPATHTOF(Data\UI\Pliers.paa); model = "\A3\Structures_F\Items\Tools\Pliers_F.p3d"; + ACE_isTool = 1; class ItemInfo: ACE_ExplosiveItem { mass = 5; @@ -62,6 +64,7 @@ class CfgWeapons { GVAR(Range) = 100; GVAR(Detonator) = 1; GVAR(triggerType) = "DeadManSwitch"; + ACE_isTool = 1; class ItemInfo: ACE_ExplosiveItem { mass = 2; @@ -78,6 +81,7 @@ class CfgWeapons { GVAR(Range) = 15000; GVAR(Detonator) = 1; GVAR(triggerType) = "Cellphone"; + ACE_isTool = 1; class ItemInfo: ACE_ExplosiveItem { mass = 2; diff --git a/addons/field_rations/XEH_preInit.sqf b/addons/field_rations/XEH_preInit.sqf index ede921483e..a54da0834a 100644 --- a/addons/field_rations/XEH_preInit.sqf +++ b/addons/field_rations/XEH_preInit.sqf @@ -22,7 +22,7 @@ GVAR(waterSourceOffsets) = _cache select 1; // Custom Arsenal Tab if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then { - [keys FIELD_RATIONS_ITEMS, LLSTRING(DisplayName), ARSENAL_CATEGORY_ICON] call EFUNC(arsenal,addRightPanelButton); + [keys FIELD_RATIONS_ITEMS, LLSTRING(DisplayName), ARSENAL_CATEGORY_ICON, -1, true] call EFUNC(arsenal,addRightPanelButton); }; ADDON = true; diff --git a/addons/field_rations/functions/fnc_scanFieldRations.sqf b/addons/field_rations/functions/fnc_scanFieldRations.sqf index 395b3ba45b..612ca83fe0 100644 --- a/addons/field_rations/functions/fnc_scanFieldRations.sqf +++ b/addons/field_rations/functions/fnc_scanFieldRations.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* - * Author: Salluci - * Caches all item classnames used as field rations, their thirst/hunger values, and whether they are treated as magazines + * Author: LinkIsGrim + * Caches all item classnames used as field rations * * Arguments: * None diff --git a/addons/flashlights/CfgWeapons.hpp b/addons/flashlights/CfgWeapons.hpp index 1ebc9a5a58..f939f84bb7 100644 --- a/addons/flashlights/CfgWeapons.hpp +++ b/addons/flashlights/CfgWeapons.hpp @@ -72,6 +72,7 @@ class CfgWeapons { descriptionShort = CSTRING(MX991_Description); model = QPATHTOF(data\mx_991.p3d); picture = QPATHTOF(UI\mx_991_ca.paa); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 4; @@ -91,6 +92,7 @@ class CfgWeapons { descriptionShort = CSTRING(KSF1_Description); model = QPATHTOF(data\ksf_1.p3d); picture = QPATHTOF(UI\ksf_1_ca.paa); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 4; @@ -110,6 +112,7 @@ class CfgWeapons { descriptionShort = CSTRING(XL50_Description); model = QPATHTOF(data\maglite_xl50.p3d); picture = QPATHTOF(UI\maglite_xl50_ca.paa); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 3; diff --git a/addons/fortify/CfgWeapons.hpp b/addons/fortify/CfgWeapons.hpp index 4c2bb9eaa7..66ff7f52d8 100644 --- a/addons/fortify/CfgWeapons.hpp +++ b/addons/fortify/CfgWeapons.hpp @@ -9,6 +9,7 @@ class CfgWeapons { model = "\A3\Structures_F\Items\Tools\Hammer_F.p3d"; picture = QPATHTOF(UI\hammer_ca.paa); scope = 2; + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 0; }; diff --git a/addons/huntir/CfgWeapons.hpp b/addons/huntir/CfgWeapons.hpp index 7cda0e7066..666e09bd84 100644 --- a/addons/huntir/CfgWeapons.hpp +++ b/addons/huntir/CfgWeapons.hpp @@ -10,6 +10,7 @@ class CfgWeapons { picture = QPATHTOF(UI\w_huntir_monitor_ca.paa); descriptionShort = CSTRING(monitor_displayName); model = QPATHTOF(data\ace_huntir_monitor.p3d); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 20; diff --git a/addons/intelitems/CfgMagazines.hpp b/addons/intelitems/CfgMagazines.hpp index 8d83cf0953..cb5bbf495d 100644 --- a/addons/intelitems/CfgMagazines.hpp +++ b/addons/intelitems/CfgMagazines.hpp @@ -18,6 +18,7 @@ class CfgMagazines { picture = QPATHTOF(ui\notepad_ca.paa); model = "\a3\structures_f\items\documents\notepad_f.p3d"; GVAR(control) = QGVAR(RscNotepad); + ACE_isTool = 1; }; class XGVAR(document): GVAR(base) { diff --git a/addons/kestrel4500/CfgWeapons.hpp b/addons/kestrel4500/CfgWeapons.hpp index ea9cd2ab2f..35930e53d9 100644 --- a/addons/kestrel4500/CfgWeapons.hpp +++ b/addons/kestrel4500/CfgWeapons.hpp @@ -12,6 +12,7 @@ class CfgWeapons { picture = QPATHTOF(UI\Kestrel4500.paa); icon = "iconObject_circle"; mapSize = 0.034; + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 2; diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp index 5c66196f4a..609c84d9ba 100644 --- a/addons/logistics_wirecutter/CfgWeapons.hpp +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -9,6 +9,7 @@ class CfgWeapons { model = QPATHTOF(data\ace_wirecutter.p3d); picture = QPATHTOF(ui\item_wirecutter_ca.paa); ACE_isWirecutter = 1; + ACE_isTool = 1; scope = 2; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 25; diff --git a/addons/maptools/CfgWeapons.hpp b/addons/maptools/CfgWeapons.hpp index 31d8bc491e..f8a95acc73 100644 --- a/addons/maptools/CfgWeapons.hpp +++ b/addons/maptools/CfgWeapons.hpp @@ -9,6 +9,7 @@ class CfgWeapons { model = QPATHTOF(data\ace_MapTools.p3d); picture = QPATHTOF(UI\maptool_item.paa); scope = 2; + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 1; }; diff --git a/addons/medical_treatment/XEH_preInit.sqf b/addons/medical_treatment/XEH_preInit.sqf index 30bf875291..79ec737aa6 100644 --- a/addons/medical_treatment/XEH_preInit.sqf +++ b/addons/medical_treatment/XEH_preInit.sqf @@ -48,7 +48,7 @@ GVAR(facilityClasses) = []; // Custom Arsenal tab if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then { - [MEDICAL_TREATMENT_ITEMS, LELSTRING(medical,Category), ARSENAL_CATEGORY_ICON] call EFUNC(arsenal,addRightPanelButton); + [MEDICAL_TREATMENT_ITEMS, LELSTRING(medical,Category), ARSENAL_CATEGORY_ICON, -1, true] call EFUNC(arsenal,addRightPanelButton); }; ADDON = true; diff --git a/addons/medical_treatment/functions/fnc_scanMedicalItems.sqf b/addons/medical_treatment/functions/fnc_scanMedicalItems.sqf index 17b2456c42..23ffd35d91 100644 --- a/addons/medical_treatment/functions/fnc_scanMedicalItems.sqf +++ b/addons/medical_treatment/functions/fnc_scanMedicalItems.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* - * Author: Salluci + * Author: LinkIsGrim * Caches all item classnames used in ACE_Medical_Treatment_Actions * * Arguments: @@ -22,7 +22,7 @@ private _fnc_isMedicalItem = toString { getNumber (_x >> "ACE_isMedicalItem") isEqualTo 1 }; -// get items in ACE_Medical_Treament_Actions, fallback for items without API config property +// Get items in ACE_Medical_Treament_Actions, fallback for items without API config property { _list append (getArray (_x >> "items")); } forEach ("true" configClasses _cfgActions); @@ -31,4 +31,8 @@ private _fnc_isMedicalItem = toString { _list pushBack (configName _x); } forEach (_fnc_isMedicalItem configClasses (configFile >> "CfgWeapons")); +{ + _list pushBack (configName _x); +} forEach (_fnc_isMedicalItem configClasses (configFile >> "CfgMagazines")); + uiNamespace setVariable [QGVAR(treatmentItems), compileFinal str (_list arrayIntersect _list)] diff --git a/addons/microdagr/CfgWeapons.hpp b/addons/microdagr/CfgWeapons.hpp index 6c7c920427..aebe427c90 100644 --- a/addons/microdagr/CfgWeapons.hpp +++ b/addons/microdagr/CfgWeapons.hpp @@ -9,6 +9,7 @@ class CfgWeapons { descriptionShort = CSTRING(itemDescription); model = QPATHTOF(data\MicroDAGR.p3d); picture = QPATHTOF(images\microDAGR_item.paa); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 2; }; diff --git a/addons/mk6mortar/CfgWeapons.hpp b/addons/mk6mortar/CfgWeapons.hpp index 467465d90c..c57c9aa2ea 100644 --- a/addons/mk6mortar/CfgWeapons.hpp +++ b/addons/mk6mortar/CfgWeapons.hpp @@ -8,6 +8,7 @@ class CfgWeapons { displayName = CSTRING(rangetable_name); descriptionShort = CSTRING(rangetable_description); picture = QPATHTOF(UI\icon_rangeTable.paa); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 0.5; }; diff --git a/addons/overheating/CfgWeapons.hpp b/addons/overheating/CfgWeapons.hpp index 67a2f0c765..cc0b768934 100644 --- a/addons/overheating/CfgWeapons.hpp +++ b/addons/overheating/CfgWeapons.hpp @@ -99,10 +99,13 @@ class CfgWeapons { }; class ACE_ItemCore; class CBA_MiscItem_ItemInfo; + + // Deprecated, 3.16.0 Arsenal supports showing magazines as misc items class ACE_SpareBarrel_Item: ACE_ItemCore { displayName = CSTRING(SpareBarrelName); author = ECSTRING(common,ACETeam); - scope = 2; + scope = 1; + scopeArsenal = 0; descriptionshort = CSTRING(SpareBarrelDescription); picture = QUOTE(PATHTOF(UI\spare_barrel_ca.paa)); class ItemInfo: CBA_MiscItem_ItemInfo { diff --git a/addons/rangecard/CfgWeapons.hpp b/addons/rangecard/CfgWeapons.hpp index 659b0ecfcb..851e324346 100644 --- a/addons/rangecard/CfgWeapons.hpp +++ b/addons/rangecard/CfgWeapons.hpp @@ -11,6 +11,7 @@ class CfgWeapons { picture = QPATHTOF(UI\RangeCard_Icon.paa); icon = "iconObject_circle"; mapSize = 0.034; + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 1; diff --git a/addons/spottingscope/CfgWeapons.hpp b/addons/spottingscope/CfgWeapons.hpp index ac62572b30..73af3b9cde 100644 --- a/addons/spottingscope/CfgWeapons.hpp +++ b/addons/spottingscope/CfgWeapons.hpp @@ -9,6 +9,7 @@ class CfgWeapons { descriptionShort = ""; picture = QPATHTOF(UI\w_spottingscope_ca.paa); model = QPATHTOF(data\ace_spottingscope.p3d); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 40; diff --git a/addons/trenches/CfgWeapons.hpp b/addons/trenches/CfgWeapons.hpp index 4e14153a1b..c4548606db 100644 --- a/addons/trenches/CfgWeapons.hpp +++ b/addons/trenches/CfgWeapons.hpp @@ -9,6 +9,7 @@ class CfgWeapons { model = QPATHTOEF(apl,ace_entrchtool.p3d); picture = QPATHTOF(ui\w_entrchtool_ca.paa); scope = 2; + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 10; }; diff --git a/addons/tripod/CfgWeapons.hpp b/addons/tripod/CfgWeapons.hpp index 4e609f4f3d..27c6ea8525 100644 --- a/addons/tripod/CfgWeapons.hpp +++ b/addons/tripod/CfgWeapons.hpp @@ -9,6 +9,7 @@ class CfgWeapons { descriptionShort = ""; model = QPATHTOF(data\w_sniper_tripod.p3d); picture = QPATHTOF(UI\w_sniper_tripod_ca.paa); + ACE_isTool = 1; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 40; diff --git a/docs/wiki/framework/arsenal-framework.md b/docs/wiki/framework/arsenal-framework.md index 64323a302a..ceb738266e 100644 --- a/docs/wiki/framework/arsenal-framework.md +++ b/docs/wiki/framework/arsenal-framework.md @@ -44,7 +44,7 @@ Examples: - `[_box, true] call ace_arsenal_fnc_initBox` - `[_box, false, false] call ace_arsenal_fnc_initBox` -Passing an empty array or `false` will still add an interaction but no additional virtual items will be added. +Passing an empty array or `false` will still add an interaction but no additional virtual items will be added. Please note that at least one virtual item needs to be added otherwise ACE Arsenal will not open. ### 1.2 Opening an arsenal box manually @@ -125,13 +125,22 @@ Built upon the function of section 2.1, this can be used to make an Arsenal only 4. Paste the created array from your clipboard into the space where the items are listed using Ctrl + V. The array is created with brackets. Examples: -- For a new box: +- For a new box: `[_box, ["item1", "item2", "itemN"]] call ace_arsenal_fnc_initBox` -- For an existing box: +- For an existing box: `[_box, ["item1", "item2", "itemN"]] call ace_arsenal_fnc_addVirtualItems` ## 3. Config entries +### 3.1 Special config entries + +ACE Arsenal uses 2 existing config entries to sort and display items. + +- `baseWeapon`: Class name that is used to display an item in the arsenal. This property can be applied to any weapon or weapon attachment in `CfgWeapons`. +- `ACE_isUnique`: Classes in `CfgMagazines` with this property set to `1` will be treated and shown by the Arsenal as Misc. Items. Used for items with attached data that needs to be kept track of, such as Notepads or Spare Barrels. + +### 3.2 New config entries + ACE Arsenal has 2 new config entries for items: - `ace_arsenal_hide`: `0`(shown) or `1` (hidden), used to hide items from ACE Arsenal or `-1` (forced show), for magazines. @@ -139,8 +148,18 @@ ACE Arsenal has 2 new config entries for items: Both of them are optional. -- `baseWeapon`: Class name that is used to display an item in the arsenal. This property can be applied to any weapon or weapon attachment in `CfgWeapons`. -- `ACE_isUnique`: Classes in `CfgMagazines` with this property set to `1` will be treated and shown by the Arsenal as Misc. Items. Used for items with attached data that needs to be kept track of, such as Notepads or Spare Barrels. +### 3.3 Adding items to ACE's sub-categories + +ACE Arsenal includes a "Tools" sub-category by default: + +- `ACE_isTool`: Items with this property set to `1` will be sorted to the Tools Tab. + +ACE Medical Treatment and ACE Field Rations also add their own sub-categories, if they're present: + +- `ACE_isMedicalItem`: Items with this property set to `1` will be sorted to the ACE Medical Tab. +- `ACE_isFieldRationItem`: Items with this property set to `1` will be sorted to the ACE Field Rations Tab. + +Only Misc. Items will be checked for these properties. Magazines must have ACE_isUnique property. ## 4. Default loadouts @@ -339,7 +358,7 @@ Example: { _fireRate pushBackUnique (getNumber (_itemCfg >> _x >> "reloadTime")); } forEach _fireModes; - + _fireRate sort true; _fireRate param [0, 0] }] call ace_arsenal_fnc_addSort; @@ -380,10 +399,10 @@ All are local. | ace_arsenal_onLoadoutLoad | loadout data (ARRAY), loadout name (STRING) | | ace_arsenal_onLoadoutLoadExtended | CBA extended loadout data (ARRAY), loadout name (STRING) | 3.15.1 | ace_arsenal_onLoadoutDelete | loadout name (STRING) | -| ace_arsenal_loadoutShared | Loadouts list listnBox control (CONTROL), [loadout author (STRING), loadout name (STRING), loadout data (ARRAY)] | +| ace_arsenal_loadoutShared | Loadouts list listnBox control (CONTROL), loadout author (STRING), loadout name (STRING), loadout data (ARRAY) | | ace_arsenal_loadoutUnshared | Loadouts list listnBox control (CONTROL), loadout author (STRING), loadout name (STRING) | | ace_arsenal_cargoChanged | Arsenal display (DISPLAY), item (STRING), add or remove (NUMBER), shiftState (BOOL) | -| ace_arsenal_loadoutImported | Arsenal display (DISPLAY), (import list (BOOL) | +| ace_arsenal_loadoutImported | Arsenal display (DISPLAY), import list (BOOL) | | ace_arsenal_loadoutExported | Arsenal display (DISPLAY), export list (BOOL) | | ace_arsenal_loadoutsDisplayOpened | loadouts screen display (DISPLAY) | 3.12.3 | | ace_arsenal_loadoutsDisplayClosed | None | 3.12.3 | @@ -402,14 +421,16 @@ All are local. 1 | Tooltip | String | Optional (default: `""`) 2 | Picture path | String | Optional (default: `"\z\ace\addons\arsenal\data\iconCustom.paa"`) 3 | Override a specific button | Number | Optional (default: `-1`) +4 | Move button on overwrite | Bool | Optional (default: `false`) Return Value: - Successful: Number of the slot (0-9) - Error: -1 -This function creates a sub category under misc. items in the ACE Arsenal. -Only items that are listed under 'Misc. Items' are available for sub categories. +This function creates a sub-category just above misc items in the ACE Arsenal. +Only items that are listed under 'Misc. Items' or other sub-categories are available for sub-categories. If the 'Override a specific button' argument is not used, the button will added at the bottom of the rest. +If the 'Move button on overwrite' argument is used, the button will be moved to the bottom of the rest if its position is overridden. Examples: - `[["ACE_bloodIV_500", "ACE_fieldDressing"], "MedicalStuff"] call ace_arsenal_fnc_addRightPanelButton` @@ -426,3 +447,4 @@ private _buttonId = [["ACE_Flashlight_MX991", "ACE_Flashlight_KSF1"], "Flashligh // now the category 'better flashlight' is replacing the category 'Flashlights' because it is set on the same button index [["ACE_Flashlight_XL50"], "better flashlight", "\path\to\a\pictureWithAFlashlight.paa", _buttonId] call ace_arsenal_fnc_addRightPanelButton ``` +If an overwritten button is not moved, its items will be added back to Misc. Items.