private ["_launcher","_proj","_startTime","_fuse"];
 
// diag_log format ["_this: %1",_this];
// diag_log format ["(_this select 5): %1",(_this select 5)];
// diag_log format ["(_this select 6): %1",(_this select 6)];
 
_launcher = _this select 0;
_proj = _this select 6;
_startTime = diag_tickTime;
 
_fuse = [//PFH FNC Start
        {      
                private ["_params","_launcher","_proj","_time","_fuseCheck","_projPos","_spawnedproj"];
                _params = _this select 0;
                _launcher = _params select 0; // thing wot launched the missile
                _proj = _params select 1; // missile projectile
                _fuse = _params select 2; // prox fuse PFH handle
                _time = diag_tickTime;
 

                if ((!isNull _proj)) then { //if the missile is alive do the fuse check, if not remove this PFH
					
					//Track projectile data
 					diag_log format ["_proj: %1 | alive: %2 | Distance: %3", _proj, !isnull _proj, _launcher distance _proj];
					diag_log format ["_proj: %1 | Distance: %2 | Fused: %3", _proj, _launcher distance _proj,((_launcher distance _proj) > 50)];
					diag_log format ["_proj: %1 | Number Near: %2 | Fuse Activate: %3", _proj, count (nearestObjects [_proj, ["Air"], 30]), (count (nearestObjects [_proj, ["Air"], 30]) > 0)];

					// proximity check: if object is within 30m of the projectile          
                        if (  (_launcher distance _proj) > 50 && (count (nearestObjects [_proj, ["Air"], 30]) > 0)  ) then {                          
                                // if something triggers the prox fuse then delete projectile and create the explosion
                                _projPos = getPos _proj;
                                deleteVehicle _proj;
                                _spawnedproj = "tb_missile_BOLIDE_Det" createVehicle _projPos;  
								
								diag_log format ["_proj: %1 | explode pos: %2 ",_proj,_projPos];
                        };
                //
                } else {
                        [_this select 1] call CBA_fnc_removePerFrameHandler; //removes prox fuse PFH
                };
 
               
        // PFH FNC End
        }, 0, [_launcher,_proj]
] call CBA_fnc_addPerFrameHandler;

