ACE3/addons/frag/functions/fnc_dev_debugAmmo.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

82 lines
3.2 KiB
Plaintext

#define DEBUG_MODE_FULL
#include "script_component.hpp"
/*
* Author: ACE-Team
*
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_frag_fnc_debugAmmo
*
* Public: No
*/
params [
["_debugMissing", true, [false]],
["_debugForce", false, [false]],
["_debugSkippedFragPower", 30, [0]]
];
diag_log text format ["~~~~~~~~~~~~~Start [%1]~~~~~~~~~~~~~", _this];
private _allMagsConfigs = configProperties [configFile >> "CfgMagazines", "isClass _x", true];
private _processedCfgAmmos = [];
{
private _ammo = toLower getText (_x >> "ammo");
if (_ammo != "" && {!(_ammo in _processedCfgAmmos)}) then {
_processedCfgAmmos pushBack _ammo;
//Ignore mines/bombs
if (_ammo isKindOf "TimeBombCore") exitWith {};
_ammoConfig = configFile >> "CfgAmmo" >> _ammo;
//Read configs and test if it would actually cause a frag, using same logic as FUNC(pfhRound)
private _skip = getNumber (_ammoConfig >> QGVAR(skip));
private _explosive = getNumber (_ammoConfig >> "explosive");
private _indirectRange = getNumber (_ammoConfig >> "indirectHitRange");
private _force = getNumber (_ammoConfig >> QGVAR(force));
private _fragPower = getNumber (_ammoConfig >> "indirecthit") * (sqrt ((getNumber (_ammoConfig >> "indirectHitRange"))));
private _shouldAdd = (_skip == 0) && {(_force == 1) || {_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}}};
if (_shouldAdd) then {
if (_debugForce && {((getNumber(_ammoConfig >> "hit")) < 5) || {_fragPower < 10}}) then {
diag_log text format ["Ammo [%1] from Mag [%2] - Weak but will still frag!", _ammo, configName _x];
diag_log text format [" - _force=%1,_fragPower=%2", _force, _fragPower];
};
private _warn = false;
_fragTypes = getArray (_ammoConfig >> QGVAR(CLASSES));
if (_fragTypes isEqualTo []) then {_warn = true;};
_c = getNumber(_ammoConfig >> QGVAR(CHARGE));
if (_c == 0) then {_warn = true;};
_m = getNumber(_ammoConfig >> QGVAR(METAL));
if (_m == 0) then {_warn = true;};
_k = getNumber(_ammoConfig >> QGVAR(GURNEY_K));
if (_k == 0) then {_warn = true;};
_gC = getNumber(_ammoConfig >> QGVAR(GURNEY_C));
if (_gC == 0) then {_warn = true;};
if (_debugMissing && {_warn}) then {
diag_log text format ["Ammo [%1] from Mag [%2] MISSING frag configs:", _ammo, configName _x];
diag_log text format [" - _c=%1,_m=%2,_k=%3,_gC=%4,_fragTypes=%5", _c, _m, _k, _gC, _fragTypes];
};
} else {
if ((_fragPower > _debugSkippedFragPower) && {isArray (_ammoConfig >> QGVAR(CLASSES))}) then {
diag_log text format ["Ammo [%1] from Mag [%2] has frag configs but will NOT frag:", _ammo, configName _x];
diag_log text format ["- skip=%1,explosive=%2,indirectHitRange=%3,force=%4,fragPower=%5", _skip, _explosive, _indirectRange, _force, _fragPower];
};
};
};
} forEach _allMagsConfigs;
diag_log text format ["~~~~~~~~~~~~~End [%1-%2]~~~~~~~~~~~~~", count _allMagsConfigs, count _processedCfgAmmos];