mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
function header and variable name readability
This commit is contained in:
parent
78a27ff025
commit
dfdea2d9c7
@ -1,18 +1,17 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger
|
||||
* This function returns fragmentation parameters for a specific
|
||||
* ammo type.
|
||||
* This function returns fragmentation parameters for a specific ammo type.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _ammo <STRING> - CfgAmmo type of ammo to check.
|
||||
* 0: Ammo classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* _ammoInfo <ARRAY>
|
||||
* 0: _fragRange - search range for fragments. <NUMBER>
|
||||
* 1: _fragVel - gurney equation calculated velocity. <NUMBER>
|
||||
* 2: _fragTypes - array of fragment types. <ARRAY>
|
||||
* 3: _fragCount - modified frag count used under assumptions of spherical fragmentation. <NUMBER>
|
||||
* 0: Search range for fragments in meters <NUMBER>
|
||||
* 1: Gurney equation calculated speed <NUMBER>
|
||||
* 2: Array of fragment types <ARRAY>
|
||||
* 3: Modified frag count under assumptions of spherical fragmentation <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* ["B_556x45_Ball"] call ace_frag_fnc_getFragInfo;
|
||||
@ -28,18 +27,18 @@ if (!isNil "_ammoInfo") exitWith {_ammoInfo};
|
||||
|
||||
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
|
||||
private _fragTypes = [];
|
||||
private _notify = false;
|
||||
private _notifyMissingEntries = false;
|
||||
if (isArray (_ammoConfig >> QGVAR(classes))) then {
|
||||
_fragTypes = getArray (_ammoConfig >> QGVAR(classes));
|
||||
} else {
|
||||
_notify = true;
|
||||
_notifyMissingEntries = true;
|
||||
};
|
||||
|
||||
/************ Gurney equation notes *****************//*
|
||||
* see https://en.wikipedia.org/wiki/Gurney_equations
|
||||
*
|
||||
* GURNEY_K is the geometry constant added to _metalMass/_chargeMass
|
||||
* GURNEY_C = sqrt(2E)
|
||||
* gurney_k is the geometry constant added to _metalMass/_chargeMass
|
||||
* gurney_c = sqrt(2E)
|
||||
*
|
||||
* _chargeMass = 185; - grams of comp-b
|
||||
* _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));
|
||||
if (_chargeMass == 0) then {
|
||||
_chargeMass = 1;
|
||||
_notify = true;
|
||||
_notifyMissingEntries = true;
|
||||
};
|
||||
|
||||
private _metalMass = getNumber (_ammoConfig >> QGVAR(METAL));
|
||||
if (_metalMass == 0) then {
|
||||
_metalMass = 2;
|
||||
_notify = true;
|
||||
_notifyMissingEntries = true;
|
||||
};
|
||||
|
||||
private _geometryCoefficient = getNumber (_ammoConfig >> QGVAR(GURNEY_K));
|
||||
if (_geometryCoefficient == 0) then {
|
||||
_geometryCoefficient = 0.8;
|
||||
_notify = true;
|
||||
_notifyMissingEntries = true;
|
||||
};
|
||||
|
||||
private _gurneyConstant = getNumber (_ammoConfig >> QGVAR(GURNEY_C));
|
||||
if (_gurneyConstant == 0) then {
|
||||
_gurneyConstant = 2440;
|
||||
_notify = true;
|
||||
_notifyMissingEntries = true;
|
||||
};
|
||||
|
||||
private _fragCount = getNumber (_ammoConfig >> QGVAR(fragCount));
|
||||
if (_fragCount == 0) then {
|
||||
_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);
|
||||
};
|
||||
|
||||
/********************** _ammoInfo format *************************//*
|
||||
* 0: _fragRange - search range for fragments, calculated with
|
||||
* the minimum chance to hit as defined
|
||||
* 0: _fragRange - search range for fragments, calculated with the minimum chance to hit as defined
|
||||
* 1: _fragVelocity - gurney equation calculated velocity
|
||||
* 2: _fragTypes - array of fragment types
|
||||
* 3: _fragCount - modified frag count used under assumptions
|
||||
* of spherical fragmentation
|
||||
* 3: _fragCount - modified frag count used under assumptions of spherical fragmentation
|
||||
*/
|
||||
_ammoInfo = [
|
||||
ACE_FRAG_MAX_FRAG_RANGE max sqrt (_fragCount / (4 * pi * ACE_FRAG_MIN_FRAG_HIT_CHANCE)),
|
||||
|
Loading…
Reference in New Issue
Block a user