from nullptr.missions.base import BaseMission, MissionParam from nullptr.models.waypoint import Waypoint class ProbeMission(BaseMission): def start_state(self): return 'next-hop' @classmethod def params(cls): return { 'hops': MissionParam(list, True), 'next-hop': MissionParam(int, True, 0) } def steps(self): return { 'next-hop': (self.step_next_hop, 'travel-to'), **self.travel_steps('to', 'site', 'market'), 'market': (self.step_market, 'next-hop'), } def step_next_hop(self): hops = self.st('hops') next_hop = self.st('next-hop') hop = hops[next_hop] self.sts('site', hop) self.sts('next-hop', (next_hop+1) % len(hops))