]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: fix ambiguous jumppad touch detection
authorterencehill <piuntn@gmail.com>
Tue, 2 Jan 2018 19:23:20 +0000 (20:23 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 2 Jan 2018 19:23:20 +0000 (20:23 +0100)
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/server/bot/api.qh
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/navigation.qh

index dc9cb761ab2cf18b7f0d02f9f9a2b24c49e1c693..11ea2f360aba51619735f23d109e857d9a554510 100644 (file)
@@ -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);
index 27651bf8135c7d7eca91b7b948bc42586c9c9fc3..86442178c1e0068b4b24886fa7a79f2caefeed58 100644 (file)
@@ -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;
index 86f2feebdf718b4c36e4fcb0d578ebb8279fe4f9..8d592269341022695a551e8195eea9d19d88646e 100644 (file)
@@ -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)
                        {
index ea913456d33eac5db852b53c339a80d95b89350f..ccf2cecee9a0a14d152810a22585f862257d928c 100644 (file)
@@ -101,6 +101,7 @@ entity navigation_bestgoal;
 .entity wp_goal_prev1;
 
 .float lastteleporttime;
+.vector lastteleport_origin;
 
 .float blacklisted;