From 43f450c080e544ed1782c46e592125862745215a Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 1 Mar 2020 16:52:02 +0100 Subject: [PATCH] Bot AI: fix sky detection under the bot --- qcsrc/server/bot/default/havocbot/havocbot.qc | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index a31ee34ae3..32a9f7ba9c 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -1078,26 +1078,31 @@ void havocbot_movetogoal(entity this) //te_lightning2(NULL, dst_ahead, trace_endpos); // Draw "downwards" look if(trace_endpos.z < this.origin.z + this.mins.z) { - s = pointcontents(trace_endpos + '0 0 1'); - if (s != CONTENT_SOLID) - if (s == CONTENT_LAVA || s == CONTENT_SLIME) + if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY) danger_detected = true; - else if (s == CONTENT_SKY) - danger_detected = true; - else if (tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos)) + else { - // the traceline check isn't enough but is good as optimization, - // when not true (most of the time) this tracebox call is avoided - tracebox(dst_ahead, this.mins, this.maxs, dst_down, true, this); - if (tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos)) + s = pointcontents(trace_endpos + '0 0 1'); + if (s != CONTENT_SOLID) { - if (destorg.z > this.origin.z + jumpstepheightvec.z) + if (s == CONTENT_LAVA || s == CONTENT_SLIME) + danger_detected = true; + else if (tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos)) { - // the goal is probably on an upper platform, assume bot can't get there - unreachable = true; + // the traceline check isn't enough but is good as optimization, + // when not true (most of the time) this tracebox call is avoided + tracebox(dst_ahead, this.mins, this.maxs, dst_down, true, this); + if (tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos)) + { + if (destorg.z > this.origin.z + jumpstepheightvec.z) + { + // the goal is probably on an upper platform, assume bot can't get there + unreachable = true; + } + else + danger_detected = true; + } } - else - danger_detected = true; } } } -- 2.39.2