]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: fix sky detection under the bot
authorterencehill <piuntn@gmail.com>
Sun, 1 Mar 2020 15:52:02 +0000 (16:52 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 1 Mar 2020 15:55:08 +0000 (16:55 +0100)
qcsrc/server/bot/default/havocbot/havocbot.qc

index a31ee34ae3c48e081619f0cd27b4e7f31899388a..32a9f7ba9c95e1c54d83ef289274b82febb3e550 100644 (file)
@@ -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;
                                                }
                                        }
                                }