8061f2c31c94e83689d286907252f2d61cbaaaca
[koperkapel.git] / koperkapel / vehicles / walking.py
1 """ A vehicle to represent roaches on foot. """
2
3 from .base import Vehicle, circle_of_seats
4 from ..roaches import (
5     default_roaches, roaches_quartet, roaches_nonet, WorldRoach)
6 from ..weapons import default_weapons
7
8
9 class Walking(Vehicle):
10
11     vehicle_type = "walking"
12     weapons_taped_on = False
13
14     def init_seats(self):
15         return circle_of_seats(6, vehicle=self)
16
17     def get_avatar(self, world):
18         weapon = default_weapons.assemble(
19             world.weapons.current, tape=self.weapons_taped_on)
20         num_roaches = len(world.roaches)
21         roach = WorldRoach()
22         if num_roaches == 1:
23             # Return a single large roach
24             avatar = default_roaches.assemble(roach, weapon)
25             avatar.anchor = (0, 0)
26         elif num_roaches < 6:
27             avatar = roaches_quartet.assemble(roach, weapon)
28             avatar.anchor = (0, 0)
29         else:
30             avatar = roaches_nonet.assemble(roach, weapon)
31             avatar.anchor = (0, 0)
32         return avatar