]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix moving turrets failing target check due to non updated tur_shotorg (use origin...
authorJakob MG <jakob_mg@hotmail.com>
Tue, 22 Nov 2011 11:39:21 +0000 (12:39 +0100)
committerJakob MG <jakob_mg@hotmail.com>
Tue, 22 Nov 2011 11:39:21 +0000 (12:39 +0100)
qcsrc/server/tturrets/system/system_main.qc

index cc01f29d30c81153e1d59842407ea030755b875f..570310a25fcbb1a1773f7d584e15cdf443c678bb 100644 (file)
@@ -571,7 +571,7 @@ float turret_stdproc_firecheck()
 float turret_validate_target(entity e_turret, entity e_target, float validate_flags)
 {
     vector v_tmp;
-
+        
     //if(!validate_flags & TFL_TARGETSELECT_NOBUILTIN)
     //    return -0.5;
 
@@ -579,7 +579,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
         return -0.5;
 
     if not(checkpvs(e_target.origin, e_turret))
-        return -1;
+        return -1;        
 
     if not (e_target)
         return -2;
@@ -596,7 +596,12 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
         return -5;
 
     // Cant touch this
-    if (e_target.health < 0)
+    if(e_target.vehicle_flags & VHF_ISVEHICLE)    
+    {
+        if (e_target.vehicle_health <= 0)
+            return -6;
+    }
+    else if (e_target.health <= 0)
         return -6;
 
     // player
@@ -684,7 +689,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
     {
         v_tmp = real_origin(e_target) + ((e_target.mins + e_target.maxs) * 0.5);
 
-        traceline(e_turret.tur_shotorg, v_tmp, 0, e_turret);
+        traceline(e_turret.origin + '0 0 16', v_tmp, 0, e_turret);
 
         if (e_turret.aim_firetolerance_dist < vlen(v_tmp - trace_endpos))
             return -19;
@@ -733,7 +738,9 @@ entity turret_select_target()
     {
                if(e.takedamage)
                {
-                       if (turret_validate_target(self, e, self.target_select_flags) > 0)
+                   float f = turret_validate_target(self, e, self.target_select_flags);
+                   //dprint("F is: ", ftos(f), "\n");
+                       if ( f > 0)
                        {
                                score = self.turret_score_target(self,e);
                                if ((score > m_score) && (score > 0))