From 6a32b420a61159fd339750d1cc7a4a6e3fd1bad9 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Sat, 12 Feb 2011 01:01:56 +0200 Subject: [PATCH] Bot AI: Don't switch to a weapon scheduled for reloading during combat. We spend time reloading it instead of fighting --- qcsrc/server/bot/havocbot/havocbot.qc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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; -- 2.39.2