Merge branch 'master' of ctpug.org.za:koperkapel
authorSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 13:29:39 +0000 (15:29 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 13:29:39 +0000 (15:29 +0200)
1  2 
koperkapel/roaches.py
koperkapel/vehicles/base.py

diff --combined koperkapel/roaches.py
index 6dedf305fd3b50b96e3da5c2e748b9f32551964e,b39d189fe669c6571047973feb33f8b7b6e4eecc..95353ee18a441bdf947bb4cf07586c41e1faa18b
@@@ -8,13 -8,6 +8,13 @@@ from .actors.orientatedsurf import Orie
  from .serums import roach_serum_color
  
  
 +def roach_by_name(world, roach_name):
 +    roaches = [r for r in world.roaches if r.name == roach_name]
 +    if not roaches:
 +        return None
 +    return roaches[0]
 +
 +
  class RoachActor(OrientatedSurfActor):
      def __init__(self, frames):
          self._frames = frames
          self.surf = self._frames[self._frame]
  
  
+ class WorldRoach(object):
+     """A roach proxy with no properties for display on the game level."""
+     def __init__(self):
+         self.smart = False
+         self.strong = False
+         self.fast = False
  class RoachFactory:
  
      def __init__(self, suffix, frames=4):
@@@ -59,3 -61,5 +68,5 @@@ default_roaches = RoachFactory(""
  t32_roaches = RoachFactory("_32")
  t21_roaches = RoachFactory("_21")
  big_roaches = RoachFactory("_big")
+ roaches_quartet = RoachFactory("_quartet")
+ roaches_nonet = RoachFactory("_nonet")
index c2a24f64ecbfb6cb5d9f27cc03ae11da0a3cf141,ba4fbb77325b0542d32d7cb35e0d0d8a302be57f..47588a59c5450aaaabd5f74ac120302c65037f50
@@@ -16,6 -16,7 +16,7 @@@ class Vehicle
  
      def __init__(self):
          self.seats = self.init_seats()
+         self.game_pos = (0, 0)
  
      def roach_management_overlay(self):
          return Actor("vehicles/%s/background" % (self.vehicle_type,))
          # 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]
 +
      _vehicle_types = {}
  
      @classmethod
@@@ -66,6 -61,9 +67,9 @@@
          from .walking import Walking
          cls.register(Walking)
  
+     def get_avatar(self, world):
+         raise NotImplementedError("Vehicles should know how to create their own avatars.")
  
  class Seat:
      """ A space in a vehicle for a roach.