Skip to content

Commit

Permalink
Renamed the arsenal system to be prefixed and saved in one category
Browse files Browse the repository at this point in the history
Added addArsenal Wrapper to be used for missions were you want a action to be added.
  • Loading branch information
AndreasBrostrom committed Apr 19, 2024
1 parent 0638dda commit e6f03c4
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 17 deletions.
11 changes: 6 additions & 5 deletions cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class cScripts {
class gate {};
class teleport {};
class addLoadoutAction {};
class addArsenal {};

class addGetOutHelo {};
class addEscapeWreck {};
Expand Down Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* True on success
*
* Example:
* call cScripts_fnc_addDefaultArsenalLoadout
* call cScripts_fnc_arsenal_addDefaultLoadout
*/

if (!EGVAR(patches,usesACEArsenal)) exitWith {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* True on success
*
* Example:
* call cScripts_fnc_addDefaultArsenalLoadouts
* call cScripts_fnc_arsenal_addDefaultLoadouts
*
* Public: No
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This function remove all ace arsenal default loadouts.
*
* Example:
* call cScripts_fnc_removeDefaultArsenalLoadouts
* call cScripts_fnc__arsenal_removeDefaultLoadouts
*
* Public: No
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* 0: aceCategory <ARRAY> (Default: ["ACE_MainActions"])
*
* Example:
* call cScripts_fnc_addArsenal
* call cScripts_fnc_arsenal_createAction
* ["ACE_MainActions"] call cScripts_fnc_arsenal_createAction
*/

params [
Expand All @@ -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), []);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* ARRAY of items
*
* Example:
* call cScripts_fnc_getArsenalWhitelist;
* call cScripts_fnc_arsenal_getWhitelist;
*/

waitUntil {!isNull player && player == player};
Expand Down
6 changes: 3 additions & 3 deletions cScripts/functions/init/fn_init_aceArsenal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

if (!EGVAR(patches,usesACEArsenal)) exitWith {};

call FUNC(addDefaultArsenalLoadouts);
call EFUNC(arsenal,addDefaultLoadouts);

if (is3DEN) exitWith {};

Expand All @@ -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;
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion cScripts/functions/init/fn_init_staging.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
20 changes: 20 additions & 0 deletions cScripts/functions/mission/fn_addArsenal.sqf
Original file line number Diff line number Diff line change
@@ -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 <ARRAY> (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);

0 comments on commit e6f03c4

Please sign in to comment.