+ def roach_management_overlay(self):
+ return images.load(safepath("vehicles/walking/background"))
+
+ def roach_management_frame(self):
+ if self.overlay_frame_no is None:
+ return None
+ return images.load(safepath("vehicle_big/%s_%d") % (
+ self.vehicle_type, self.overlay_frame_no))
+
+ def init_seats(self):
+ raise NotImplementedError("Vehicles should specify a list of seats")
+
+ def seating(self, world):
+ roach_seating = world.vehicles[self.vehicle_type].seating
+ roach_seating_numbers = enumerate(zip(roach_seating, self.seats))
+ return {
+ roach: seat_pos
+ for seat_pos, (roach, _) in roach_seating_numbers if roach
+ }
+
+ def seat_roach(self, world, roach, seat_pos):
+ vehicle = world.vehicles[self.vehicle_type]
+ seats = len(self.seats)
+ seating = list(vehicle.seating)
+ seating = list(islice(
+ chain(seating, repeat(None, seats)), 0, seats))
+ seating[seat_pos] = roach
+ # line below records new seating on the world proxy
+ vehicle.seating = seating
+
+ def roach_at(self, world, seat_pos):
+ roach_seating = world.vehicles[self.vehicle_type].seating
+ if seat_pos >= len(roach_seating):
+ return None
+ return roach_seating[seat_pos]
+
+ def changed(self):
+ return False # TODO: remove this
+
+ _vehicle_types = {}
+
+ @classmethod
+ def current(cls, world):
+ return cls.by_type(world.vehicles.current)