]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix head-banging against walls detection
authorterencehill <piuntn@gmail.com>
Sun, 5 Feb 2017 18:08:40 +0000 (19:08 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 5 Feb 2017 18:08:40 +0000 (19:08 +0100)
qcsrc/server/bot/default/havocbot/havocbot.qc

index a35d312db1b209b23428b9b04c5ee0dcaa8933a1..d523b6ab89ed13f8f42077e5da6a745fd8e9cd80 100644 (file)
@@ -706,6 +706,7 @@ void havocbot_movetogoal(entity this)
                evadeobstacle = '0 0 0';
                evadelava = '0 0 0';
 
+               makevectors(this.v_angle.y * '0 1 0');
                if (this.waterlevel)
                {
                        if(this.waterlevel>WATERLEVEL_SWIMMING)
@@ -722,11 +723,11 @@ void havocbot_movetogoal(entity this)
                                        PHYS_INPUT_BUTTON_JUMP(this) = false;
                        }
                        dir = normalize(flatdir);
-                       makevectors(this.v_angle.y * '0 1 0');
                }
                else
                {
                        float s;
+                       vector offset;
                        if(this.aistatus & AI_STATUS_OUT_WATER)
                                this.aistatus &= ~AI_STATUS_OUT_WATER;
 
@@ -749,7 +750,8 @@ void havocbot_movetogoal(entity this)
                        }
 
                        // avoiding dangers and obstacles
-                       vector dst_ahead = this.origin + this.view_ofs + this.velocity * 0.5;
+                       offset = (vdist(this.velocity, >, 32) ? this.velocity * 0.5 : v_forward * 32);
+                       vector dst_ahead = this.origin + this.view_ofs + offset;
                        vector dst_down = dst_ahead - '0 0 3000';
 
                        // Look ahead