Skip to content

Commit

Permalink
Polyline Walker should return False if final destination not reached
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w4y committed Sep 3, 2016
1 parent 131faf0 commit 29fa762
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pokemongo_bot/walkers/polyline_walker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from random import uniform

from pokemongo_bot.cell_workers.utils import distance
from pokemongo_bot.walkers.step_walker import StepWalker
from polyline_generator import PolylineObjectHandler

Expand All @@ -19,3 +20,10 @@ def __init__(self, bot, dest_lat, dest_lng):
self.pol_alt = self.polyline.get_alt() or self.actual_alt
super(PolylineWalker, self).__init__(self.bot, self.pol_lat, self.pol_lon,
self.pol_alt, fixed_speed=self.speed)

def step(self):
step = super(PolylineWalker, self).step()
if not (distance(self.pol_lat, self.pol_lon, self.dest_lat, self.dest_lng) > 10 and step):
return False
else:
return True

0 comments on commit 29fa762

Please sign in to comment.