From 93b7722716942abe0853b298d9f632371dfb9ddd Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 15 Oct 2021 13:48:33 -0500 Subject: [PATCH] General - Cleanup `CfgPatches` unit/weapon arrays (#8524) * General - Cleanup CfgPatches unit/weapon arrays add test tool fix refuel pump fix flashlight pistol transport type fix iDAB reammo box * Update config.cpp --- addons/common/CfgVehicles.hpp | 1 + addons/common/config.cpp | 1 + addons/common/dev/test_cfgPatches.sqf | 72 +++++++++++++++++++++ addons/common/dev/test_vehicleInventory.sqf | 8 +-- addons/cookoff/config.cpp | 2 +- addons/csw/config.cpp | 4 +- addons/disposable/config.cpp | 2 +- addons/fastroping/config.cpp | 2 +- addons/flashlights/CfgVehicles.hpp | 8 ++- addons/fortify/config.cpp | 4 +- addons/huntir/config.cpp | 2 +- addons/logistics_rope/config.cpp | 2 +- addons/map_gestures/config.cpp | 2 +- addons/overheating/config.cpp | 2 +- addons/rearm/CfgVehicles.hpp | 4 ++ addons/refuel/CfgVehicles.hpp | 5 ++ addons/refuel/config.cpp | 4 +- addons/respawn/config.cpp | 4 +- addons/sandbag/config.cpp | 4 +- addons/slideshow/config.cpp | 2 +- addons/spectator/config.cpp | 2 +- optionals/compat_rhs_afrf3/config.cpp | 2 +- optionals/compat_rhs_gref3/config.cpp | 2 +- optionals/compat_rhs_usf3/config.cpp | 2 +- 24 files changed, 114 insertions(+), 29 deletions(-) create mode 100644 addons/common/dev/test_cfgPatches.sqf diff --git a/addons/common/CfgVehicles.hpp b/addons/common/CfgVehicles.hpp index 396d80b5c1..2e3a81d161 100644 --- a/addons/common/CfgVehicles.hpp +++ b/addons/common/CfgVehicles.hpp @@ -121,6 +121,7 @@ class CfgVehicles { class Land_HelipadEmpty_F; class ACE_LogicDummy: Land_HelipadEmpty_F { scope = 1; + scopeCurator = 0; SLX_XEH_DISABLED = 1; author = CSTRING(ACETeam); class EventHandlers { diff --git a/addons/common/config.cpp b/addons/common/config.cpp index 4378428641..0df756d034 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -72,4 +72,5 @@ class ACE_Extensions {}; class ACE_Tests { vehicleTransportInventory = QPATHTOF(dev\test_vehicleInventory.sqf); mapConfigs = QPATHTOF(dev\test_mapConfigs.sqf); + cfgPatches = QPATHTOF(dev\test_cfgPatches.sqf); }; diff --git a/addons/common/dev/test_cfgPatches.sqf b/addons/common/dev/test_cfgPatches.sqf new file mode 100644 index 0000000000..9412651940 --- /dev/null +++ b/addons/common/dev/test_cfgPatches.sqf @@ -0,0 +1,72 @@ +#include "\z\ace\addons\common\script_component.hpp" + +// PabstMirror +// ["cfgPatches"] call ace_common_fnc_runTests; + +diag_log text format ["--- Checking CfgPatches --- "]; + +private _testPass = true; + +// All ace cfgPatches +private _allPatches = "(configName _x) select [0,3] == 'ace'" configClasses (configFile >> "CfgPatches"); + +// Get all units[] +private _allUnits = []; +{ + _allUnits append ((getArray (_x >> "units")) apply { toLower _x }); +} forEach _allPatches; +{ + private _class = configFile >> "CfgVehicles" >> _x; + if (isNull _class) then { + WARNING_1("in units[] but null - %1", _x); + _testPass = false; + } else { + // if (((getNumber (_class >> "scope")) != 2) && {((getNumber (_class >> "scopeCurator")) != 2)}) then { + // WARNING_2("in units[] but not public - %1 from %2", configName _class, configSourceMod _class); + // _testPass = false; + // }; + }; +} forEach _allUnits; + +// Get all weapons[] +private _allWeapons = []; +{ + _allWeapons append ((getArray (_x >> "weapons")) apply { toLower _x }); +} forEach _allPatches; +{ + private _class = configFile >> "CfgWeapons" >> _x; + if (isNull _class) then { + WARNING_1("in weapons[] but null - %1", _x); + _testPass = false; + } else { + // if (((getNumber (_class >> "scope")) != 2) && {((getNumber (_class >> "scopeCurator")) != 2)}) then { + // WARNING_2("in weapons[] but not public - %1 from %2", configName _class, configSourceMod _class); + // _testPass = false; + // }; + }; +} forEach _allWeapons; + +// Check if all public vics are defined in a cfgPatch +private _vics = "(configName _x) select [0,3] == 'ace'" configClasses (configFile >> "CfgVehicles"); +{ + if (((getNumber (_x >> "scope")) == 2) || {((getNumber (_x >> "scopeCurator")) == 2)}) then { + if (!((toLower configName _x) in _allUnits)) then { + WARNING_2("Not in any units[] - %1 from %2", configName _x, configSourceMod _x); + _testPass = false; + }; + }; +} forEach _vics; + +// Check if all public weapons are defined in a cfgPatch +private _weapons = "(configName _x) select [0,3] == 'ace'" configClasses (configFile >> "CfgWeapons"); +{ + private _type = toLower configName _x; + if (((getNumber (_x >> "scope")) == 2) || {((getNumber (_x >> "scopeCurator")) == 2)}) then { + if (!((toLower configName _x) in _allWeapons)) then { + WARNING_2("Not in any weapons[] - %1 from %2", configName _x, configSourceMod _x); + _testPass = false; + }; + }; +} forEach _weapons; + +_testPass diff --git a/addons/common/dev/test_vehicleInventory.sqf b/addons/common/dev/test_vehicleInventory.sqf index fced35a987..7fdd0159c0 100644 --- a/addons/common/dev/test_vehicleInventory.sqf +++ b/addons/common/dev/test_vehicleInventory.sqf @@ -14,7 +14,7 @@ private _vehicles = configProperties [configFile >> "CfgVehicles", "(isClass _x) private _glassesConfig = configFile >> "CfgGlasses" >> _name; if (((!isClass _weaponConfig) || {(getNumber (_weaponConfig >> "type")) in [1,2,4]}) && {!isClass _glassesConfig}) then { diag_log text format ["%1 -> TransportItems -> %2 = Bad", _vehType, _name]; - _testPass = false; + if ("ace" in toLower (_vehType + _name)) then { _testPass = false; }; }; }; } forEach (configProperties [_x >> "TransportItems", "isClass _x", true]); @@ -23,7 +23,7 @@ private _vehicles = configProperties [configFile >> "CfgVehicles", "(isClass _x) private _weaponConfig = configFile >> "CfgWeapons" >> _name; if ((!isClass _weaponConfig) || {!((getNumber (_weaponConfig >> "type")) in [1,2,4])}) then { diag_log text format ["%1 -> TransportWeapons -> %2 = Bad", _vehType, _name]; - _testPass = false; + if ("ace" in toLower (_vehType + _name)) then { _testPass = false; }; }; } forEach (configProperties [_x >> "TransportWeapons", "isClass _x", true]); { @@ -31,7 +31,7 @@ private _vehicles = configProperties [configFile >> "CfgVehicles", "(isClass _x) private _magConfig = configFile >> "CfgMagazines" >> _name; if ((!isClass _magConfig)) then { diag_log text format ["%1 -> TransportMagazines -> %2 = Bad", _vehType, _name]; - _testPass = false; + if ("ace" in toLower (_vehType + _name)) then { _testPass = false; }; }; } forEach (configProperties [_x >> "TransportMagazines", "isClass _x", true]); { @@ -39,7 +39,7 @@ private _vehicles = configProperties [configFile >> "CfgVehicles", "(isClass _x) private _vehConfig = configFile >> "CfgVehicles" >> _name; if ((!isClass _vehConfig)) then { diag_log text format ["%1 -> TransportBackpacks -> %2 = Bad", _vehType, _name]; - _testPass = false; + if ("ace" in toLower (_vehType + _name)) then { _testPass = false; }; }; } forEach (configProperties [_x >> "TransportBackpacks", "isClass _x", true]); } forEach _vehicles; diff --git a/addons/cookoff/config.cpp b/addons/cookoff/config.cpp index 0673efaffe..4fba15f5e1 100644 --- a/addons/cookoff/config.cpp +++ b/addons/cookoff/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {QGVAR(Sound),QGVAR(Turret_MBT_01),QGVAR(Turret_MBT_02)}; + units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; diff --git a/addons/csw/config.cpp b/addons/csw/config.cpp index 47f8313668..98abcea5c0 100644 --- a/addons/csw/config.cpp +++ b/addons/csw/config.cpp @@ -4,8 +4,8 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {}; - weapons[] = {"ace_csw_carryTripod", "ace_csw_staticATWeapon"}; + units[] = {QGVAR(m3Tripod),QGVAR(m3TripodLow),QGVAR(kordTripod),QGVAR(kordTripodLow),QGVAR(sag30Tripod),QGVAR(m220Tripod),QGVAR(spg9Tripod),QGVAR(mortarBaseplate)}; + weapons[] = {QGVAR(m3CarryTripod),QGVAR(m3CarryTripodLow),QGVAR(kordCarryTripod),QGVAR(kordCarryTripodLow),QGVAR(m220CarryTripod),QGVAR(spg9CarryTripod),QGVAR(sag30CarryTripod),QGVAR(carryMortarBaseplate),QGVAR(staticATCarry),QGVAR(staticAACarry),QGVAR(staticHMGCarry),QGVAR(staticM2ShieldCarry),QGVAR(staticGMGCarry),QGVAR(staticMortarCarry)}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; author = ECSTRING(common,ACETeam); diff --git a/addons/disposable/config.cpp b/addons/disposable/config.cpp index 2cc4f4202c..b4561fd8b3 100644 --- a/addons/disposable/config.cpp +++ b/addons/disposable/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; units[] = {}; - weapons[] = {"ACE_launch_NLAW_loaded_F","ACE_launch_NLAW_used_F"}; + weapons[] = {"ACE_launch_NLAW_ready_F","ACE_launch_NLAW_used_F"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; author = ECSTRING(common,ACETeam); diff --git a/addons/fastroping/config.cpp b/addons/fastroping/config.cpp index 749586708c..be8f70a482 100644 --- a/addons/fastroping/config.cpp +++ b/addons/fastroping/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; units[] = {"ACE_fastropingSupplyCrate"}; - weapons[] = {"ACE_rope12","ACE_rope15","ACE_rope18","ACE_rope27","ACE_rope36"}; + weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction","ace_logistics_rope"}; author = ECSTRING(common,ACETeam); diff --git a/addons/flashlights/CfgVehicles.hpp b/addons/flashlights/CfgVehicles.hpp index dbdf5421bc..6c3e32c1c7 100644 --- a/addons/flashlights/CfgVehicles.hpp +++ b/addons/flashlights/CfgVehicles.hpp @@ -59,8 +59,8 @@ class CfgVehicles { editorSubcategory = "EdSubcat_InventoryItems"; vehicleClass = "Items"; - class TransportItems { - MACRO_ADDITEM(ACE_Flashlight_Maglite_ML300L,1); + class TransportWeapons { + MACRO_ADDWEAPON(ACE_Flashlight_Maglite_ML300L,1); }; }; @@ -97,7 +97,9 @@ class CfgVehicles { MACRO_ADDITEM(ACE_Flashlight_MX991,12); MACRO_ADDITEM(ACE_Flashlight_KSF1,12); MACRO_ADDITEM(ACE_Flashlight_XL50,12); - MACRO_ADDITEM(ACE_Flashlight_Maglite_ML300L,2); + }; + class TransportWeapons { + MACRO_ADDWEAPON(ACE_Flashlight_Maglite_ML300L,2); }; }; }; diff --git a/addons/fortify/config.cpp b/addons/fortify/config.cpp index 9cf776c4a9..5e2185021f 100644 --- a/addons/fortify/config.cpp +++ b/addons/fortify/config.cpp @@ -2,8 +2,8 @@ class CfgPatches { class ADDON { - units[] = {}; - weapons[] = {}; + units[] = {QXGVAR(setupModule), QXGVAR(buildLocationModule)}; + weapons[] = {"ACE_Fortify"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; author = ECSTRING(common,ACETeam); diff --git a/addons/huntir/config.cpp b/addons/huntir/config.cpp index 89992d5f52..4e9f5952cc 100644 --- a/addons/huntir/config.cpp +++ b/addons/huntir/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {"ACE_HuntIR", "ACE_HuntIRBox"}; + units[] = {"ACE_HuntIR", "ACE_HuntIR_Box", "ACE_Item_HuntIR_monitor"}; weapons[] = {"ACE_HuntIR_monitor"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; diff --git a/addons/logistics_rope/config.cpp b/addons/logistics_rope/config.cpp index 9e950de635..5765cee2cb 100644 --- a/addons/logistics_rope/config.cpp +++ b/addons/logistics_rope/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; units[] = {}; - weapons[] = {}; + weapons[] = {"ACE_rope3","ACE_rope6","ACE_rope12","ACE_rope15","ACE_rope18","ACE_rope27","ACE_rope36"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; author = ECSTRING(common,ACETeam); diff --git a/addons/map_gestures/config.cpp b/addons/map_gestures/config.cpp index b7bbf791e7..50efc35265 100644 --- a/addons/map_gestures/config.cpp +++ b/addons/map_gestures/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {}; + units[] = {QGVAR(moduleGroupSettings)}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; diff --git a/addons/overheating/config.cpp b/addons/overheating/config.cpp index bedd96fa30..f04238fd10 100644 --- a/addons/overheating/config.cpp +++ b/addons/overheating/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; units[] = {}; - weapons[] = {}; + weapons[] = {"ACE_SpareBarrel_Item"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; author = ECSTRING(common,ACETeam); diff --git a/addons/rearm/CfgVehicles.hpp b/addons/rearm/CfgVehicles.hpp index c12ee16066..98a4f5a3bd 100644 --- a/addons/rearm/CfgVehicles.hpp +++ b/addons/rearm/CfgVehicles.hpp @@ -158,6 +158,10 @@ class CfgVehicles { transportAmmo = 0; GVAR(defaultSupply) = 1200; }; + class Box_IND_AmmoOrd_F; + class Box_IDAP_AmmoOrd_F: Box_IND_AmmoOrd_F { + transportAmmo = 0; // not sure why this one has 240 + }; // Dummy Vehicles class ThingX; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index ddee2f0351..41c4f12625 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -485,6 +485,11 @@ class CfgVehicles { GVAR(hooks)[] = {{0, 0.4, -0.5}, {0, -0.4, -0.5}}; GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; + class Land_FuelStation_03_pump_F: House_F { // Enoch + transportFuel = 0; //50k + GVAR(hooks)[] = {{0, 0.4, -0.5}, {0, -0.4, -0.5}}; + GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; + }; // Helper object for non-AllVehicles objects class GVAR(helper): Helicopter_Base_F { diff --git a/addons/refuel/config.cpp b/addons/refuel/config.cpp index 39765e323c..2697b53a09 100644 --- a/addons/refuel/config.cpp +++ b/addons/refuel/config.cpp @@ -3,8 +3,8 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {}; - weapons[] = {QGVAR(fuelNozzle)}; + units[] = {QGVAR(fuelNozzle)}; + weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; author = ECSTRING(common,ACETeam); diff --git a/addons/respawn/config.cpp b/addons/respawn/config.cpp index 79fbf69d74..b0a86336a4 100644 --- a/addons/respawn/config.cpp +++ b/addons/respawn/config.cpp @@ -3,8 +3,8 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {}; - weapons[] = {"ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_Rallypoint_West_Base", "ACE_Rallypoint_East_Base", "ACE_Rallypoint_Independent_Base"}; + units[] = {"ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_Rallypoint_West_Base", "ACE_Rallypoint_East_Base", "ACE_Rallypoint_Independent_Base"}; + weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = { "ace_common" }; author = ECSTRING(common,ACETeam); diff --git a/addons/sandbag/config.cpp b/addons/sandbag/config.cpp index 80e3f71808..bbd2369659 100644 --- a/addons/sandbag/config.cpp +++ b/addons/sandbag/config.cpp @@ -3,8 +3,8 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {"ACE_Item_Sandbag", "ACE_Item_Sandbag_empty"}; - weapons[] = {"ACE_Sandbag", "ACE_Sandbag_empty"}; + units[] = {"ACE_Item_Sandbag_empty"}; + weapons[] = {"ACE_Sandbag_empty"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; author = ECSTRING(common,ACETeam); diff --git a/addons/slideshow/config.cpp b/addons/slideshow/config.cpp index 6149ad71d7..93378a3e82 100644 --- a/addons/slideshow/config.cpp +++ b/addons/slideshow/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {}; + units[] = {QGVAR(module)}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; diff --git a/addons/spectator/config.cpp b/addons/spectator/config.cpp index 359b96135b..44f98b6931 100644 --- a/addons/spectator/config.cpp +++ b/addons/spectator/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {}; + units[] = {QGVAR(virtual)}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; diff --git a/optionals/compat_rhs_afrf3/config.cpp b/optionals/compat_rhs_afrf3/config.cpp index c6424b4089..ddd2d598fe 100644 --- a/optionals/compat_rhs_afrf3/config.cpp +++ b/optionals/compat_rhs_afrf3/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; units[] = {}; - weapons[] = {}; + weapons[] = {QGVAR(2b14_carry), QGVAR(nsv_carry), QGVAR(kord_carry), QGVAR(ags30_carry), QGVAR(spg9_carry), QGVAR(spg9m_carry), QGVAR(metis_carry), QGVAR(kornet_carry)}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_explosives", "ace_csw", "ace_rearm", "ace_refuel", "ace_repair", "rhs_main_loadorder"}; author = ECSTRING(common,ACETeam); diff --git a/optionals/compat_rhs_gref3/config.cpp b/optionals/compat_rhs_gref3/config.cpp index ae782a9cf1..5e9f6d21a0 100644 --- a/optionals/compat_rhs_gref3/config.cpp +++ b/optionals/compat_rhs_gref3/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; units[] = {}; - weapons[] = {}; + weapons[] = {QGVAR(dshkm_carry)}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_explosives", "ace_csw", "rhsgref_main_loadorder"}; author = ECSTRING(common,ACETeam); diff --git a/optionals/compat_rhs_usf3/config.cpp b/optionals/compat_rhs_usf3/config.cpp index b59e4f7185..1e169fdf6a 100644 --- a/optionals/compat_rhs_usf3/config.cpp +++ b/optionals/compat_rhs_usf3/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; units[] = {}; - weapons[] = {}; + weapons[] = {QGVAR(m252_carry), QGVAR(m2_carry), QGVAR(mk19_carry), QGVAR(tow_carry)}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_explosives", "ace_javelin", "ace_rearm", "ace_refuel", "ace_repair", "ace_csw", "rhsusf_main_loadorder"}; author = ECSTRING(common,ACETeam);