Skip to content

Commit

Permalink
Merge pull request #859 from AndreasBrostrom/spring-cleaning-2023
Browse files Browse the repository at this point in the history
Fixed issues related to the new cba loadout system
  • Loading branch information
AndreasBrostrom authored Feb 19, 2023
2 parents 3cbe84d + a40a191 commit 9d9f0ba
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 51 deletions.
4 changes: 0 additions & 4 deletions cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,4 @@ class cScripts {
file = "cScripts\functions\testing";
class testing_loadoutArrays {};
};
class depricated {
file = "cScripts\functions\depricated";
class addAceCategory {}; // depricated => createActionCategory
};
};
2 changes: 1 addition & 1 deletion cScripts/Loadouts/CfgLoadouts_Bravo_Viking.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Cav_B_B_Scout_WSL_F_Local : Cav_B_Bravo_base_F {
scope = 2;
category[] += {"cScripts_Loadout_Cat_Bravo_Viking_Leadership"};
loadout = [["rhs_weap_m4a1_blockII","","rhsusf_acc_anpeq15","rhsusf_acc_ACOG_RMR",["rhs_mag_30Rnd_556x45_M855A1_PMAG",30],[],"rhsusf_acc_grip2"],[],["rhs_weap_M320","","","",["rhs_mag_m713_Red",1],[],""],["USP_G3C_KP_OR_MC",[["ACE_quikclot",16],["ACE_EarPlugs",1],["ACE_splint",2],["ACE_tourniquet",4],["ACE_MapTools",1],["ACE_microDAGR",1],["ACE_Flashlight_XL50",1],["ACE_artilleryTable",1],["ACRE_PRC343",1]]],["USP_CRYE_CPC_WEAPON_BELT_MC",[["ACRE_PRC152",1],["ACE_Chemlight_IR",2,1],["SmokeShellGreen",1,1],["HandGrenade",2,1],["SmokeShell",4,1],["rhs_mag_30Rnd_556x45_M855A1_PMAG",5,30],["rhs_mag_30Rnd_556x45_M855A1_PMAG_Tracer_Red",2,30],["rhs_mag_m713_Red",2,1],[["ACE_MX2A","","","",[],[],""],1]]],["UK3CB_BAF_B_Bergen_MTP_SL_L_A",[["ACE_EntrenchingTool",1],["ACE_HuntIR_monitor",1],["B_IR_Grenade",4,1],["SmokeShellBlue",4,1],["SmokeShellRed",4,1],["SmokeShellYellow",4,1],["ACE_Chemlight_HiYellow",2,1],["ACE_Chemlight_HiRed",2,1],["ACE_Chemlight_HiBlue",2,1],["rhs_mag_m714_White",5,1],["rhs_mag_M664_red_cluster",4,1]]],"USP_OPS_FASTXP_TAN_MC_08","USP_MFRAME_SMG1_BLK2",["ACE_Vector","","","",[],[],""],["ItemMap","ItemcTab","","ItemCompass","ItemWatch","USP_PVS31"]];
icon = "iconManLeader"
icon = "iconManLeader";
};

class Cav_B_B_Scout_TeamLeader_F : Cav_B_B_Scout_Base_F {
Expand Down
2 changes: 1 addition & 1 deletion cScripts/Loadouts/CfgLoadouts_Charlie_Weapon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Cav_B_C_Weapons_M240B_AssistantMachinegunner_F_Local : Cav_B_Charlie_Weapo
class Cav_B_C_Weapons_MAAWS_MAAWSGunner_F : Cav_B_Charlie_Weapons_base_F {
displayName = "MAAWS Gunner";
scope = 2;
loadout = [["rhs_weap_m4a1_blockII_KAC","rhsusf_acc_SF3P556","rhsusf_acc_anpeq15","rhsusf_acc_ACOG_RMR",["rhs_mag_30Rnd_556x45_M855A1_PMAG_Tan_Tracer_Red",30],[],""],["rhs_weap_maaws","","","rhs_optic_maaws",[],[],""],[],["USP_G3C_RS2_KP_OR_MC",[["ACE_quikclot",10],["ACE_tourniquet",4],["ACE_Flashlight_XL50",1],["ACE_MapTools",1],["ACE_microDAGR",1],["ACE_packingBandage",10],["ACE_EarPlugs",1]]],["USP_CRYE_CPC_FAST_BELT_MC",[["SmokeShell",4,1],["ACE_Chemlight_IR",2,1],["rhs_mag_30Rnd_556x45_M855A1_PMAG_Tan_Tracer_Red",9,30],["HandGrenade",2,1],["SmokeShellGreen",1,1]]],["USP_45L_RUCKSACK_MC",[["ACE_splint",2],["USP_PVS15",1],["rhs_mag_maaws_HE",1,1],["rhs_mag_maaws_HEAT",1,1]]],"USP_OPSCORE_FASTMTC_CGW","USP_MFRAME_TAN",[],["ItemMap","","ItemRadioAcreFlagged","ItemCompass","ACE_Altimeter",""]],[["ace_earplugs",true]];
loadout = [["rhs_weap_m4a1_blockII_KAC","rhsusf_acc_SF3P556","rhsusf_acc_anpeq15","rhsusf_acc_ACOG_RMR",["rhs_mag_30Rnd_556x45_M855A1_PMAG_Tan_Tracer_Red",30],[],""],["rhs_weap_maaws","","","rhs_optic_maaws",[],[],""],[],["USP_G3C_RS2_KP_OR_MC",[["ACE_quikclot",10],["ACE_tourniquet",4],["ACE_Flashlight_XL50",1],["ACE_MapTools",1],["ACE_microDAGR",1],["ACE_packingBandage",10],["ACE_EarPlugs",1]]],["USP_CRYE_CPC_FAST_BELT_MC",[["SmokeShell",4,1],["ACE_Chemlight_IR",2,1],["rhs_mag_30Rnd_556x45_M855A1_PMAG_Tan_Tracer_Red",9,30],["HandGrenade",2,1],["SmokeShellGreen",1,1]]],["USP_45L_RUCKSACK_MC",[["ACE_splint",2],["USP_PVS15",1],["rhs_mag_maaws_HE",1,1],["rhs_mag_maaws_HEAT",1,1]]],"USP_OPSCORE_FASTMTC_CGW","USP_MFRAME_TAN",[],["ItemMap","","ItemRadioAcreFlagged","ItemCompass","ACE_Altimeter",""]];
icon = "iconManAT";
};
class Cav_B_C_Weapons_MAAWS_MAAWSAssistant_F : Cav_B_Charlie_Weapons_base_F {
Expand Down
29 changes: 0 additions & 29 deletions cScripts/functions/depricated/fn_addAceCategory.sqf

This file was deleted.

15 changes: 9 additions & 6 deletions cScripts/functions/documents/fn_Doc_Info.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ if (_group == "") then { _playerGroup = "in your squad" } else { _playerGroup =
private _worldName = getText (configFile >> "CfgWorlds" >> worldName >> "description");
private _serverName = if (serverName != "") then {serverName} else {"localhost"};

private _radioChannel = [_group, "ACRE_PRC343"] call FUNC(getRadioChannel);
_radioChannel = [_radioChannel] call FUNC(getChannelName);
if !(_radioChannel == "ERROR" ) then {
_radioChannel = formatText["Your squad radio is <font color='#ffc61a'>%1</font>.<br/><br/>", _radioChannel];
} else {
_radioChannel = "";
private _radioChannel = "";
if (EGVAR(patches,usesACRE) && EGVAR(Settings,enableACRE)) then {
_radioChannel = [_group, "ACRE_PRC343"] call FUNC(getRadioChannel);
_radioChannel = [_radioChannel] call FUNC(getChannelName);
if !(_radioChannel == "ERROR" ) then {
_radioChannel = formatText["Your squad radio is <font color='#ffc61a'>%1</font>.<br/><br/>", _radioChannel];
} else {
_radioChannel = "";
};
};

private _abilityMedic = "";
Expand Down
1 change: 0 additions & 1 deletion cScripts/functions/gear/fn_gear_applyLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ if (_loadConfig) then {
// Set loadout
switch (true) do {
case _loadArray: {
if (EGVAR(patches,usesACRE)) then { _loadout = [_loadout] call acre_api_fnc_filterUnitLoadout };
[_unit, _loadout] call CBA_fnc_setLoadout;
#ifdef DEBUG_MODE
[format["Loadout array applied to %1", _unit], "Gear"] call FUNC(info);
Expand Down
5 changes: 3 additions & 2 deletions cScripts/functions/gear/fn_gear_saveLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

params [["_unit", objNull, [objNull]]];

private _loadout = [_unit] call CBA_fnc_getLoadout;
if (EGVAR(patches,usesACRE)) then { _loadout = [_loadout] call acre_api_fnc_filterUnitLoadout };
private _loadout = getUnitLoadout _unit;
if (EGVAR(patches,usesACRE)) then { _loadout = [_loadout] call acre_api_fnc_filterUnitLoadout; };
_loadout = [_unit] call CBA_fnc_getLoadout;

_unit setVariable [QEGVAR(gear,Loadout), _loadout];
_unit setVariable [QEGVAR(gear,savedLoadout), true];
Expand Down
2 changes: 2 additions & 0 deletions cScripts/functions/gear/fn_gear_setupRadios.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ if !(EGVAR(Settings,enableACRE)) exitWith {["ACRE Radio init have been disabled.
if (count allMissionObjects "acre_api_basicMissionSetup" > 0) exitWith {};
if (count allMissionObjects "acre_api_nameChannels" > 0) exitWith {};

["Setting up ACRE preset...", "Gear Radio"] call FUNC(info);

// Handle Radio preset from cba settings
private _lrChannels = parseSimpleArray EGVAR(Settings,setRadioChannelNames);
if !(_lrChannels isEqualType []) exitWith {["Radio array have not been setup correctly.", "Gear Radio"] call FUNC(error);};
Expand Down
2 changes: 1 addition & 1 deletion cScripts/functions/helpers/fn_exportLoadoutToArsenal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private _loadoutList = "getText (_x >> 'displayName') != ''" configClasses (miss
private _unitName = getText (missionConfigFile >> "CfgLoadouts" >> _loadout >> "displayName");

[player, _loadout] call Poppy_fnc_applyLoadout;
private _loadoutArray = [_unit] call CBA_fnc_getLoadout;
private _loadoutArray = getUnitLoadout player;

private _br = toString[13,10];
_string = formatText["[""[7CAV] %1 - %2"", %3] call ace_arsenal_fnc_addDefaultLoadout; //%4%5", _unitCompany, _unitName, _loadoutArray, _loadout, _br];
Expand Down
25 changes: 20 additions & 5 deletions cScripts/functions/testing/fn_testing_loadoutArrays.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,45 @@
*
*/

diag_log text "";
diag_log text "###############################################################################################################";
diag_log text "";
["STARTING UNIT TEST FOR LOADOUT ARRAYS", "INFO", true, false, "TESTING"] call FUNC(log);
["There should be no script errors when this function runs.", "INFO", true, false, "TESTING"] call FUNC(log);

diag_log text "";
diag_log text "###############################################################################################################";
diag_log text "";

private _classnameList = configProperties [missionconfigfile >> "CfgLoadouts", "getNumber (_x >> 'scope') >= 2", true];
{
private _class = configName _x;
[format["Testing loadout %1", _class], "TEST START", true, false, "TESTING"] call FUNC(log);
[format["Testing loadout %1", _class], "TEST START", false, false, "TESTING"] call FUNC(log);

// Obtain loadout
["Obtaining loadout array if there are a error in between here something is wrong...", "TEST", false, false, "TESTING"] call FUNC(log);
["... Loadout array parse ...", "TEST", false, false, "TESTING"] call FUNC(log);
private _loadout = getText (missionConfigFile >> 'CfgLoadouts' >> _class >> "loadout");
_loadout = parseSimpleArray _loadout;
["... Loadout array parse ...", "TEST", false, false, "TESTING"] call FUNC(log);

// Testing array size
["Testing array size it should be 1", "TEST", true, false, "TESTING"] call FUNC(log);
["Testing array size it should be 1", "TEST", false, false, "TESTING"] call FUNC(log);
private _arraySize = count [_loadout];
if (_arraySize == 1) then {
[format["SUCCESS: Array size of loadout %1 size is %1", _classnameList, _arraySize], "SUCCESS", true, false, "TESTING"] call FUNC(log);
[format["SUCCESS: Array size of loadout %1 size is %2", _class, _arraySize], "SUCCESS", false, false, "TESTING"] call FUNC(log);
} else {
[format["FAILED: Array size of loadout %1 size is %1", _classnameList, _arraySize], "FAILED", true, false, "TESTING"] call FUNC(log);
[format["FAILED: Array size of loadout %1 size is %2", _class, _arraySize], "FAILED", true, false, "TESTING"] call FUNC(log);
};

[format["Testing loadout %1", _class], "TEST END", true, false, "TESTING"] call FUNC(log);
[format["Testing loadout %1", _class], "TEST END", false, false, "TESTING"] call FUNC(log);
diag_log text "";

} forEach _classnameList;

["TEST COMPLETED", "INFO", true, false, "TESTING"] call FUNC(log);
diag_log text "";
diag_log text "###############################################################################################################";
diag_log text "";

true
1 change: 0 additions & 1 deletion init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ if (!isMultiplayer) then {["Mission is running on singelplayer enviroment!", "",
// ACRE radio init
if (isMultiplayer) then {
GVAR(Radio) = false;
["Setting up ACRE preset...", "init"] call FUNC(info);
call EFUNC(gear,setupRadios);
GVAR(Radio) = true;
} else {
Expand Down

0 comments on commit 9d9f0ba

Please sign in to comment.