]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix monsters not able to target turrets
authorMario <mario.mario@y7mail.com>
Fri, 8 Feb 2013 00:37:55 +0000 (11:37 +1100)
committerMario <mario.mario@y7mail.com>
Fri, 8 Feb 2013 00:37:55 +0000 (11:37 +1100)
qcsrc/server/mutators/gamemode_rts.qc

index edef364c3a3a58618b64e824427766bb3cc40161..3ecab89c34a30f6f66ec59d7226f5118a17fe7c7 100644 (file)
@@ -130,6 +130,19 @@ MUTATOR_HOOKFUNCTION(rts_PlayerThink)
        {
                entity e = self.cursor_trace_ent;
                
+               if not(e)
+               {
+                       entity t;
+                       for(t = world; (t = findflags(t, turrcaps_flags, TFL_TURRCAPS_ISTURRET)); )
+                       {
+                               if(vlen(self.cursor_trace_endpos - t.origin) < 80)
+                               {
+                                       e = t;
+                                       break; // don't bother checking any other turrets
+                               }
+                       }
+               }
+               
                if(e)
                if not(IsDifferentTeam(e, self) || e.takedamage)
                        e = world;