General - Optimize tracer status with getShotInfo

This commit is contained in:
PabstMirror 2024-03-03 00:46:03 -06:00
parent 64538f2ad0
commit d6c9b99a2f
3 changed files with 7 additions and 22 deletions

View File

@ -43,10 +43,7 @@ if (_abort) then {
}; };
if (ACE_player distance _unit > _maxRange && {ACE_player distance ((getPosASL _unit) vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply _maxRange)) > _maxRange}) exitWith {}; if (ACE_player distance _unit > _maxRange && {ACE_player distance ((getPosASL _unit) vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply _maxRange)) > _maxRange}) exitWith {};
private _ammoCount = (_unit ammo _muzzle) + 1; if (_projectile getShotInfo 4) exitWith { _abort = false }; // 4=shownTracer
private _tracersEvery = getNumber(configFile >> "CfgMagazines" >> _magazine >> "tracersEvery");
private _lastRoundsTracer = getNumber(configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer");
if (_ammoCount <= _lastRoundsTracer || {_tracersEvery > 0 && {(_ammoCount - _lastRoundsTracer) % _tracersEvery == 0}}) exitWith { _abort = false };
if (GVAR(bulletTraceEnabled) && {_muzzleVelocity > BULLET_TRACE_MIN_VELOCITY} && {cameraView == "GUNNER"}) then { if (GVAR(bulletTraceEnabled) && {_muzzleVelocity > BULLET_TRACE_MIN_VELOCITY} && {cameraView == "GUNNER"}) then {
if (currentWeapon ACE_player == binocular ACE_player) exitWith { _abort = false }; if (currentWeapon ACE_player == binocular ACE_player) exitWith { _abort = false };

View File

@ -38,12 +38,7 @@ private _visibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFi
private _isTracer = call { private _isTracer = call {
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false}; if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false};
private _indexShot = (_unit ammo _weapon) + 1; _projectile getShotInfo 4 // 4=shownTracer
private _lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer");
if (_indexShot <= _lastRoundsTracer) exitWith {true};
private _tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery");
if (_tracersEvery == 0) exitWith {false};
(_indexShot - _lastRoundsTracer) % _tracersEvery == 0
}; };
TRACE_3("",_ammo,_visibleFire,_isTracer); TRACE_3("",_ammo,_visibleFire,_isTracer);

View File

@ -18,18 +18,11 @@
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_vehicle,_gunner,_turret); TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_vehicle,_gunner,_turret);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {_projectile isKindOf "BulletBase" && {_unit isKindOf "Man"}}) exitWith {false}; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {_projectile isKindOf "BulletBase" && {_unit isKindOf "Man"}}) exitWith {};
if (!((_projectile isKindOf "BulletBase") || {_projectile isKindOf "GrenadeBase"})) exitWith {false}; if (!((_projectile isKindOf "BulletBase") || {_projectile isKindOf "GrenadeBase"})) exitWith {};
if (_unit distance ACE_player > 2000) exitWith {false}; if (_unit distance ACE_player > 2000) exitWith {};
private _abort = false; if (!local _unit && {_projectile isKindOf "BulletBase"} && {!(_projectile getShotInfo 4)}) exitWith {}; // 4=shownTracer
if (!local _unit && {_projectile isKindOf "BulletBase"}) then {
private _ammoCount = (_unit ammo _muzzle) + 1;
private _tracersEvery = getNumber(configFile >> "CfgMagazines" >> _magazine >> "tracersEvery");
private _lastRoundsTracer = getNumber(configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer");
_abort = _ammoCount > _lastRoundsTracer && {_tracersEvery == 0 || {(_ammoCount - _lastRoundsTracer) % _tracersEvery != 0}};
};
if (_abort) exitWith {false};
GVAR(trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; GVAR(trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];