From 2c4c2428ac247ea8fdac2aaf6b2373fbf0275e3c Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sat, 5 Mar 2016 13:07:36 +0200 Subject: [PATCH] Slightly more advanced roach seating. --- koperkapel/vehicles/base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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)() -- 2.34.1