# HG changeset patch # User Neil Muller # Date 1252101844 0 # Node ID 962934b8c7dcd80bbbfa9819989766ab51e8a69e # Parent 85a5299caf4adbe58b49c05d40e5f64b699722ee Implement UI part of egg selling diff -r 85a5299caf4a -r 962934b8c7dc gamelib/animal.py --- a/gamelib/animal.py Fri Sep 04 22:01:20 2009 +0000 +++ b/gamelib/animal.py Fri Sep 04 22:04:04 2009 +0000 @@ -143,13 +143,19 @@ """See if the chicken lays an egg""" if not self.egg: self.egg = Egg(self.pos) + self.equip(equipment.NestEgg()) + + def remove_egg(self): + """Clean up the egg state""" + self.egg = None + self.unequip_by_name("nestegg") def hatch(self): """See if we have an egg to hatch""" if self.egg: chick = self.egg.hatch() if chick: - self.egg = None + self.remove_egg() return chick return None diff -r 85a5299caf4a -r 962934b8c7dc gamelib/gameboard.py --- a/gamelib/gameboard.py Fri Sep 04 22:01:20 2009 +0000 +++ b/gamelib/gameboard.py Fri Sep 04 22:04:04 2009 +0000 @@ -354,7 +354,7 @@ # We sell the egg self.add_cash(constants.SELL_PRICE_EGG) sound.play_sound("sell-chicken.ogg") - chicken.egg = None + chicken.remove_egg() self.eggs -= 1 self.toolbar.update_egg_counter(self.eggs) # Force update @@ -480,6 +480,9 @@ if sell_callback(place.occupant): # empty the nest (on button) update_button(place.occupant, empty=True) + else: + # Update for equipment changes, etc. + update_button(place.occupant) else: # there is no occupant, attempt to fill the space if self.animal_to_place is not None: