Skip to content

Commit

Permalink
checks
Browse files Browse the repository at this point in the history
See issue #333
  • Loading branch information
lekeno committed Aug 10, 2020
1 parent cb4ad5b commit bb01183
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions edr/edrracingcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,26 @@ def reset(self):
def current_waypoint(self):
if self._is_finished():
return None
waypoint = self.waypoints[self._current_wp]
if "radius" not in waypoint:
waypoint["radius"] = self.radius
if "max_altitude" not in waypoint:
waypoint["max_altitude"] = self.max_altitude
return self.waypoints[self._current_wp]

# TODO decide if distance calculation should be done here instead of the client, would need planet's radius
def wp_cleared(self, distance, altitude):
wp = self.current_waypoint()
if not wp:
return False
return distance <= wp["radius"] and altitude <= wp["max_altitude"]

def disqualified(self, attitude):
wp = self.current_waypoint()
if not wp:
return altitude > self.max_altitude
return altitude > wp["max_altitude"]

def advance(self):
now = EDTime.py_epoch_now()
if not self.waypoints:
Expand Down

0 comments on commit bb01183

Please sign in to comment.