From 23da6bf4b3cf35bd4038ad8bcb44ddb3b832991f Mon Sep 17 00:00:00 2001 From: ulteq Date: Thu, 23 Nov 2017 12:48:20 +0100 Subject: [PATCH] Advanced Ballistics - Optimized abort conditions --- .../functions/fnc_handleFirePFH.sqf | 9 +++------ .../functions/fnc_handleFired.sqf | 16 ++++++---------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf index e7df7fa1606..e22a9a3a538 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf @@ -18,16 +18,13 @@ { _x params ["_bullet","_caliber","_bulletTraceVisible","_index"]; - private _bulletVelocity = velocity _bullet; - - private _bulletSpeed = vectorMagnitude _bulletVelocity; - - if (!alive _bullet || _bulletSpeed < 100) then { + if (!alive _bullet) then { GVAR(allBullets) deleteAt (GVAR(allBullets) find _x); } else { + private _bulletVelocity = velocity _bullet; private _bulletPosition = getPosASL _bullet; - if (_bulletTraceVisible && _bulletSpeed > 500) then { + if (_bulletTraceVisible && {vectorMagnitude _bulletVelocity > 500}) then { drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; }; diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index b219c9be1db..dd634e013bd 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -19,28 +19,24 @@ //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); -private _abort = false; - if (!(_ammo isKindOf "BulletBase")) exitWith {}; if (!alive _projectile) exitWith {}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {}; if (underwater _unit) exitWith {}; -if (!GVAR(simulateForEveryone) && !(local _unit)) then { - // The shooter is non local - _abort = true; - if (GVAR(simulateForSnipers)) then { + +private _abort = GVAR(disabledInFullAutoMode) && {getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1}; +if (!local _unit && {!_abort && !GVAR(simulateForEveryone)}) then { + // The shooter is non local -> abort unless we match an exception rule + _abort = !GVAR(simulateForGroupMembers) || {group ACE_player != group _unit}; + if (_abort && GVAR(simulateForSnipers)) then { if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then { private _opticsName = (primaryWeaponItems _unit) select 2; private _opticType = getNumber(configFile >> "CfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); _abort = _opticType != 2; // We only abort if the non local shooter is not a sniper }; }; - if (GVAR(simulateForGroupMembers) && _abort) then { - _abort = (group ACE_player) != (group _unit); - }; }; //if (!GVAR(vehicleGunnerEnabled) && !(_unit isKindOf "Man")) then { _abort = true; }; // We currently do not have firedEHs on vehicles -if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; }; // Get Weapon and Ammo Configurations private _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];