Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

follow_path and polyline minor bugfix #4452

Merged
merged 1 commit into from
Aug 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pokemongo_bot/cell_workers/follow_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/walkers/polyline_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down