Bot AI: better implementation of keeping the current route while bot is jumping a gap
authorterencehill <piuntn@gmail.com>
Thu, 5 Mar 2020 18:19:59 +0000 (19:19 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 5 Mar 2020 18:19:59 +0000 (19:19 +0100)
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/navigation.qc

index 19aada811a7ef1e58486b03c4a234cf0f561bd43..b1ce8a29c539c451ba729138cf03275a9e57bcb6 100644 (file)
@@ -47,8 +47,12 @@ void havocbot_ai(entity this)
                }
                else
                {
-                       if (!this.jumppadcount && !STAT(FROZEN, this))
+                       if (!this.jumppadcount && !STAT(FROZEN, this)
+                               && !(this.goalcurrent_prev && (this.goalcurrent_prev.wpflags & WAYPOINTFLAG_JUMP)))
+                       {
+                               // find a new goal
                                this.havocbot_role(this); // little too far down the rabbit hole
+                       }
                }
 
                // if we don't have a goal and we're under water look for a waypoint near the "shore" and push it
@@ -943,8 +947,6 @@ void havocbot_movetogoal(entity this)
                                {
                                        PHYS_INPUT_BUTTON_JUMP(this) = true;
                                        this.bot_jump_time = time;
-                                       // avoid changing route while bot is jumping a gap
-                                       navigation_goalrating_timeout_extend_if_needed(this, 1.5);
                                }
                        }
                        else if (!this.goalstack01 || (this.goalcurrent.wpflags & (WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_LADDER)))
index 57cf690ada1ae354cd3ba6e066bd0c4a16ce097c..1f5377bb388b9d86f887931bcdc8f6ca19e67d24 100644 (file)
@@ -47,6 +47,7 @@ bool navigation_goalrating_timeout(entity this)
        return this.bot_strategytime < time;
 }
 
+ERASEABLE
 void navigation_goalrating_timeout_extend_if_needed(entity this, float seconds)
 {
        this.bot_strategytime = max(this.bot_strategytime, time + seconds);