comparison gamelib/buildings.py @ 414:9096c237928c

Dear most illustrious brother, I seek your cooperation with the refactoring of egg layerings and the reloading of guns. Please to provide bank details.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 21 Nov 2009 12:48:12 +0000
parents 532f1ea476ff
children 8f012ef1f64f
comparison
equal deleted inserted replaced
413:bdc4757e0497 414:9096c237928c
66 MODIFY_KNIFE_RANGE = lambda s, x: 0 66 MODIFY_KNIFE_RANGE = lambda s, x: 0
67 MODIFY_GUN_RANGE = lambda s, x: -1 67 MODIFY_GUN_RANGE = lambda s, x: -1
68 BREAKABLE = False 68 BREAKABLE = False
69 ABODE = False 69 ABODE = False
70 FLOORS = None 70 FLOORS = None
71 HENHOUSE = False
71 72
72 def __init__(self, pos): 73 def __init__(self, pos):
73 """Initial image, tile vid position, size and tile number for building.""" 74 """Initial image, tile vid position, size and tile number for building."""
74 self._set_images() 75 self._set_images()
75 self.pos = pos 76 self.pos = pos
314 IMAGE = 'sprites/henhouse.png' 315 IMAGE = 'sprites/henhouse.png'
315 SELECTED_IMAGE = 'sprites/select_henhouse.png' 316 SELECTED_IMAGE = 'sprites/select_henhouse.png'
316 NAME = 'Henhouse' 317 NAME = 'Henhouse'
317 FLOORS = [0] 318 FLOORS = [0]
318 319
320 HENHOUSE = True
321
319 class DoubleStoryHenHouse(HenHouse): 322 class DoubleStoryHenHouse(HenHouse):
320 """A double story hen house.""" 323 """A double story hen house."""
321 324
322 TILE_NO = tiles.REVERSE_TILE_MAP['hendominium'] 325 TILE_NO = tiles.REVERSE_TILE_MAP['hendominium']
323 BUY_PRICE = 300 326 BUY_PRICE = 300
366 369
367 def is_building(obj): 370 def is_building(obj):
368 """Return true if obj is a build class.""" 371 """Return true if obj is a build class."""
369 return getattr(obj, "IS_BUILDING", False) and hasattr(obj, "NAME") 372 return getattr(obj, "IS_BUILDING", False) and hasattr(obj, "NAME")
370 373
371 # Building hens can lay eggs in
372 HENHOUSES = [HenHouse.NAME, DoubleStoryHenHouse.NAME]
373
374 BUILDINGS = [] 374 BUILDINGS = []
375 for name in dir(): 375 for name in dir():
376 obj = eval(name) 376 obj = eval(name)
377 try: 377 try:
378 if is_building(obj): 378 if is_building(obj):