+ vector vf, ad;
+ if(autocvar_g_vehicle_raptor_cannon_locktarget)
+ {
+ if(trace_ent)
+ {
+ if(raptor.gun2.enemy != world)
+ {
+ if(raptor.gun2.enemy == trace_ent)
+ raptor.gun2.cnt += 1;
+ else
+ raptor.gun2.cnt -= 1;
+ }
+
+ raptor.gun2.enemy = trace_ent;
+
+ if(raptor.gun2.cnt < 0)
+ {
+ raptor.gun2.enemy = world;
+ raptor.gun2.cnt = 0;
+ }
+
+ if(raptor.gun2.cnt > 50)
+ {
+ raptor.gun2.enemy = world;
+ raptor.gun2.cnt = 0;
+
+ raptor.gun1.enemy = trace_ent;
+ raptor.gun1.cnt = time + 1;
+ }
+
+ // Allready have a lock?
+ if(raptor.gun1.enemy != world)
+ {
+ // Add 0.5 secs of tracking for each trace hit
+ if(trace_ent == raptor.gun1.enemy)
+ raptor.gun1.cnt = min(raptor.gun1.cnt + 0.25, time + 5);
+
+ if(raptor.gun1.cnt < time)
+ raptor.gun1.enemy = world;
+ }
+ }
+ else
+ raptor.gun2.cnt = max(raptor.gun2.cnt - 1, 0);
+
+ if(raptor.gun1.cnt - time < 0)
+ raptor.gun1.enemy = world;
+
+ if(autocvar_g_vehicle_raptor_cannon_predicttarget)
+ {
+ vector o;
+ if(raptor.gun1.enemy != world)
+ {
+ float i, distance, impact_time;
+
+ vf = real_origin(raptor.gun1.enemy);
+ ad = vf;
+ o = raptor.origin;
+ for(i = 0; i < 4; ++i)
+ {
+
+ distance = vlen(ad - o);
+ impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
+ ad = vf + raptor.gun1.enemy.velocity * impact_time;
+ o = raptor.origin + raptor.velocity * impact_time;
+ }
+ trace_endpos = ad;
+
+ }
+ }
+ else
+ trace_endpos = real_origin(raptor.gun1.enemy);
+ }
+