From 063eb523ae021422408569ac3540f8ea8c09c5c0 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 22 May 2018 00:40:50 +0200 Subject: [PATCH] Bot AI: add ability to slow down if bot is in the air and goal is under it; it gives bots a bit of air control when running to very low goals and allows them to pass through smaller holes, for example the ones near the flags in the map Spacebase --- qcsrc/server/bot/default/havocbot/havocbot.qc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 5fb9e728a..b5888c0b9 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -1069,6 +1069,18 @@ void havocbot_movetogoal(entity this) if(IS_PLAYER(this.goalcurrent)) unreachable = true; } + + // slow down if bot is in the air and goal is under it + if (!this.goalcurrent.wphardwired + && vdist(flat_diff, <, 250) && this.origin.z - destorg.z > 120 + && (!IS_ONGROUND(this) || vdist(vec2(this.velocity), >, maxspeed * 0.3))) + { + // tracebox wouldn't work when bot is still on the ledge + traceline(this.origin, this.origin - '0 0 200', true, this); + if (this.origin.z - trace_endpos.z > 120) + evadeobstacle = normalize(this.velocity) * -1; + } + if(unreachable) { navigation_clearroute(this); -- 2.39.2