2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2017-06-08 13:31:51 +00:00
|
|
|
/*
|
2024-01-11 23:58:47 +00:00
|
|
|
* Author: ACE-Team, Lambda.Tiger
|
2024-01-13 06:35:22 +00:00
|
|
|
* This function will dump every ammo config that would generate ace_frag
|
2024-01-18 02:51:59 +00:00
|
|
|
* fragments that could be fired from a weapon.
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2024-02-16 02:59:58 +00:00
|
|
|
* 0: Log ammo types that wouldn't normally frag <BOOL> (default: false)
|
|
|
|
* 1: Only print ammo without ACE_frag entries, inherited or otherwise <BOOL> (default: true)
|
2024-02-08 23:11:57 +00:00
|
|
|
* 2: Only export ammo classes of classes referenced in CfgMagazines and their
|
2024-02-16 02:59:58 +00:00
|
|
|
* submunitions <BOOL> (default: false)
|
|
|
|
* 3: Force a CSV format on debug print. <BOOL> (default: false)
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2024-01-15 21:37:18 +00:00
|
|
|
* call ace_frag_fnc_dev_debugAmmo
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2024-01-18 02:51:59 +00:00
|
|
|
|
2016-10-26 22:16:31 +00:00
|
|
|
params [
|
2024-01-15 19:13:59 +00:00
|
|
|
["_logAll", false, [false]],
|
2024-02-08 23:11:57 +00:00
|
|
|
["_printOnlyIncomplete", true, [true]],
|
2024-01-12 07:50:01 +00:00
|
|
|
["_onlyShotAmmoTypes", false, [false]],
|
2024-01-11 23:58:47 +00:00
|
|
|
["_csvFormat", false, [false]]
|
2016-10-26 22:16:31 +00:00
|
|
|
];
|
2016-05-07 20:35:39 +00:00
|
|
|
|
|
|
|
diag_log text format ["~~~~~~~~~~~~~Start [%1]~~~~~~~~~~~~~", _this];
|
2024-01-12 07:50:01 +00:00
|
|
|
if (_csvFormat) then {
|
2024-02-08 23:11:57 +00:00
|
|
|
diag_log text format ["ammo,gurney_c,gurney_m,gurney_k,gurney_gC,skip,fragCount,Inheritance"];
|
2024-01-12 07:50:01 +00:00
|
|
|
};
|
2016-05-07 20:35:39 +00:00
|
|
|
|
2024-01-13 06:35:22 +00:00
|
|
|
// Gather all configs, either those that could be created from firing or all classes
|
2024-01-12 07:50:01 +00:00
|
|
|
private _allAmmoConfigs = [];
|
|
|
|
if (_onlyShotAmmoTypes) then {
|
2024-03-29 00:59:49 +00:00
|
|
|
private _configSearchFunction = {
|
2024-01-12 07:50:01 +00:00
|
|
|
params [
|
|
|
|
["_ammo", "", [""]]
|
|
|
|
];
|
|
|
|
if (_ammo isEqualTo "" || {_ammo in _allAmmoConfigs}) exitWith {};
|
|
|
|
_allAmmoConfigs pushBack _ammo;
|
2024-01-19 19:32:22 +00:00
|
|
|
private _cfgAmmoRoot = configFile >> "CfgAmmo";
|
|
|
|
private _submunitionConfig = _cfgAmmoRoot >> _ammo >> "submunitionAmmo";
|
2024-01-18 22:01:11 +00:00
|
|
|
if (isArray _submunitionConfig) then {
|
|
|
|
private _subMunition = getArray _submunitionConfig;
|
2024-01-18 02:51:59 +00:00
|
|
|
for "_i" from 0 to count _subMunition - 1 do {
|
2024-01-12 07:50:01 +00:00
|
|
|
if (_i mod 2 == 0) then {
|
2024-03-29 00:59:49 +00:00
|
|
|
configName (_cfgAmmoRoot >> (_subMunition#_i)) call _configSearchFunction;
|
2024-01-12 07:50:01 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
} else {
|
2024-01-18 22:01:11 +00:00
|
|
|
private _subMunition = getText _submunitionConfig;
|
|
|
|
if (_subMunition isNotEqualTo "") then {
|
2024-03-29 00:59:49 +00:00
|
|
|
configName (_cfgAmmoRoot >> _subMunition) call _configSearchFunction;
|
2024-01-18 22:01:11 +00:00
|
|
|
};
|
2024-01-12 07:50:01 +00:00
|
|
|
};
|
|
|
|
};
|
2024-01-18 02:51:59 +00:00
|
|
|
private _allMagazineConfigs = configProperties [configFile >> "CfgMagazines", "isClass _x", true];
|
2024-01-19 19:32:22 +00:00
|
|
|
private _cfgAmmoCfgPath = configFile >> "CfgAmmo";
|
2024-01-12 07:50:01 +00:00
|
|
|
{
|
2024-01-19 19:32:22 +00:00
|
|
|
private _magAmmo = getText (_x >> "ammo");
|
2024-03-29 00:59:49 +00:00
|
|
|
configName (_cfgAmmoCfgPath >> _magAmmo) call _configSearchFunction;
|
2024-01-12 07:50:01 +00:00
|
|
|
} forEach _allMagazineConfigs;
|
|
|
|
} else {
|
2024-01-16 00:47:06 +00:00
|
|
|
_allAmmoConfigs = configProperties [configFile >> "CfgAmmo", "isClass _x && !('ace_frag' in configName _x)", true] apply {configName _x};
|
2024-01-11 23:58:47 +00:00
|
|
|
};
|
|
|
|
|
2024-01-12 07:50:01 +00:00
|
|
|
private _processedCfgAmmos = [];
|
2024-01-11 23:58:47 +00:00
|
|
|
private _printCount = 0;
|
2024-01-13 06:35:22 +00:00
|
|
|
{ // Begin forEach to check each ammo type
|
2024-01-12 07:50:01 +00:00
|
|
|
private _ammo = _x;
|
2024-01-18 22:01:11 +00:00
|
|
|
if (_ammo isNotEqualTo "") then {
|
2016-05-07 20:35:39 +00:00
|
|
|
_processedCfgAmmos pushBack _ammo;
|
|
|
|
|
2024-01-18 02:51:59 +00:00
|
|
|
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
|
2024-07-17 03:03:15 +00:00
|
|
|
_ammo call FUNC(shouldFrag) params ["_shouldFrag"];
|
2016-05-07 20:35:39 +00:00
|
|
|
|
2024-03-13 19:38:32 +00:00
|
|
|
if (_shouldFrag || _logAll) then {
|
2016-10-26 22:16:31 +00:00
|
|
|
|
2024-02-15 01:55:26 +00:00
|
|
|
private _print = false;
|
2024-02-08 23:11:57 +00:00
|
|
|
private _skip = getNumber (_ammoConfig >> QGVAR(skip));
|
2024-02-14 22:50:09 +00:00
|
|
|
private _fragTypes = getArray (_ammoConfig >> QGVAR(classes));
|
2024-02-15 01:55:26 +00:00
|
|
|
if (_fragTypes isEqualTo []) then {_print = true;};
|
2024-02-14 22:50:09 +00:00
|
|
|
private _c = getNumber (_ammoConfig >> QGVAR(charge));
|
2024-02-15 01:55:26 +00:00
|
|
|
if (_c == 0) then {_print = true;};
|
2024-02-14 22:50:09 +00:00
|
|
|
private _m = getNumber (_ammoConfig >> QGVAR(metal));
|
2024-02-15 01:55:26 +00:00
|
|
|
if (_m == 0) then {_print = true;};
|
2024-02-14 22:50:09 +00:00
|
|
|
private _k = getNumber (_ammoConfig >> QGVAR(gurney_k));
|
2024-02-15 01:55:26 +00:00
|
|
|
if (_k == 0) then {_print = true;};
|
2024-02-14 22:50:09 +00:00
|
|
|
private _gC = getNumber (_ammoConfig >> QGVAR(gurney_c));
|
2024-02-15 01:55:26 +00:00
|
|
|
if (_gC == 0) then {_print = true;};
|
2024-01-11 23:58:47 +00:00
|
|
|
private _fragCount = getNumber (_ammoConfig >> QGVAR(fragCount));
|
2024-02-15 01:55:26 +00:00
|
|
|
if (_fragCount == 0) then {_fragCount = 200; _print = true;};
|
2024-01-13 06:35:22 +00:00
|
|
|
|
2024-02-15 01:55:26 +00:00
|
|
|
if (!_printOnlyIncomplete || {_print && _skip != 0}) then {
|
2024-01-11 23:58:47 +00:00
|
|
|
INC(_printCount);
|
|
|
|
if (_csvFormat) then {
|
2024-02-15 01:55:26 +00:00
|
|
|
diag_log text format ["%7,%1,%2,%3,%4,%5,%6,%9,%8", _c, _m, _k, _gC, _skip, _fragCount, _ammo, [_ammoConfig, true] call BIS_fnc_returnParents, _shouldFrag];
|
2024-01-11 23:58:47 +00:00
|
|
|
} else {
|
|
|
|
diag_log text format ["Ammo [%1] MISSING frag configs:", _ammo];
|
2024-02-08 23:11:57 +00:00
|
|
|
diag_log text format ["_c=%1,_m=%2,_k=%3,_gC=%4,_skip=%5,_fragCount=%6,_fragTypes=%7", _c, _m, _k, _gC, _skip, _fragCount, _fragTypes];
|
2024-01-11 23:58:47 +00:00
|
|
|
};
|
2016-05-07 20:35:39 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-01-11 23:58:47 +00:00
|
|
|
} forEach _allAmmoConfigs;
|
2016-05-07 20:35:39 +00:00
|
|
|
|
2024-01-11 23:58:47 +00:00
|
|
|
diag_log text format ["~~~~~~~~~~~~~~End [%1-%2]~~~~~~~~~~~~~~", count _allAmmoConfigs, count _processedCfgAmmos];
|
2024-01-15 19:13:59 +00:00
|
|
|
diag_log text format ["~~~~~~~~~~~~~~Printed: %1~~~~~~~~~~~", _printCount];
|