From: terencehill Date: Sun, 1 Mar 2020 15:52:02 +0000 (+0100) Subject: Bot AI: fix sky detection under the bot X-Git-Tag: xonotic-v0.8.5~1150 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=43f450c080e544ed1782c46e592125862745215a;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix sky detection under the bot --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index a31ee34ae..32a9f7ba9 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; } } }