From: terencehill Date: Tue, 2 Jan 2018 19:23:20 +0000 (+0100) Subject: Bot AI: fix ambiguous jumppad touch detection X-Git-Tag: xonotic-v0.8.5~2378^2~3^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=14ed5595ec730cc91afdef42f91712781162ba7e;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix ambiguous jumppad touch detection --- diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index dc9cb761a..11ea2f360 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -207,7 +207,10 @@ bool jumppad_push(entity this, entity targ) centerprint(targ, this.message); } else + { targ.lastteleporttime = time; + targ.lastteleport_origin = targ.origin; + } if (!IS_DEAD(targ)) animdecide_setaction(targ, ANIMACTION_JUMP, true); diff --git a/qcsrc/server/bot/api.qh b/qcsrc/server/bot/api.qh index 27651bf81..86442178c 100644 --- a/qcsrc/server/bot/api.qh +++ b/qcsrc/server/bot/api.qh @@ -35,6 +35,7 @@ float skill; .float havocbot_role_timeout; .float isbot; // true if this client is actually a bot .float lastteleporttime; +.vector lastteleport_origin; .float navigation_hasgoals; .float nearestwaypointtimeout; .entity nearestwaypoint; diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 86f2feebd..8d5922693 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1340,6 +1340,12 @@ void navigation_poptouchedgoals(entity this) if(this.lastteleporttime > 0 && time - this.lastteleporttime < ((this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL) ? 2 : 0.15)) { + if (this.jumppadcount && !boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, + this.lastteleport_origin + STAT(PL_MIN, this), this.lastteleport_origin + STAT(PL_MAX, this))) + { + return; + } + if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this) { diff --git a/qcsrc/server/bot/default/navigation.qh b/qcsrc/server/bot/default/navigation.qh index ea913456d..ccf2cecee 100644 --- a/qcsrc/server/bot/default/navigation.qh +++ b/qcsrc/server/bot/default/navigation.qh @@ -101,6 +101,7 @@ entity navigation_bestgoal; .entity wp_goal_prev1; .float lastteleporttime; +.vector lastteleport_origin; .float blacklisted;