X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=koperkapel%2Fvehicles%2Fbase.py;h=1b2f3ed279ff471ff9d151d9c5a4ca93e7e3ba24;hb=2c4c2428ac247ea8fdac2aaf6b2373fbf0275e3c;hp=fb4640dd73be2a47e217bd0c1f66ac27565188ec;hpb=f21ab7ca426048a66640c8651bb6b015485a9770;p=koperkapel.git diff --git a/koperkapel/vehicles/base.py b/koperkapel/vehicles/base.py index fb4640d..1b2f3ed 100644 --- a/koperkapel/vehicles/base.py +++ b/koperkapel/vehicles/base.py @@ -18,8 +18,19 @@ class Vehicle: 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)()