]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix monsters not attacking target entities
authorMario <mario.mario@y7mail.com>
Thu, 7 Feb 2013 05:17:13 +0000 (16:17 +1100)
committerMario <mario.mario@y7mail.com>
Thu, 7 Feb 2013 05:17:13 +0000 (16:17 +1100)
qcsrc/server/mutators/gamemode_rts.qc

index 1774bba9212c697fb9639d8af03730bdea46c0cc..003534f8e518c1427e21a7dfce3caf82a8d98513 100644 (file)
@@ -101,12 +101,15 @@ MUTATOR_HOOKFUNCTION(rts_PlayerThink)
        }
        if(self.BUTTON_ATCK2)
        {
-               entity e;
+               entity e = world;
                if(self.cursor_trace_ent) e = self.cursor_trace_ent;
                else e = findradius(self.cursor_trace_endpos, 50);
                
-               if(!IsDifferentTeam(e, self) || !e.takedamage)
-                       e = world;
+               if not(IsDifferentTeam(e, self))
+                       e = world; // same team
+               
+               if not(e.takedamage)
+                       e = world; // can't hurt this enemy
                
                if(e == world)
                {
@@ -121,7 +124,11 @@ MUTATOR_HOOKFUNCTION(rts_PlayerThink)
                        if not(head.selected) continue;
                        
                        if(e)
+                       {
+                               remove(head.goalentity);
+                               head.goalentity = world;
                                head.enemy = e;
+                       }
                        else if(wp)
                        {
                                head.goalentity = wp;