Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Ballistics - Optimized abort conditions #5811

Merged
merged 1 commit into from
Nov 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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,"","",""];
};

Expand Down
16 changes: 6 additions & 10 deletions addons/advanced_ballistics/functions/fnc_handleFired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down