X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fhavocbot%2Fhavocbot.qc;h=f69527916ce512ad8c3d94ac61e798883716f459;hb=03f978544a8b13a18cef1c7cc3dbcaba1c3aee4c;hp=5796fe60163346a5023ede6a39b4b560dc6bfa88;hpb=9e6de751aaa2a918708f80735a006a03e84f2fcf;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 5796fe601..f69527916 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -14,7 +14,7 @@ #include "../../../warpzonelib/common.qh" void havocbot_ai() -{ +{SELFPARAM(); if(self.draggedby) return; @@ -102,7 +102,8 @@ void havocbot_ai() if(self.weapons) { - WEP_ACTION(self.weapon, WR_AIM); + Weapon w = get_weaponinfo(self.weapon); + w.wr_aim(w); if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self)) { self.BUTTON_ATCK = false; @@ -179,7 +180,7 @@ void havocbot_ai() } void havocbot_keyboard_movement(vector destorg) -{ +{SELFPARAM(); vector keyboard; float blend, maxspeed; float sk; @@ -254,7 +255,7 @@ void havocbot_keyboard_movement(vector destorg) } void havocbot_bunnyhop(vector dir) -{ +{SELFPARAM(); float bunnyhopdistance; vector deviation; float maxspeed; @@ -397,7 +398,7 @@ void havocbot_bunnyhop(vector dir) } void havocbot_movetogoal() -{ +{SELFPARAM(); vector destorg; vector diff; vector dir; @@ -854,9 +855,9 @@ void havocbot_movetogoal() } void havocbot_chooseenemy() -{ +{SELFPARAM(); entity head, best, head2; - float rating, bestrating, i, hf; + float rating, bestrating, hf; vector eye, v; if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self)) { @@ -908,10 +909,29 @@ void havocbot_chooseenemy() self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE; - for(i = 0; ; ++i) + bool scan_transparent = false; + bool scan_secondary_targets = false; + bool have_secondary_targets = false; + while(true) { - while (head) + scan_secondary_targets = false; + :scan_targets + for( ; head; head = head.chain) { + if(!scan_secondary_targets) + { + if(head.classname == "misc_breakablemodel") + { + have_secondary_targets = true; + continue; + } + } + else + { + if(head.classname != "misc_breakablemodel") + continue; + } + v = (head.absmin + head.absmax) * 0.5; rating = vlen(v - eye); if (rating bot_distance_far ) { - for(i=0; i < WEP_COUNT && bot_weapons_far[i] != -1 ; ++i){ + for(i=0; i < Weapons_COUNT && bot_weapons_far[i] != -1 ; ++i){ w = bot_weapons_far[i]; if ( client_hasweapon(self, w, true, false) ) { @@ -1049,7 +1081,7 @@ void havocbot_chooseweapon() // Choose weapons for mid distance if ( distance > bot_distance_close) { - for(i=0; i < WEP_COUNT && bot_weapons_mid[i] != -1 ; ++i){ + for(i=0; i < Weapons_COUNT && bot_weapons_mid[i] != -1 ; ++i){ w = bot_weapons_mid[i]; if ( client_hasweapon(self, w, true, false) ) { @@ -1062,7 +1094,7 @@ void havocbot_chooseweapon() } // Choose weapons for close distance - for(i=0; i < WEP_COUNT && bot_weapons_close[i] != -1 ; ++i){ + for(i=0; i < Weapons_COUNT && bot_weapons_close[i] != -1 ; ++i){ w = bot_weapons_close[i]; if ( client_hasweapon(self, w, true, false) ) { @@ -1076,7 +1108,7 @@ void havocbot_chooseweapon() } void havocbot_aim() -{ +{SELFPARAM(); vector selfvel, enemyvel; // if(self.flags & FL_INWATER) // return; @@ -1098,7 +1130,7 @@ void havocbot_aim() } float havocbot_moveto_refresh_route() -{ +{SELFPARAM(); // Refresh path to goal if necessary entity wp; wp = self.havocbot_personal_waypoint; @@ -1109,7 +1141,7 @@ float havocbot_moveto_refresh_route() } float havocbot_moveto(vector pos) -{ +{SELFPARAM(); entity wp; if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) @@ -1231,7 +1263,7 @@ float havocbot_resetgoal() } void havocbot_setupbot() -{ +{SELFPARAM(); self.bot_ai = havocbot_ai; self.cmd_moveto = havocbot_moveto; self.cmd_resetgoal = havocbot_resetgoal; @@ -1240,7 +1272,7 @@ void havocbot_setupbot() } vector havocbot_dodge() -{ +{SELFPARAM(); // LordHavoc: disabled because this is too expensive return '0 0 0'; #if 0