fix climbing randomly

This commit is contained in:
INeedBots 2020-09-23 00:20:29 -06:00
parent 5607155f8e
commit 91eeac0fdd

View File

@ -635,7 +635,8 @@ moveHack()
self.bot.climbing = (abs(moveTo[2] - self.origin[2]) > 50 && verticleDegree < 0.64); self.bot.climbing = (abs(moveTo[2] - self.origin[2]) > 50 && verticleDegree < 0.64);
} }
if (inLastStand || usingRemote || self.bot.jumpingafter) // only climb if we are not inlaststand, not using a remote, not jumping, and on a waypoint path
if (inLastStand || usingRemote || self.bot.jumpingafter || self.bot.next_wp == -1)
self.bot.climbing = false; self.bot.climbing = false;
if (usingRemote) if (usingRemote)
@ -2294,11 +2295,13 @@ doWalk(goal, dist, isScriptGoal)
self thread watchOnGoal(goal, distsq); self thread watchOnGoal(goal, distsq);
current = self initAStar(goal); current = self initAStar(goal);
// if a waypoint is closer than the goal
//if (current >= 0 && DistanceSquared(self.origin, level.waypoints[self.bot.astar[current]].origin) < DistanceSquared(self.origin, goal)) //if (current >= 0 && DistanceSquared(self.origin, level.waypoints[self.bot.astar[current]].origin) < DistanceSquared(self.origin, goal))
//{ //{
while(current >= 0) while(current >= 0)
{ {
for (;;) // skip down the line of waypoints and go to the waypoint we have a direct path too
/*for (;;)
{ {
if (current <= 0) if (current <= 0)
break; break;
@ -2311,7 +2314,7 @@ doWalk(goal, dist, isScriptGoal)
break; break;
current = self removeAStar(); current = self removeAStar();
} }*/
self.bot.next_wp = self.bot.astar[current]; self.bot.next_wp = self.bot.astar[current];
self.bot.second_next_wp = -1; self.bot.second_next_wp = -1;