# HG changeset patch # User Stefano Rivera # Date 1282737320 -7200 # Node ID 3d3efc5648cc7105febd2b651fd0647ae18c864f # Parent a2d041e0ab83fe5d823e2f1d0867b17825c9ec73 Allow multiple cans to be picked up diff -r a2d041e0ab83 -r 3d3efc5648cc gamelib/scenes/mess.py --- a/gamelib/scenes/mess.py Wed Aug 25 13:18:51 2010 +0200 +++ b/gamelib/scenes/mess.py Wed Aug 25 13:55:20 2010 +0200 @@ -1,5 +1,7 @@ """Mess where crew eat. Fun stuff.""" +from random import choice + from gamelib.state import Scene, Item, Thing, InteractImage, InteractNoImage, Result from gamelib.cursor import CursorSprite @@ -78,21 +80,24 @@ INITIAL = "cans" INITIAL_DATA = { - "cans": True, + 'taken_one': False, } def interact_without(self): - if self.data['cans']: - self.state.add_inventory_item('full_can') - self.set_data("cans", False) - self.set_interact("nocans") + self.state.add_inventory_item('full_can') + if not self.data['taken_one']: + self.set_data('taken_one', True) return Result("Best before along time in the past. Better not eat these.") + else: + return Result(choice(( + 'Another can of imitation chicken? Great.', + 'Mmmm. Nutritious Bacteria Stew.', + "The label has rusted off, I don't want to know what's inside.", + "I hope I don't get hungry enough to open these.", + ))) def get_description(self): - if self.data["cans"]: - return "The contents of these cans looks synthetic." - else: - return "You've pillaged these shelves already." + return "The contents of these cans looks synthetic." class Tubes(Thing):