From: terencehill Date: Thu, 15 Dec 2016 00:11:37 +0000 (+0100) Subject: Part 2 of edc2958143 "Make sure bots don't move to removed goals such as a key when... X-Git-Tag: xonotic-v0.8.2~374 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=438b49281b05c06083646754c0c25e02383d6fce;p=xonotic%2Fxonotic-data.pk3dir.git Part 2 of edc2958143 "Make sure bots don't move to removed goals such as a key when a Key Hunt round ends. It fixes #1101" --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index e599bb8bd..b23c15bca 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -29,9 +29,12 @@ void havocbot_ai(entity this) if(bot_execute_commands(this)) return; - if(this.goalcurrent) - if(wasfreed(this.goalcurrent)) + while(this.goalcurrent && wasfreed(this.goalcurrent)) + { navigation_poproute(this); + if(!this.goalcurrent) + this.bot_strategytime = 0; + } if (bot_strategytoken == this) if (!bot_strategytoken_taken) @@ -134,7 +137,7 @@ void havocbot_ai(entity this) //heading = this.velocity; //dprint(this.goalstack01.classname,etos(this.goalstack01),"\n"); if( - this.goalstack01 != this && this.goalstack01 != NULL && ((this.aistatus & AI_STATUS_RUNNING) == 0) && + this.goalstack01 != this && this.goalstack01 && !wasfreed(this.goalstack01) && ((this.aistatus & AI_STATUS_RUNNING) == 0) && !(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT) ) next = ((this.goalstack01.absmin + this.goalstack01.absmax) * 0.5) - (this.origin + this.view_ofs); @@ -325,7 +328,7 @@ void havocbot_bunnyhop(entity this, vector dir) if(this.goalcurrent.classname=="waypoint") if (!(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL)) if(fabs(gco.z - this.origin.z) < this.maxs.z - this.mins.z) - if(this.goalstack01!=NULL) + if(this.goalstack01 && !wasfreed(this.goalstack01)) { gno = (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5; deviation = vectoangles(gno - this.origin) - vectoangles(gco - this.origin); diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 5092a65c6..19c0ed8e6 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -893,7 +893,7 @@ void navigation_poptouchedgoals(entity this) } // If for some reason the bot is closer to the next goal, pop the current one - if(this.goalstack01) + if(this.goalstack01 && !wasfreed(this.goalstack01)) if(vlen2(this.goalcurrent.origin - this.origin) > vlen2(this.goalstack01.origin - this.origin)) if(checkpvs(this.origin + this.view_ofs, this.goalstack01)) if(tracewalk(this, this.origin, this.mins, this.maxs, (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5, bot_navigation_movemode))