Mercurial > rinkhals
comparison gamelib/gameboard.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 | bdc4757e0497 |
children | d110d55c8449 |
comparison
equal
deleted
inserted
replaced
413:bdc4757e0497 | 414:9096c237928c |
---|---|
367 self.tv.sun(False) | 367 self.tv.sun(False) |
368 self.reset_states() | 368 self.reset_states() |
369 self.toolbar.update_fin_tool(self.day) | 369 self.toolbar.update_fin_tool(self.day) |
370 self._cache_animal_positions() | 370 self._cache_animal_positions() |
371 self.spawn_foxes() | 371 self.spawn_foxes() |
372 self.lay_eggs() | 372 self.eggs = 0 |
373 for chicken in self.chickens: | 373 for chicken in self.chickens: |
374 chicken.reload_weapon() | 374 chicken.start_night(self) |
375 self.toolbar.update_egg_counter(self.eggs) | |
375 | 376 |
376 def start_day(self): | 377 def start_day(self): |
377 self.day, self.night = True, False | 378 self.day, self.night = True, False |
378 self.tv.sun(True) | 379 self.tv.sun(True) |
379 self.reset_states() | 380 self.reset_states() |
451 return True | 452 return True |
452 | 453 |
453 chick = self.get_outside_chicken(tile_pos) | 454 chick = self.get_outside_chicken(tile_pos) |
454 if chick is None: | 455 if chick is None: |
455 building = self.get_building(tile_pos) | 456 building = self.get_building(tile_pos) |
456 if building and building.NAME in buildings.HENHOUSES: | 457 if building and building.HENHOUSE: |
457 self.open_building_dialog(building, do_sell) | 458 self.open_building_dialog(building, do_sell) |
458 return | 459 return |
459 do_sell(chick) | 460 do_sell(chick) |
460 | 461 |
461 def sell_one_egg(self, chicken): | 462 def sell_one_egg(self, chicken): |
477 if update_button: | 478 if update_button: |
478 update_button(chicken) | 479 update_button(chicken) |
479 return False | 480 return False |
480 | 481 |
481 building = self.get_building(tile_pos) | 482 building = self.get_building(tile_pos) |
482 if building and building.NAME in buildings.HENHOUSES: | 483 if building and building.HENHOUSE: |
483 self.open_building_dialog(building, do_sell) | 484 self.open_building_dialog(building, do_sell) |
484 | 485 |
485 def select_animal_to_place(self, animal): | 486 def select_animal_to_place(self, animal): |
486 if self.animal_to_place: | 487 if self.animal_to_place: |
487 self.animal_to_place.unequip_by_name("Spotlight") | 488 self.animal_to_place.unequip_by_name("Spotlight") |
873 | 874 |
874 def add_building(self, building): | 875 def add_building(self, building): |
875 self.buildings.append(building) | 876 self.buildings.append(building) |
876 self.tv.sprites.append(building, layer='buildings') | 877 self.tv.sprites.append(building, layer='buildings') |
877 | 878 |
878 def lay_eggs(self): | |
879 self.eggs = 0 | |
880 for building in self.buildings: | |
881 if building.NAME in buildings.HENHOUSES: | |
882 for chicken in building.occupants(): | |
883 chicken.lay() | |
884 self.eggs += chicken.get_num_eggs() | |
885 self.toolbar.update_egg_counter(self.eggs) | |
886 | |
887 def hatch_eggs(self): | 879 def hatch_eggs(self): |
888 for building in self.buildings: | 880 for building in self.buildings: |
889 if building.NAME in buildings.HENHOUSES: | 881 if building.HENHOUSE: |
890 for chicken in building.occupants(): | 882 for chicken in building.occupants(): |
891 new_chick = chicken.hatch(self) | 883 new_chick = chicken.hatch(self) |
892 if new_chick: | 884 if new_chick: |
893 try: | 885 try: |
894 building.add_occupant(new_chick) | 886 building.add_occupant(new_chick) |