2019-06-08 04:47:39 +00:00
|
|
|
#define DEBUG_MODE_FULL
|
2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2019-06-08 04:47:39 +00:00
|
|
|
|
|
|
|
// Dev only function to search for weapons used by static weapons
|
|
|
|
// and check if their magazinese are compatible
|
|
|
|
INFO("Checking static weapons");
|
|
|
|
|
|
|
|
private _staticWeaponConfigs = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(configName _x) isKindOf 'StaticWeapon'}", true];
|
|
|
|
private _staticPublic = _staticWeaponConfigs select {(getNumber (_x >> "scope")) == 2};
|
2024-02-07 23:36:13 +00:00
|
|
|
INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic,{(getNumber (_x >> QUOTE(ADDON) >> "enabled")) == 1} count _staticPublic);
|
2019-06-08 04:47:39 +00:00
|
|
|
|
|
|
|
INFO("------ Checking static weapons inheritance ------");
|
|
|
|
private _explicitBases = [];
|
|
|
|
private _inherited = [];
|
|
|
|
{
|
|
|
|
private _config = _x;
|
2024-02-07 23:36:13 +00:00
|
|
|
private _configEnabled = (getNumber (_config >> QUOTE(ADDON) >> "enabled")) == 1;
|
2019-06-08 04:47:39 +00:00
|
|
|
if (_configEnabled) then {
|
2024-07-27 17:42:31 +00:00
|
|
|
private _configExplicit = (count configProperties [_config, toString {configName _x == QUOTE(ADDON)}, false]) == 1;
|
2019-06-08 04:47:39 +00:00
|
|
|
if (_configExplicit) then {
|
|
|
|
_explicitBases pushBack (configName _config);
|
|
|
|
_inherited pushBack [];
|
|
|
|
} else {
|
|
|
|
if ((getNumber (_config >> "scope")) < 2) exitWith {};
|
|
|
|
private _parent = inheritsFrom _config;
|
|
|
|
while {isClass _parent} do {
|
|
|
|
private _className = configName _parent;
|
|
|
|
private _index = _explicitBases findIf {_className == _x};
|
|
|
|
if (_index > -1) exitWith {
|
|
|
|
(_inherited select _index) pushBack (configName _config);
|
|
|
|
};
|
|
|
|
_parent = inheritsFrom _parent;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} forEach _staticWeaponConfigs;
|
|
|
|
{
|
|
|
|
INFO_2("%1 inherited by %2",_x,_inherited select _forEachIndex);
|
|
|
|
} forEach _explicitBases;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INFO("------ Logging static magazines with no carry version -------");
|
2021-10-10 16:55:14 +00:00
|
|
|
private _hash = createHashMap;
|
2024-07-27 17:42:31 +00:00
|
|
|
private _logAll = false; // logs all possible weapon magazines (even if not used in a static weapon) when set to true
|
|
|
|
|
2019-06-08 04:47:39 +00:00
|
|
|
{
|
|
|
|
private _vehicleType = configName _x;
|
|
|
|
private _turretConfig = [_vehicleType, [0]] call CBA_fnc_getTurret;
|
|
|
|
private _weapons = getArray (_turretConfig >> "weapons");
|
|
|
|
private _loadedMags = getArray (_turretConfig >> "magazines");
|
|
|
|
{
|
|
|
|
private _weapMags = getArray (configFile >> "CfgWeapons" >> _x >> "magazines");
|
|
|
|
{
|
|
|
|
private _xMag = _x;
|
2020-03-11 23:42:21 +00:00
|
|
|
private _groups = "getNumber (_x >> _xMag) == 1 && {isClass (configFile >> 'CfgMagazines' >> configName _x)}" configClasses (configFile >> QGVAR(groups));
|
2019-06-08 04:47:39 +00:00
|
|
|
private _carryMag = configName (_groups param [0, configNull]);
|
|
|
|
if ((_carryMag == "") && {_logAll || {_xMag in _loadedMags}}) then {
|
2021-10-10 16:55:14 +00:00
|
|
|
private _vehs = _hash getOrDefault [_xMag, []];
|
2019-06-08 04:47:39 +00:00
|
|
|
if (_xMag in _loadedMags) then {
|
|
|
|
_vehs pushBack _vehicleType;
|
|
|
|
};
|
2021-10-10 16:55:14 +00:00
|
|
|
_hash set [_xMag, _vehs];
|
2019-06-08 04:47:39 +00:00
|
|
|
};
|
|
|
|
} forEach _weapMags;
|
|
|
|
} forEach _weapons;
|
|
|
|
} forEach _staticWeaponConfigs;
|
|
|
|
|
2021-10-10 16:55:14 +00:00
|
|
|
{
|
|
|
|
//IGNORE_PRIVATE_WARNING ["_x", "_y"];
|
2024-02-07 23:36:13 +00:00
|
|
|
INFO_2("[%1] has no carry variant - Used in %2",_x,_y);
|
2021-10-10 16:55:14 +00:00
|
|
|
} forEach _hash;
|
2019-06-08 04:47:39 +00:00
|
|
|
|
|
|
|
INFO("------ End -------");
|