]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Optimize trigger_hurt check
authorterencehill <piuntn@gmail.com>
Thu, 29 Dec 2016 18:27:58 +0000 (19:27 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 29 Dec 2016 18:27:58 +0000 (19:27 +0100)
qcsrc/server/bot/default/havocbot/havocbot.qc

index d211397d3bb057d108e97852fe212ce6d9d7f6d3..8e6b3912b3da70f7ecb757bb41a3ce997c24824d 100644 (file)
@@ -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))
                                                {