From: terencehill Date: Thu, 29 Dec 2016 18:27:58 +0000 (+0100) Subject: Optimize trigger_hurt check X-Git-Tag: xonotic-v0.8.2~343^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=04cfc7fa9b164d1b774daa78fc68ec5e06c38bcc;p=xonotic%2Fxonotic-data.pk3dir.git Optimize trigger_hurt check --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index d211397d3..8e6b3912b 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -766,8 +766,10 @@ void havocbot_movetogoal(entity this) evadelava = normalize(this.velocity) * -1; else if (s == CONTENT_SKY) evadeobstacle = normalize(this.velocity) * -1; - else + else if (tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos)) { + // 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)) {