mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Tools - Added automated magazine- and weapon class 'initSpeed' calculator
This commit is contained in:
parent
734c68d723
commit
df2a7d3853
@ -54,4 +54,4 @@ if (!hasInterface) exitWith {};
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
call FUNC(diagnoseWeapons);
|
||||
#endif
|
||||
#endif
|
||||
|
@ -19,6 +19,13 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private _diagnoseStartTime = diag_tickTime;
|
||||
#ifdef DEBUG_INIT_SPEEDS
|
||||
private _data = [];
|
||||
private _weapons = [];
|
||||
private _magazines = [];
|
||||
private _weaponInitSpeeds = [];
|
||||
private _magazineInitSpeeds = [];
|
||||
#endif
|
||||
|
||||
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||
for "_i" from 0 to (count _cfgWeapons)-1 do {
|
||||
@ -26,8 +33,8 @@ for "_i" from 0 to (count _cfgWeapons)-1 do {
|
||||
if (isClass _weaponConfig) then {
|
||||
private _weapon = configName _weaponConfig;
|
||||
private _weaponType = getNumber (_weaponConfig >> "Type");
|
||||
if (_weaponType == 1) then {
|
||||
// The weapon is a primary weapon
|
||||
if (_weaponType in [1, 2]) then {
|
||||
// The weapon is a primary weapon or a handgun weapon
|
||||
|
||||
private _weaponInitSpeed = getNumber (_weaponConfig >> "initSpeed");
|
||||
private _magazines = getArray (_weaponConfig >> "magazines");
|
||||
@ -64,9 +71,10 @@ for "_i" from 0 to (count _cfgWeapons)-1 do {
|
||||
private _abInitialSpeed = _vanillaInitialSpeed + _barrelVelocityShift;
|
||||
// --------------------------------------------------
|
||||
|
||||
private _result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable];
|
||||
|
||||
if (_weapon find "_base" == -1 && _weapon find "_Base" == -1) then {
|
||||
#ifdef DEBUG_INIT_SPEEDS
|
||||
_data pushBack [-_forEachIndex, _abInitialSpeed, _magazine, _weapon];
|
||||
#endif
|
||||
if (_barrelLength > 0 && abs(_vanillaInitialSpeed - _abInitialSpeed) > abs(_abInitialSpeed) * 0.0025) then {
|
||||
diag_log text format ["AB_Diagnose_initSpeed,%1,%2,%3,%4,%5,%6,%7,%8",_weapon,_magazine,_ammo,_magazineInitSpeed,_weaponInitSpeed,_vanillaInitialSpeed,_abInitialSpeed,_abInitialSpeed/_vanillaInitialSpeed];
|
||||
};
|
||||
@ -82,4 +90,44 @@ for "_i" from 0 to (count _cfgWeapons)-1 do {
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef DEBUG_INIT_SPEEDS
|
||||
_data sort false;
|
||||
{
|
||||
_x params ["_magazineIndex", "_abInitialSpeed", "_magazine", "_weapon"];
|
||||
if (_magazines find _magazine == -1) then {
|
||||
private _magSpeed = _abInitialSpeed;
|
||||
private _ammoRef = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
if (_ammoRef != "") then {
|
||||
{
|
||||
private _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo");
|
||||
if (_ammo == _ammoRef) exitWith {
|
||||
_magSpeed = _magazineInitSpeeds select _forEachIndex;
|
||||
};
|
||||
} forEach _magazines;
|
||||
};
|
||||
_magazines pushBack _magazine;
|
||||
_magazineInitSpeeds pushBack round(_magSpeed);
|
||||
};
|
||||
if (_weapons find _weapon == -1) then {
|
||||
_weapons pushBack _weapon;
|
||||
_magIndex = _magazines find _magazine;
|
||||
_magSpeed = _magazineInitSpeeds select _magIndex;
|
||||
_weaponInitSpeeds pushBack (_abInitialSpeed / _magSpeed);
|
||||
};
|
||||
} forEach _data;
|
||||
{
|
||||
_x params ["_magazineIndex", "_abInitialSpeed", "_magazine", "_weapon"];
|
||||
_magIndex = _magazines find _magazine;
|
||||
_magSpeed = _magazineInitSpeeds select _magIndex;
|
||||
_wepIndex = _weapons find _weapon;
|
||||
_wepSpeed = _weaponInitSpeeds select _wepIndex;
|
||||
} forEach _data;
|
||||
{
|
||||
diag_log text format ["AB_WeaponInitSpeed,%1,%2", _x, _weaponInitSpeeds select _forEachIndex];
|
||||
} forEach _weapons;
|
||||
{
|
||||
diag_log text format ["AB_MagazineInitSpeed,%1,%2", _x, _magazineInitSpeeds select _forEachIndex];
|
||||
} forEach _magazines;
|
||||
#endif
|
||||
|
||||
diag_log format["AdvancedBallistics: Finished 'diagnoseWeapons' in %1 seconds", (diag_tickTime - _diagnoseStartTime) toFixed 2];
|
||||
|
@ -6,6 +6,8 @@
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#define DEBUG_INIT_SPEEDS
|
||||
|
||||
#ifdef DEBUG_ENABLED_ADVANCEDBALLISTICS
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user