Turrets: Don't shoot someone who's in the belly. Wrong for many reasons, one being...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 26 Sep 2010 10:53:44 +0000 (13:53 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 26 Sep 2010 10:53:44 +0000 (13:53 +0300)
data/qcsrc/server/tturrets/system/system_main.qc

index 19821bc2d69d7492d119ee36bbbfbb4dcebd2bf3..e7dd022a8dec77c76a77eec4921a16f77b831421 100644 (file)
@@ -464,45 +464,48 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag
     if not (e_target)\r
         return -2;\r
 \r
+       if(e_target.predator.classname == "player") // don't shoot someone from the belly\r
+               return -3;\r
+\r
        if(g_onslaught)\r
                if (substring(e_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!\r
-                       return - 3;\r
+                       return - 4;\r
 \r
     if (validate_flags & TFL_TARGETSELECT_NO)\r
-        return -4;\r
+        return -5;\r
 \r
     // If only this was used more..\r
     if (e_target.flags & FL_NOTARGET)\r
-        return -5;\r
+        return -6;\r
 \r
     // Cant touch this\r
     if (e_target.health < 0)\r
-        return -6;\r
+        return -7;\r
 \r
     // player\r
     if (e_target.flags & FL_CLIENT)\r
     {\r
         if not (validate_flags & TFL_TARGETSELECT_PLAYERS)\r
-            return -7;\r
+            return -8;\r
 \r
         if (e_target.deadflag != DEAD_NO)\r
-            return -8;\r
+            return -9;\r
     }\r
 \r
        // enemy turrets\r
        if (validate_flags & TFL_TARGETSELECT_NOTURRETS)\r
         if (e_target.turret_firefunc || e_target.owner.tur_head == e_target)\r
             if(e_target.team != e_turret.team) // Dont break support units.\r
-                return -9;\r
+                return -10;\r
 \r
     // Missile\r
     if (e_target.flags & FL_PROJECTILE)\r
         if not (validate_flags & TFL_TARGETSELECT_MISSILES)\r
-            return -10;\r
+            return -11;\r
 \r
     if (validate_flags & TFL_TARGETSELECT_MISSILESONLY)\r
         if not (e_target.flags & FL_PROJECTILE)\r
-            return -10.5;\r
+            return -11.5;\r
 \r
     // Team check\r
     if (validate_flags & TFL_TARGETSELECT_TEAMCHECK)\r
@@ -510,18 +513,18 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag
         if (validate_flags & TFL_TARGETSELECT_OWNTEAM)\r
         {\r
             if (e_target.team != e_turret.team)\r
-                return -11;\r
+                return -12;\r
 \r
             if (e_turret.team != e_target.owner.team)\r
-                return -12;\r
+                return -13;\r
         }\r
         else\r
         {\r
             if (e_target.team == e_turret.team)\r
-                return -13;\r
+                return -14;\r
 \r
             if (e_turret.team == e_target.owner.team)\r
-                return -14;\r
+                return -15;\r
         }\r
     }\r
 \r
@@ -530,10 +533,10 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag
     if (validate_flags & TFL_TARGETSELECT_RANGELIMTS)\r
     {\r
         if (tvt_dist < e_turret.target_range_min)\r
-            return -15;\r
+            return -16;\r
 \r
         if (tvt_dist > e_turret.target_range)\r
-            return -16;\r
+            return -17;\r
     }\r
 \r
     // Can we even aim this thing?\r
@@ -557,10 +560,10 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag
     if (validate_flags & TFL_TARGETSELECT_ANGLELIMITS)\r
     {\r
         if (fabs(tvt_tadv_x) > e_turret.aim_maxpitch)\r
-            return -17;\r
+            return -18;\r
 \r
         if (fabs(tvt_tadv_y) > e_turret.aim_maxrot)\r
-            return -18;\r
+            return -19;\r
     }\r
 \r
     // Line of sight?\r
@@ -570,20 +573,20 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag
         traceline(e_turret.tur_shotorg,v_tmp,0,e_turret);\r
 \r
         if (e_turret.aim_firetolerance_dist < vlen(v_tmp - trace_endpos))\r
-            return -19;\r
+            return -20;\r
     }\r
 \r
     if (e_target.classname == "grabber")\r
-        return -20;\r
+        return -21;\r
 \r
     /*\r
     if (e_target.classname == "func_button")\r
-        return -21;\r
+        return -22;\r
     */\r
 \r
        // Don't attack in RPG if this is not allowed\r
        if(cvar("g_rpg") && !cvar("g_rpg_turretattack"))\r
-               return -22;\r
+               return -23;\r
 \r
 #ifdef TURRET_DEBUG_TARGETSELECT\r
     dprint("Target:",e_target.netname," is a valid target for ",e_turret.netname,"\n");\r