From 647689c44b363d03ef50a7467d14c6d4e4c2cadc Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 30 Jan 2017 17:53:35 +0100 Subject: [PATCH] Fix speed checks. The broken loose goal touching check when running was occasionally causing bots carrying the enemy flag to get stuck right in front of their own base --- qcsrc/server/bot/default/havocbot/havocbot.qc | 2 +- qcsrc/server/bot/default/navigation.qc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index e2ff5e799..a35d312db 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -316,7 +316,7 @@ void havocbot_bunnyhop(entity this, vector dir) // Run only to visible goals if(IS_ONGROUND(this)) - if(this.speed==maxspeed) + if(vlen(this.velocity - eZ * this.velocity.z) >= autocvar_sv_maxspeed) // if -really- running if(checkpvs(this.origin + this.view_ofs, this.goalcurrent)) { this.bot_lastseengoal = this.goalcurrent; diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index fd8a521d1..742213a89 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -960,9 +960,9 @@ void navigation_poptouchedgoals(entity this) // Loose goal touching check when running if(this.aistatus & AI_STATUS_RUNNING) - if(this.speed >= autocvar_sv_maxspeed) // if -really- running if(this.goalcurrent.classname=="waypoint") if(!(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)) + if(vlen(this.velocity - eZ * this.velocity.z) >= autocvar_sv_maxspeed) // if -really- running { if(vdist(this.origin - this.goalcurrent.origin, <, 150)) { -- 2.39.2