mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add a diagnose script to detect incompatibilities between vanilla and ab initial velocities
This commit is contained in:
parent
bf082e928d
commit
38c4b1dc81
@ -36,3 +36,7 @@ if (!hasInterface) exitWith {};
|
||||
[] call FUNC(updateTrajectoryPFH);
|
||||
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
call FUNC(diagnoseWeapons);
|
||||
#endif
|
@ -7,6 +7,7 @@ PREP(calculateAtmosphericCorrection);
|
||||
PREP(calculateBarrelLengthVelocityShift);
|
||||
PREP(calculateRetardation);
|
||||
PREP(calculateStabilityFactor);
|
||||
PREP(diagnoseWeapons);
|
||||
PREP(displayProtractor);
|
||||
PREP(handleFired);
|
||||
PREP(initializeTerrainExtension);
|
||||
|
59
addons/advanced_ballistics/functions/fnc_diagnoseWeapons.sqf
Normal file
59
addons/advanced_ballistics/functions/fnc_diagnoseWeapons.sqf
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* This function diagnoses all primary weapons to find cases in which the initial
|
||||
* velocity of shots with and without AB significantly mismatch
|
||||
*
|
||||
* Arguments:
|
||||
* None. Parameters inherited from EFUNC(common,firedEH)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||
for "_i" from 0 to (count _cfgWeapons)-1 do {
|
||||
private _weaponConfig = _cfgWeapons select _i;
|
||||
if (isClass _weaponConfig) then {
|
||||
private _weapon = configName _weaponConfig;
|
||||
private _weaponType = getNumber (_weaponConfig >> "Type");
|
||||
if (_weaponType == 1) then {
|
||||
// The weapon is a primary weapon
|
||||
|
||||
private _weaponInitSpeed = getNumber (_weaponConfig >> "initSpeed");
|
||||
private _magazines = getArray (_weaponConfig >> "magazines");
|
||||
{
|
||||
private _magazine = _x;
|
||||
private _magazineInitSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
||||
private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
|
||||
// Vanilla initial speed --------------------------
|
||||
private _vanillaInitialSpeed = _magazineInitSpeed;
|
||||
if (_weaponInitSpeed > 0) then {
|
||||
_vanillaInitialSpeed = _weaponInitSpeed;
|
||||
} else {
|
||||
if (_weaponInitSpeed < 0) then {
|
||||
_vanillaInitialSpeed = _vanillaInitialSpeed * (-_weaponInitSpeed);
|
||||
};
|
||||
};
|
||||
// --------------------------------------------------
|
||||
|
||||
// AB initial speed --------------------------------
|
||||
// Get Weapon and Ammo Configurations
|
||||
private _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
|
||||
private _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
|
||||
_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable"];
|
||||
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
|
||||
|
||||
private _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _vanillaInitialSpeed] call FUNC(calculateBarrelLengthVelocityShift);
|
||||
private _abInitialSpeed = _vanillaInitialSpeed + _barrelVelocityShift;
|
||||
// --------------------------------------------------
|
||||
diag_log text format ["ABDiagnose,%1,%2,%3,%4,%5,%6,%7",_weapon,_magazine,_ammo,_magazineInitSpeed,_weaponInitSpeed,_vanillaInitialSpeed,_abInitialSpeed];
|
||||
} forEach _magazines;
|
||||
};
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user