mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #3343 from acemod/fixRHSCompat
Fix AB compat with subsonic RHS ammo
This commit is contained in:
commit
02e530a99c
@ -36,3 +36,7 @@ if (!hasInterface) exitWith {};
|
|||||||
[] call FUNC(updateTrajectoryPFH);
|
[] call FUNC(updateTrajectoryPFH);
|
||||||
|
|
||||||
}] call EFUNC(common,addEventHandler);
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
|
#ifdef DEBUG_MODE_FULL
|
||||||
|
call FUNC(diagnoseWeapons);
|
||||||
|
#endif
|
@ -7,6 +7,7 @@ PREP(calculateAtmosphericCorrection);
|
|||||||
PREP(calculateBarrelLengthVelocityShift);
|
PREP(calculateBarrelLengthVelocityShift);
|
||||||
PREP(calculateRetardation);
|
PREP(calculateRetardation);
|
||||||
PREP(calculateStabilityFactor);
|
PREP(calculateStabilityFactor);
|
||||||
|
PREP(diagnoseWeapons);
|
||||||
PREP(displayProtractor);
|
PREP(displayProtractor);
|
||||||
PREP(handleFired);
|
PREP(handleFired);
|
||||||
PREP(initializeTerrainExtension);
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
@ -14,12 +14,6 @@ class CfgAmmo {
|
|||||||
ACE_muzzleVelocities[]={780, 880, 920};
|
ACE_muzzleVelocities[]={780, 880, 920};
|
||||||
ACE_barrelLengths[]={254.0, 414.02, 508.0};
|
ACE_barrelLengths[]={254.0, 414.02, 508.0};
|
||||||
};
|
};
|
||||||
class rhs_B_545x39_7U1_Ball: rhs_B_545x39_Ball {
|
|
||||||
//Subsonic - ToDo need full config for this bullet
|
|
||||||
ACE_ammoTempMuzzleVelocityShifts[]={-8.85,-8.49,-7.61667,-6.70667,-5.66,-4.26667,-2.54667,-0.51,1.98667,5.05667,8.73}; //Just Scaled Down Normal?
|
|
||||||
ACE_muzzleVelocities[] = {303};
|
|
||||||
ACE_barrelLengths[] = {200};
|
|
||||||
};
|
|
||||||
class rhs_B_545x39_Ball_Tracer_Green: rhs_B_545x39_Ball {
|
class rhs_B_545x39_Ball_Tracer_Green: rhs_B_545x39_Ball {
|
||||||
ACE_caliber=5.588;
|
ACE_caliber=5.588;
|
||||||
ACE_bulletLength=21.59;
|
ACE_bulletLength=21.59;
|
||||||
@ -81,12 +75,6 @@ class CfgAmmo {
|
|||||||
ACE_muzzleVelocities[]={650, 716, 750};
|
ACE_muzzleVelocities[]={650, 716, 750};
|
||||||
ACE_barrelLengths[]={254.0, 414.02, 508.0};
|
ACE_barrelLengths[]={254.0, 414.02, 508.0};
|
||||||
};
|
};
|
||||||
class rhs_B_762x39_U_Ball: rhs_B_762x39_Ball {
|
|
||||||
//Subsonic - ToDo need full config for this bullet
|
|
||||||
ACE_ammoTempMuzzleVelocityShifts[]={-8.85,-8.49,-7.61667,-6.70667,-5.66,-4.26667,-2.54667,-0.51,1.98667,5.05667,8.73}; //Just Scaled Down Normal?
|
|
||||||
ACE_muzzleVelocities[] = {295};
|
|
||||||
ACE_barrelLengths[] = {414};
|
|
||||||
};
|
|
||||||
class rhs_B_762x39_Tracer: rhs_B_762x39_Ball {
|
class rhs_B_762x39_Tracer: rhs_B_762x39_Ball {
|
||||||
ACE_caliber=7.823;
|
ACE_caliber=7.823;
|
||||||
ACE_bulletLength=28.956;
|
ACE_bulletLength=28.956;
|
||||||
@ -124,11 +112,35 @@ class CfgAmmo {
|
|||||||
ACE_muzzleVelocities[]={298, 330, 350};
|
ACE_muzzleVelocities[]={298, 330, 350};
|
||||||
ACE_barrelLengths[]={96.52, 127.0, 228.6};
|
ACE_barrelLengths[]={96.52, 127.0, 228.6};
|
||||||
};
|
};
|
||||||
|
class rhs_B_545x39_7U1_Ball: rhs_B_545x39_Ball {
|
||||||
|
// @todo: Provide accurate coefficients for this subsonic ammo
|
||||||
|
// In the meantime, prevent it inheriting from its supersonic parent
|
||||||
|
// ammoTempMuzzleVelocityShifts scaled down from normal
|
||||||
|
ACE_ammoTempMuzzleVelocityShifts[]={-8.85,-8.49,-7.61667,-6.70667,-5.66,-4.26667,-2.54667,-0.51,1.98667,5.05667,8.73};
|
||||||
|
ACE_muzzleVelocities[] = {};
|
||||||
|
ACE_barrelLengths[] = {};
|
||||||
|
};
|
||||||
|
class rhs_B_762x39_U_Ball: rhs_B_762x39_Ball {
|
||||||
|
// @todo: Provide accurate coefficients for this subsonic ammo
|
||||||
|
// In the meantime, prevent it inheriting from its supersonic parent
|
||||||
|
// ammoTempMuzzleVelocityShifts scaled down from normal
|
||||||
|
ACE_ammoTempMuzzleVelocityShifts[]={-8.85,-8.49,-7.61667,-6.70667,-5.66,-4.26667,-2.54667,-0.51,1.98667,5.05667,8.73}; //Just Scaled Down Normal?
|
||||||
|
ACE_muzzleVelocities[] = {};
|
||||||
|
ACE_barrelLengths[] = {};
|
||||||
|
};
|
||||||
|
class rhs_B_9x39_SP5: rhs_B_762x39_Ball {
|
||||||
|
// @todo: Provide accurate coefficients for this subsonic ammo
|
||||||
|
// In the meantime, prevent it inheriting from its supersonic parent
|
||||||
|
ACE_ammoTempMuzzleVelocityShifts[]={};
|
||||||
|
ACE_muzzleVelocities[]={};
|
||||||
|
ACE_barrelLengths[]={};
|
||||||
|
};
|
||||||
|
|
||||||
class SubmunitionBase;
|
class SubmunitionBase;
|
||||||
class rhs_ammo_127x108mm_x5: SubmunitionBase {
|
class rhs_ammo_127x108mm_x5: SubmunitionBase {
|
||||||
ACE_rearm_caliber=13;
|
ACE_rearm_caliber=13;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GrenadeHand;
|
class GrenadeHand;
|
||||||
class rhs_ammo_rgd5: GrenadeHand {
|
class rhs_ammo_rgd5: GrenadeHand {
|
||||||
ace_frag_enabled = 1;
|
ace_frag_enabled = 1;
|
||||||
@ -165,7 +177,7 @@ class CfgAmmo {
|
|||||||
class rhs_ammo_fakels: rhs_ammo_fakel {};
|
class rhs_ammo_fakels: rhs_ammo_fakel {};
|
||||||
class rhs_ammo_zarya2: rhs_ammo_fakels {};
|
class rhs_ammo_zarya2: rhs_ammo_fakels {};
|
||||||
class rhs_ammo_plamyam: rhs_ammo_fakels {};
|
class rhs_ammo_plamyam: rhs_ammo_fakels {};
|
||||||
|
|
||||||
class RocketBase;
|
class RocketBase;
|
||||||
class R_PG32V_F: RocketBase {};
|
class R_PG32V_F: RocketBase {};
|
||||||
class rhs_rpg26_rocket: R_PG32V_F {};
|
class rhs_rpg26_rocket: R_PG32V_F {};
|
||||||
|
Loading…
Reference in New Issue
Block a user