diff --git a/pokemongo_bot/cell_workers/follow_path.py b/pokemongo_bot/cell_workers/follow_path.py index afb6d099ce..eda835c5a7 100644 --- a/pokemongo_bot/cell_workers/follow_path.py +++ b/pokemongo_bot/cell_workers/follow_path.py @@ -92,10 +92,8 @@ def find_closest_point_idx(self, points): point = points[index] botlat = self.bot.api._position_lat botlng = self.bot.api._position_lng - botalt = self.bot.api._position_alt lat = float(point['lat']) lng = float(point['lng']) - alt = float(point['alt']) dist = distance( botlat, @@ -135,7 +133,9 @@ def work(self): point = self.points[self.ptr] lat = float(point['lat']) lng = float(point['lng']) - alt = float(point['alt']) + alt = uniform(self.bot.config.alt_min, self.bot.config.alt_max) + if 'alt' in point: + alt = float(point['alt']) if self.bot.config.walk_max > 0: step_walker = StepWalker( @@ -149,7 +149,6 @@ def work(self): is_at_destination = True else: - alt = uniform(self.bot.config.alt_min, self.bot.config.alt_max) self.bot.api.set_position(lat, lng, alt) dist = distance( diff --git a/pokemongo_bot/walkers/polyline_generator.py b/pokemongo_bot/walkers/polyline_generator.py index 569afd978e..26327caa64 100644 --- a/pokemongo_bot/walkers/polyline_generator.py +++ b/pokemongo_bot/walkers/polyline_generator.py @@ -25,7 +25,7 @@ def cached_polyline(origin, destination, speed): is_old_cache = lambda : tuple(origin) != PolylineObjectHandler._cache.get_last_pos() new_dest_set = lambda : tuple(destination) != PolylineObjectHandler._cache.destination - if PolylineObjectHandler._run: + if PolylineObjectHandler._run and (not is_old_cache()): # bot used to have struggle with making a decision. PolylineObjectHandler._instability -= 1 if PolylineObjectHandler._instability <= 0: