From: Mircea Kitsune Date: Fri, 11 Feb 2011 23:01:56 +0000 (+0200) Subject: Bot AI: Don't switch to a weapon scheduled for reloading during combat. We spend... X-Git-Tag: xonotic-v0.5.0~309^2~7^2~28 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6a32b420a61159fd339750d1cc7a4a6e3fd1bad9;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: Don't switch to a weapon scheduled for reloading during combat. We spend time reloading it instead of fighting --- diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 7463cfc6f..6fe6d2059 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -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;