From ff28f51fe8b708fbce4554fa240eb100b377229a Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 25 Dec 2016 10:41:36 +0100 Subject: [PATCH] Bot logic: improve jumppad touch detection (e.g. on Xoylent occasionally bots skipped the jumppad and tried to leap into the void) --- qcsrc/server/bot/default/navigation.qc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 70391d56b..0e4243de6 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -878,6 +878,8 @@ void navigation_poptouchedgoals(entity this) if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT) { + // make sure jumppad is really hit, don't rely on distance based checks + // as they may report a touch even if it didn't really happen if(this.lastteleporttime>0) if(time - this.lastteleporttime < ((this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL) ? 2 : 0.15)) { @@ -913,14 +915,11 @@ void navigation_poptouchedgoals(entity this) if(IS_PLAYER(this.goalcurrent)) navigation_poproute(this); - // aid for detecting jump pads better (distance based check fails sometimes) - if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT && this.jumppadcount > 0 ) - navigation_poproute(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(vdist(this.origin - this.goalcurrent.origin, <, 150)) { @@ -942,6 +941,9 @@ void navigation_poptouchedgoals(entity this) while (this.goalcurrent && boxesoverlap(m1, m2, this.goalcurrent.absmin, this.goalcurrent.absmax)) { + if((this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)) + break; + // Detect personal waypoints if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this) -- 2.39.2