From 5428eff55092694625f7702259affcd35fec9cf5 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 14 Sep 2018 20:10:30 -0500 Subject: [PATCH] ProjectileTracking - Stop tracking stationary objects --- .../fnc_projectileTracking_trackProjectile.sqf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/diagnostic/fnc_projectileTracking_trackProjectile.sqf b/addons/diagnostic/fnc_projectileTracking_trackProjectile.sqf index 34665d953..8e0dc6ff8 100644 --- a/addons/diagnostic/fnc_projectileTracking_trackProjectile.sqf +++ b/addons/diagnostic/fnc_projectileTracking_trackProjectile.sqf @@ -28,6 +28,10 @@ params ["_args", "_handle"]; _args params ["_projectile", "_index", "_initialProjectileData"]; if (!isNull _projectile) then { + private _speed = vectorMagnitude velocity _projectile; + if (_speed < 0.1) then { // If projectile is slowed down, stop tracking after this run + [_handle] call CBA_fnc_removePerFrameHandler; + }; private _data = []; private _bulletData = []; @@ -39,13 +43,9 @@ if (!isNull _projectile) then { } else { _bulletData = [_initialProjectileData]; _data = [_handle, _bulletData]; + GVAR(projectileData) set [_index, _data]; }; - - _bulletData pushBack [(getPos _projectile), vectorMagnitude (velocity _projectile)]; - - _data set [1, _bulletData]; - - GVAR(projectileData) set [_index, _data]; + _bulletData pushBack [(getPos _projectile), _speed]; } else { [_handle] call CBA_fnc_removePerFrameHandler;