]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Similarly to the previous commit, make detection of obstacles that can be jumped...
authorterencehill <piuntn@gmail.com>
Mon, 6 Feb 2017 11:05:45 +0000 (12:05 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 6 Feb 2017 11:05:45 +0000 (12:05 +0100)
qcsrc/server/bot/default/havocbot/havocbot.qc

index d523b6ab89ed13f8f42077e5da6a745fd8e9cd80..13b8739d75af980a7ff162ea9a480fc443f9fb50 100644 (file)
@@ -733,17 +733,18 @@ void havocbot_movetogoal(entity this)
 
                        // jump if going toward an obstacle that doesn't look like stairs we
                        // can walk up directly
-                       tracebox(this.origin, this.mins, this.maxs, this.origin + this.velocity * 0.2, false, this);
+                       offset = (vdist(this.velocity, >, 32) ? this.velocity * 0.2 : v_forward * 32);
+                       tracebox(this.origin, this.mins, this.maxs, this.origin + offset, false, this);
                        if (trace_fraction < 1)
                        if (trace_plane_normal.z < 0.7)
                        {
                                s = trace_fraction;
-                               tracebox(this.origin + stepheightvec, this.mins, this.maxs, this.origin + this.velocity * 0.2 + stepheightvec, false, this);
+                               tracebox(this.origin + stepheightvec, this.mins, this.maxs, this.origin + offset + stepheightvec, false, this);
                                if (trace_fraction < s + 0.01)
                                if (trace_plane_normal.z < 0.7)
                                {
                                        s = trace_fraction;
-                                       tracebox(this.origin + jumpstepheightvec, this.mins, this.maxs, this.origin + this.velocity * 0.2 + jumpstepheightvec, false, this);
+                                       tracebox(this.origin + jumpstepheightvec, this.mins, this.maxs, this.origin + offset + jumpstepheightvec, false, this);
                                        if (trace_fraction > s)
                                                PHYS_INPUT_BUTTON_JUMP(this) = true;
                                }