From e6f03c430ed33d75e7323b4fe74d2f6126be5e69 Mon Sep 17 00:00:00 2001 From: AndreasBrostrom Date: Fri, 19 Apr 2024 13:56:58 +0200 Subject: [PATCH] Renamed the arsenal system to be prefixed and saved in one category Added addArsenal Wrapper to be used for missions were you want a action to be added. --- cScripts/CfgFunctions.hpp | 11 +++++----- ...t.sqf => fn_arsenal_addDefaultLoadout.sqf} | 2 +- ....sqf => fn_arsenal_addDefaultLoadouts.sqf} | 2 +- ...qf => fn_arsenal_clearDefaultLoadouts.sqf} | 2 +- ...rsenal.sqf => fn_arsenal_createAction.sqf} | 9 +++++---- ...telist.sqf => fn_arsenal_getWhitelist.sqf} | 2 +- .../functions/init/fn_init_aceArsenal.sqf | 6 +++--- cScripts/functions/init/fn_init_staging.sqf | 2 +- cScripts/functions/mission/fn_addArsenal.sqf | 20 +++++++++++++++++++ 9 files changed, 39 insertions(+), 17 deletions(-) rename cScripts/functions/arsenal/{fn_addDefaultArsenalLoadout.sqf => fn_arsenal_addDefaultLoadout.sqf} (96%) rename cScripts/functions/arsenal/{fn_addDefaultArsenalLoadouts.sqf => fn_arsenal_addDefaultLoadouts.sqf} (97%) rename cScripts/functions/arsenal/{fn_clearDefaultArsenalLoadouts.sqf => fn_arsenal_clearDefaultLoadouts.sqf} (82%) rename cScripts/functions/arsenal/{fn_addArsenal.sqf => fn_arsenal_createAction.sqf} (91%) rename cScripts/functions/arsenal/{fn_getArsenalWhitelist.sqf => fn_arsenal_getWhitelist.sqf} (99%) create mode 100644 cScripts/functions/mission/fn_addArsenal.sqf diff --git a/cScripts/CfgFunctions.hpp b/cScripts/CfgFunctions.hpp index 2d83744a3..2e8a579e9 100644 --- a/cScripts/CfgFunctions.hpp +++ b/cScripts/CfgFunctions.hpp @@ -93,6 +93,7 @@ class cScripts { class gate {}; class teleport {}; class addLoadoutAction {}; + class addArsenal {}; class addGetOutHelo {}; class addEscapeWreck {}; @@ -244,11 +245,11 @@ class cScripts { }; class arsenal { file = "cScripts\functions\arsenal"; - class addArsenal {}; - class getArsenalWhitelist {}; - class addDefaultArsenalLoadout {}; - class addDefaultArsenalLoadouts {}; - class clearDefaultArsenalLoadouts {}; + class arsenal_createAction {}; + class arsenal_getWhitelist {}; + class arsenal_addDefaultLoadout {}; + class arsenal_addDefaultLoadouts {}; + class arsenal_clearDefaultLoadouts {}; }; class diag { file = "cScripts\functions\diag"; diff --git a/cScripts/functions/arsenal/fn_addDefaultArsenalLoadout.sqf b/cScripts/functions/arsenal/fn_arsenal_addDefaultLoadout.sqf similarity index 96% rename from cScripts/functions/arsenal/fn_addDefaultArsenalLoadout.sqf rename to cScripts/functions/arsenal/fn_arsenal_addDefaultLoadout.sqf index c19d66598..9254b65d3 100644 --- a/cScripts/functions/arsenal/fn_addDefaultArsenalLoadout.sqf +++ b/cScripts/functions/arsenal/fn_arsenal_addDefaultLoadout.sqf @@ -11,7 +11,7 @@ * True on success * * Example: - * call cScripts_fnc_addDefaultArsenalLoadout + * call cScripts_fnc_arsenal_addDefaultLoadout */ if (!EGVAR(patches,usesACEArsenal)) exitWith {}; diff --git a/cScripts/functions/arsenal/fn_addDefaultArsenalLoadouts.sqf b/cScripts/functions/arsenal/fn_arsenal_addDefaultLoadouts.sqf similarity index 97% rename from cScripts/functions/arsenal/fn_addDefaultArsenalLoadouts.sqf rename to cScripts/functions/arsenal/fn_arsenal_addDefaultLoadouts.sqf index 49a67f8bd..e4ab5ca90 100644 --- a/cScripts/functions/arsenal/fn_addDefaultArsenalLoadouts.sqf +++ b/cScripts/functions/arsenal/fn_arsenal_addDefaultLoadouts.sqf @@ -10,7 +10,7 @@ * True on success * * Example: - * call cScripts_fnc_addDefaultArsenalLoadouts + * call cScripts_fnc_arsenal_addDefaultLoadouts * * Public: No */ diff --git a/cScripts/functions/arsenal/fn_clearDefaultArsenalLoadouts.sqf b/cScripts/functions/arsenal/fn_arsenal_clearDefaultLoadouts.sqf similarity index 82% rename from cScripts/functions/arsenal/fn_clearDefaultArsenalLoadouts.sqf rename to cScripts/functions/arsenal/fn_arsenal_clearDefaultLoadouts.sqf index aa9c2a12c..7ac927366 100644 --- a/cScripts/functions/arsenal/fn_clearDefaultArsenalLoadouts.sqf +++ b/cScripts/functions/arsenal/fn_arsenal_clearDefaultLoadouts.sqf @@ -4,7 +4,7 @@ * This function remove all ace arsenal default loadouts. * * Example: - * call cScripts_fnc_removeDefaultArsenalLoadouts + * call cScripts_fnc__arsenal_removeDefaultLoadouts * * Public: No */ diff --git a/cScripts/functions/arsenal/fn_addArsenal.sqf b/cScripts/functions/arsenal/fn_arsenal_createAction.sqf similarity index 91% rename from cScripts/functions/arsenal/fn_addArsenal.sqf rename to cScripts/functions/arsenal/fn_arsenal_createAction.sqf index 05b745906..1ee8f76ad 100644 --- a/cScripts/functions/arsenal/fn_addArsenal.sqf +++ b/cScripts/functions/arsenal/fn_arsenal_createAction.sqf @@ -8,7 +8,8 @@ * 0: aceCategory (Default: ["ACE_MainActions"]) * * Example: - * call cScripts_fnc_addArsenal + * call cScripts_fnc_arsenal_createAction + * ["ACE_MainActions"] call cScripts_fnc_arsenal_createAction */ params [ @@ -19,16 +20,16 @@ private _icon = "cScripts\Data\Icon\icon_arsenal_ca.paa"; private _arsenalStatement = { INFO_2("Staging Arsenal", "Creating staging arsenal for %1 [%2]", player, typeOf player); - call FUNC(clearDefaultArsenalLoadouts); + call EFUNC(arsenal,clearDefaultLoadouts); waitUntil { count ace_arsenal_defaultLoadoutsList == 0 }; - call FUNC(addDefaultArsenalLoadout); + call EFUNC(arsenal,addDefaultLoadout); waitUntil { count ace_arsenal_defaultLoadoutsList != 0 }; if (EGVAR(Settings,useFilteredArsenal)) then { private _items = GETVAR(player,EGVAR(Player,ArsenalWhitelist), []); if (_items isEqualTo []) then { SHOW_WARNING_2("Staging Arsenal", "Whitleist was empty for %1 [%2] attepting to recreate it", player, typeOf player); - private _whitelist = call cScripts_fnc_getArsenalWhitelist; + private _whitelist = call EFUNC(arsenal,getWhitelist); SETVAR(player,EGVAR(Player,ArsenalWhitelist), _whitelist); _items = GETVAR(player,EGVAR(Player,ArsenalWhitelist), []); }; diff --git a/cScripts/functions/arsenal/fn_getArsenalWhitelist.sqf b/cScripts/functions/arsenal/fn_arsenal_getWhitelist.sqf similarity index 99% rename from cScripts/functions/arsenal/fn_getArsenalWhitelist.sqf rename to cScripts/functions/arsenal/fn_arsenal_getWhitelist.sqf index 3d7c05117..b7cee00cf 100644 --- a/cScripts/functions/arsenal/fn_getArsenalWhitelist.sqf +++ b/cScripts/functions/arsenal/fn_arsenal_getWhitelist.sqf @@ -11,7 +11,7 @@ * ARRAY of items * * Example: - * call cScripts_fnc_getArsenalWhitelist; + * call cScripts_fnc_arsenal_getWhitelist; */ waitUntil {!isNull player && player == player}; diff --git a/cScripts/functions/init/fn_init_aceArsenal.sqf b/cScripts/functions/init/fn_init_aceArsenal.sqf index 58bd6bb0c..cc86bb1c5 100644 --- a/cScripts/functions/init/fn_init_aceArsenal.sqf +++ b/cScripts/functions/init/fn_init_aceArsenal.sqf @@ -11,7 +11,7 @@ if (!EGVAR(patches,usesACEArsenal)) exitWith {}; -call FUNC(addDefaultArsenalLoadouts); +call EFUNC(arsenal,addDefaultLoadouts); if (is3DEN) exitWith {}; @@ -29,7 +29,7 @@ GVAR(StagingArsenalOpen) = false; [_insigniaClass] call EFUNC(profile,saveInsignia); // Reset default loadouts - call FUNC(addDefaultArsenalLoadouts); + call EFUNC(arsenal,addDefaultLoadouts); }] call CBA_fnc_execNextFrame; }; }] call CBA_fnc_addEventHandler; @@ -39,7 +39,7 @@ GVAR(StagingArsenalOpen) = false; }] call CBA_fnc_addEventHandler; [QEGVAR(StagingArsenal,SaveWhitelist), { - private _items = call FUNC(getArsenalWhitelist); + private _items = call EFUNC(arsenal,getWhitelist); SETVAR(player,EGVAR(Player,ArsenalWhitelist),_items); }] call CBA_fnc_addEventHandler; diff --git a/cScripts/functions/init/fn_init_staging.sqf b/cScripts/functions/init/fn_init_staging.sqf index 8374dcc8b..87d777f9b 100644 --- a/cScripts/functions/init/fn_init_staging.sqf +++ b/cScripts/functions/init/fn_init_staging.sqf @@ -82,6 +82,6 @@ player addEventHandler ["InventoryClosed", { if !(GVAR(OneLife)) then {[player, _category] call FUNC(addHeal)}; [player, _category] call FUNC(addInsigniaSelectionList); [player, "ACE_SelfActions", false] call FUNC(setupLoadoutSelection); -[_category] call FUNC(addArsenal); +[_category] call EFUNC(arsenal,createAction); INFO_1("Staging", "Staging options for %1 have been setup.", name player) diff --git a/cScripts/functions/mission/fn_addArsenal.sqf b/cScripts/functions/mission/fn_addArsenal.sqf new file mode 100644 index 000000000..6d1b57e61 --- /dev/null +++ b/cScripts/functions/mission/fn_addArsenal.sqf @@ -0,0 +1,20 @@ +#include "..\script_component.hpp"; +/* + * Author: CPL.Brostrom.A + * This function creates a "CavArsenal". + * This arsenal is created and destroyed on usage to maek sure the items inside are populated with correct items. + * (This is a wrapper function) + * + * Arguments: + * 0: aceCategory (Default: ["ACE_MainActions"]) + * + * Example: + * call cScripts_fnc_addArsenal + * ["ACE_MainActions"] call cScripts_fnc_addArsenal + */ + +params [ + ["_category", ["ACE_MainActions"], [["ACE_MainActions"]]] +]; + +[_category] call EFUNC(arsenal,createAction); \ No newline at end of file