2015-08-16 17:49:47 +00:00
/*
* Author: Glowbal, Ruthberg, joko // Jonas
* Handle the PFH for Bullets
*
* Arguments:
* None
*
* Return Value:
* None
*
2017-06-08 13:31:51 +00:00
* Example:
* [] call ace_advanced_ballistics_fnc_handleFirePFH
*
2015-08-16 17:49:47 +00:00
* Public: No
*/
#include "script_component.hpp"
{
2016-09-04 14:44:22 +00:00
_x params ["_bullet","_caliber","_bulletTraceVisible","_index"];
2015-08-16 17:49:47 +00:00
2017-11-23 12:44:47 +00:00
if (!alive _bullet) then {
2015-11-18 13:10:01 +00:00
GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
2015-11-17 03:31:17 +00:00
} else {
2017-11-23 12:44:47 +00:00
private _bulletVelocity = velocity _bullet;
2016-09-04 14:44:22 +00:00
private _bulletPosition = getPosASL _bullet;
2015-08-16 17:49:47 +00:00
2017-11-23 12:44:47 +00:00
if (_bulletTraceVisible && {vectorMagnitude _bulletVelocity > 500}) then {
2015-11-17 03:31:17 +00:00
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,"","",""];
};
2015-08-16 17:49:47 +00:00
2017-11-10 14:44:15 +00:00
_bullet setVelocity (_bulletVelocity vectorAdd (parseSimpleArray ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6", _index, _bulletVelocity, _bulletPosition, wind, ASLToATL(_bulletPosition) select 2, CBA_missionTime toFixed 6])));
2015-08-16 17:49:47 +00:00
};
2015-11-18 13:10:01 +00:00
nil
} count +GVAR(allBullets);
2015-08-16 17:49:47 +00:00
if (GVAR(allBullets) isEqualTo []) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
GVAR(BulletPFH) = nil;
};