From: terencehill Date: Tue, 1 Aug 2017 15:04:45 +0000 (+0200) Subject: Bot aim: avoid a glitch at the moment bot is teleported but teleport waypoint isn... X-Git-Tag: xonotic-v0.8.5~2378^2~96 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=411100ad2ccf22a0c672ed094b073c22f287970f;p=xonotic%2Fxonotic-data.pk3dir.git Bot aim: avoid a glitch at the moment bot is teleported but teleport waypoint isn't removed yet --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index f5b126ff1..dde996d19 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -139,10 +139,17 @@ void havocbot_ai(entity this) vector v, now, next; float aimdistance,skillblend,distanceblend,blend; - if(this.goalcurrent.wpisbox && boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin, this.origin)) - v = this.goalcurrent.origin; - else - SET_DESTCOORDS(this.goalcurrent, this.origin, v); + SET_DESTCOORDS(this.goalcurrent, this.origin, v); + if(this.goalcurrent.wpisbox) + { + // avoid a glitch when bot is teleported but teleport waypoint isn't removed yet + if(this.goalstack02 && this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT + && this.lastteleporttime > 0 && time - this.lastteleporttime < 0.15) + v = (this.goalstack02.absmin + this.goalstack02.absmax) * 0.5; + // aim to teleport origin if bot is inside teleport waypoint but hasn't touched the real teleport yet + else if(boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin, this.origin)) + v = this.goalcurrent.origin; + } next = now = v - (this.origin + this.view_ofs); aimdistance = vlen(now);