]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: Don't switch to a weapon scheduled for reloading during combat. We spend...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 11 Feb 2011 23:01:56 +0000 (01:01 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 11 Feb 2011 23:01:56 +0000 (01:01 +0200)
qcsrc/server/bot/havocbot/havocbot.qc

index 7463cfc6f0e9362f5bcdea43dddfb84b832ad7fa..6fe6d2059155c5a06c8af773cee0ab0bf73a808e 100644 (file)
@@ -1004,7 +1004,9 @@ void havocbot_chooseweapon()
                if ( distance > bot_distance_far ) {
                        for(i=0; i < WEP_COUNT && bot_weapons_far[i] != -1 ; ++i){
                                w = bot_weapons_far[i];
-                               if ( client_hasweapon(self, w, TRUE, FALSE) ){
+                               if ( client_hasweapon(self, w, TRUE, FALSE) )
+                               if not (self.weapon_load[w] < 0) // this weapon is scheduled for reloading, don't switch to it during combat
+                               {
                                        if ( self.weapon == w && combo)
                                                continue;
                                        self.switchweapon = w;
@@ -1017,7 +1019,9 @@ void havocbot_chooseweapon()
                if ( distance > bot_distance_close) {
                        for(i=0; i < WEP_COUNT && bot_weapons_mid[i] != -1 ; ++i){
                                w = bot_weapons_mid[i];
-                               if ( client_hasweapon(self, w, TRUE, FALSE) ){
+                               if ( client_hasweapon(self, w, TRUE, FALSE) )
+                               if not (self.weapon_load[w] < 0) // this weapon is scheduled for reloading, don't switch to it during combat
+                               {
                                        if ( self.weapon == w && combo)
                                                continue;
                                        self.switchweapon = w;
@@ -1029,7 +1033,9 @@ void havocbot_chooseweapon()
                // Choose weapons for close distance
                for(i=0; i < WEP_COUNT && bot_weapons_close[i] != -1 ; ++i){
                        w = bot_weapons_close[i];
-                       if ( client_hasweapon(self, w, TRUE, FALSE) ){
+                       if ( client_hasweapon(self, w, TRUE, FALSE) )
+                       if not (self.weapon_load[w] < 0) // this weapon is scheduled for reloading, don't switch to it during combat
+                       {
                                if ( self.weapon == w && combo)
                                        continue;
                                self.switchweapon = w;