From 1b65d56610fe4219e9c528bb7128c83b3a98960d Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 9 Jul 2018 18:29:23 +0200 Subject: [PATCH] Bot AI: improve bot ability to climb ladders up (e.g. ladders in the water on Reservoir_r6) --- qcsrc/server/bot/default/aim.qc | 1 + qcsrc/server/bot/default/havocbot/havocbot.qc | 9 +++++++-- qcsrc/server/bot/default/navigation.qc | 12 ++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/qcsrc/server/bot/default/aim.qc b/qcsrc/server/bot/default/aim.qc index 53932ff6a..768aa6dae 100644 --- a/qcsrc/server/bot/default/aim.qc +++ b/qcsrc/server/bot/default/aim.qc @@ -242,6 +242,7 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation) + this.bot_4th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_4th + this.bot_5th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_5th ); + desiredang.x = bound(-90, desiredang.x, 90); // calculate turn angles diffang = desiredang - this.bot_mouseaim; diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index b66d423d9..a2c6e2686 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -1151,8 +1151,13 @@ void havocbot_movetogoal(entity this) } if (ladder_zdir) { - dir.z = ladder_zdir * 1.3; - dir = normalize(dir); + if (vdist(flatdir, <, 15)) + dir = ladder_zdir * '0 0 1'; + else + { + dir.z = ladder_zdir * 1.3; + dir = normalize(dir); + } } } diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 88d189bee..20095fd49 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1701,8 +1701,16 @@ int navigation_poptouchedgoals(entity this) gc_min = this.goalcurrent.origin - '1 1 1' * 12; gc_max = this.goalcurrent.origin + '1 1 1' * 12; } - if(!boxesoverlap(this.absmin, this.absmax, gc_min, gc_max)) - break; + if (time < this.ladder_time) + { + if (!boxesoverlap(this.absmin, this.absmax - eZ * STAT(PL_MAX, this).z, gc_min, gc_max)) + break; + } + else + { + if (!boxesoverlap(this.absmin, this.absmax, gc_min, gc_max)) + break; + } // Detect personal waypoints if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) -- 2.39.2