From: terencehill Date: Mon, 21 May 2018 22:40:50 +0000 (+0200) Subject: Bot AI: add ability to slow down if bot is in the air and goal is under it; it gives... X-Git-Tag: xonotic-v0.8.5~1923^2~52 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=063eb523ae021422408569ac3540f8ea8c09c5c0;p=xonotic%2Fxonotic-data.pk3dir.git 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 --- 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);