def init_seats(self):
raise NotImplementedError("Vehicles should specify a list of seats")
+ def assign_seats(self, seating):
+ for roach_name, seat in zip(seating, self.seats):
+ seat.roach = roach_name
+
_vehicle_types = {}
+ @classmethod
+ def current(cls, world):
+ vehicle = cls.by_type(world.vehicles.current)
+ vehicle.assign_seats(
+ world.vehicles[vehicle.vehicle_type].seating)
+ return vehicle
+
@classmethod
def by_type(cls, vehicle_type):
return cls._vehicle_types.get(vehicle_type)()