Skip to content

Commit

Permalink
Added fallback recreate for the arsenal when it is not initzialy crea…
Browse files Browse the repository at this point in the history
…ted (#1179)
  • Loading branch information
AndreasBrostrom authored Apr 19, 2024
1 parent 21e5dfa commit f3e9706
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 13 additions & 5 deletions cScripts/functions/systems/fn_addArsenal.sqf
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ params [

private _icon = "cScripts\Data\Icon\icon_arsenal_ca.paa";
private _arsenalStatement = {
INFO_2("Staging Arsenal", "Creating staging arsenal for %1 (%2)", player, typeOf player);
INFO_2("Staging Arsenal", "Creating staging arsenal for %1 [%2]", player, typeOf player);

call FUNC(clearDefaultArsenalLoadouts);
waitUntil { count ace_arsenal_defaultLoadoutsList == 0 };
@@ -26,8 +26,16 @@ private _arsenalStatement = {

if (EGVAR(Settings,useFilteredArsenal)) then {
private _items = GETVAR(player,EGVAR(Player,ArsenalWhitelist), []);
INFO_3("Staging Arsenal", "Whitleist containing %1 items added to %2 (%3)", count _items, player, typeOf player);
if (count _items == 0) exitWith {
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;
SETVAR(player,EGVAR(Player,ArsenalWhitelist), _whitelist);
_items = GETVAR(player,EGVAR(Player,ArsenalWhitelist), []);
};

INFO_3("Staging Arsenal", "Whitleist containing %1 items added to %2 [%3]", count _items, player, typeOf player);
if (_items isEqualTo []) exitWith {
SHOW_WARNING_2("Staging Arsenal", "Whitleist is empty for %1 [%2]", player, typeOf player);
[
[],
["Arsenal is not avalible for your class."],
@@ -42,7 +50,7 @@ private _arsenalStatement = {


[{
INFO_2("Staging Arsenal", "Opening Staging Arsenal for %1 (%2)", player, typeOf player);
INFO_2("Staging Arsenal", "Opening Staging Arsenal for %1 [%2]", player, typeOf player);
[player, player, false] call ace_arsenal_fnc_openBox;
[QEGVAR(StagingArsenal,displayOpen)] call CBA_fnc_localEvent;
[{
@@ -54,6 +62,6 @@ private _arsenalStatement = {
}] call CBA_fnc_execNextFrame;
};

INFO_2("Staging Arsenal", "Adding staging arsenal action to %1 (%2)", player, typeOf player);
INFO_2("Staging Arsenal", "Adding staging arsenal action to %1 [%2]", player, typeOf player);
private _arsenalAction = [QEGVAR(Actions,ArsenalAction), "Arsenal", _icon, _arsenalStatement, {true}] call ace_interact_menu_fnc_createAction;
[player, 1, _category, _arsenalAction] call ace_interact_menu_fnc_addActionToObject;
2 changes: 0 additions & 2 deletions cScripts/functions/systems/fn_getArsenalWhitelist.sqf
Original file line number Diff line number Diff line change
@@ -13,8 +13,6 @@
* call cScripts_fnc_getArsenalWhitelist;
*/

waitUntil {!isNull player && player == player};

private _classname = [player] call EFUNC(gear,getLoadoutName);
if !(isClass (missionConfigFile >> "CfgLoadouts" >> _classname)) exitWith {
SHOW_CHAT_WARNING_1("ArsenalWhitelist", "Loadout '%1' does not exist inside of mission config. No whitelist will be created.", _classname);

0 comments on commit f3e9706

Please sign in to comment.