function header and variable name readability

This commit is contained in:
lambdatiger 2024-02-15 21:03:29 -06:00
parent 78a27ff025
commit dfdea2d9c7

View File

@ -1,18 +1,17 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: Jaynus, NouberNou, Lambda.Tiger * Author: Jaynus, NouberNou, Lambda.Tiger
* This function returns fragmentation parameters for a specific * This function returns fragmentation parameters for a specific ammo type.
* ammo type.
* *
* Arguments: * Arguments:
* 0: _ammo <STRING> - CfgAmmo type of ammo to check. * 0: Ammo classname <STRING>
* *
* Return Value: * Return Value:
* _ammoInfo <ARRAY> * _ammoInfo <ARRAY>
* 0: _fragRange - search range for fragments. <NUMBER> * 0: Search range for fragments in meters <NUMBER>
* 1: _fragVel - gurney equation calculated velocity. <NUMBER> * 1: Gurney equation calculated speed <NUMBER>
* 2: _fragTypes - array of fragment types. <ARRAY> * 2: Array of fragment types <ARRAY>
* 3: _fragCount - modified frag count used under assumptions of spherical fragmentation. <NUMBER> * 3: Modified frag count under assumptions of spherical fragmentation <NUMBER>
* *
* Example: * Example:
* ["B_556x45_Ball"] call ace_frag_fnc_getFragInfo; * ["B_556x45_Ball"] call ace_frag_fnc_getFragInfo;
@ -28,18 +27,18 @@ if (!isNil "_ammoInfo") exitWith {_ammoInfo};
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo; private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
private _fragTypes = []; private _fragTypes = [];
private _notify = false; private _notifyMissingEntries = false;
if (isArray (_ammoConfig >> QGVAR(classes))) then { if (isArray (_ammoConfig >> QGVAR(classes))) then {
_fragTypes = getArray (_ammoConfig >> QGVAR(classes)); _fragTypes = getArray (_ammoConfig >> QGVAR(classes));
} else { } else {
_notify = true; _notifyMissingEntries = true;
}; };
/************ Gurney equation notes *****************//* /************ Gurney equation notes *****************//*
* see https://en.wikipedia.org/wiki/Gurney_equations * see https://en.wikipedia.org/wiki/Gurney_equations
* *
* GURNEY_K is the geometry constant added to _metalMass/_chargeMass * gurney_k is the geometry constant added to _metalMass/_chargeMass
* GURNEY_C = sqrt(2E) * gurney_c = sqrt(2E)
* *
* _chargeMass = 185; - grams of comp-b * _chargeMass = 185; - grams of comp-b
* _metalMass = 210; - grams of metal are accelerated by explosion * _metalMass = 210; - grams of metal are accelerated by explosion
@ -58,44 +57,42 @@ if (isArray (_ammoConfig >> QGVAR(classes))) then {
private _chargeMass = getNumber (_ammoConfig >> QGVAR(CHARGE)); private _chargeMass = getNumber (_ammoConfig >> QGVAR(CHARGE));
if (_chargeMass == 0) then { if (_chargeMass == 0) then {
_chargeMass = 1; _chargeMass = 1;
_notify = true; _notifyMissingEntries = true;
}; };
private _metalMass = getNumber (_ammoConfig >> QGVAR(METAL)); private _metalMass = getNumber (_ammoConfig >> QGVAR(METAL));
if (_metalMass == 0) then { if (_metalMass == 0) then {
_metalMass = 2; _metalMass = 2;
_notify = true; _notifyMissingEntries = true;
}; };
private _geometryCoefficient = getNumber (_ammoConfig >> QGVAR(GURNEY_K)); private _geometryCoefficient = getNumber (_ammoConfig >> QGVAR(GURNEY_K));
if (_geometryCoefficient == 0) then { if (_geometryCoefficient == 0) then {
_geometryCoefficient = 0.8; _geometryCoefficient = 0.8;
_notify = true; _notifyMissingEntries = true;
}; };
private _gurneyConstant = getNumber (_ammoConfig >> QGVAR(GURNEY_C)); private _gurneyConstant = getNumber (_ammoConfig >> QGVAR(GURNEY_C));
if (_gurneyConstant == 0) then { if (_gurneyConstant == 0) then {
_gurneyConstant = 2440; _gurneyConstant = 2440;
_notify = true; _notifyMissingEntries = true;
}; };
private _fragCount = getNumber (_ammoConfig >> QGVAR(fragCount)); private _fragCount = getNumber (_ammoConfig >> QGVAR(fragCount));
if (_fragCount == 0) then { if (_fragCount == 0) then {
_fragCount = 400; _fragCount = 400;
_notify = true; _notifyMissingEntries = true;
}; };
if (_notify) then { if (_notifyMissingEntries) then {
INFO_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_ammo); INFO_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_ammo);
}; };
/********************** _ammoInfo format *************************//* /********************** _ammoInfo format *************************//*
* 0: _fragRange - search range for fragments, calculated with * 0: _fragRange - search range for fragments, calculated with the minimum chance to hit as defined
* the minimum chance to hit as defined
* 1: _fragVelocity - gurney equation calculated velocity * 1: _fragVelocity - gurney equation calculated velocity
* 2: _fragTypes - array of fragment types * 2: _fragTypes - array of fragment types
* 3: _fragCount - modified frag count used under assumptions * 3: _fragCount - modified frag count used under assumptions of spherical fragmentation
* of spherical fragmentation
*/ */
_ammoInfo = [ _ammoInfo = [
ACE_FRAG_MAX_FRAG_RANGE max sqrt (_fragCount / (4 * pi * ACE_FRAG_MIN_FRAG_HIT_CHANCE)), ACE_FRAG_MAX_FRAG_RANGE max sqrt (_fragCount / (4 * pi * ACE_FRAG_MIN_FRAG_HIT_CHANCE)),