Mercurial > boomslang
comparison gamelib/scenes/mess.py @ 175:3d3efc5648cc
Allow multiple cans to be picked up
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Wed, 25 Aug 2010 13:55:20 +0200 |
parents | 179913efac85 |
children | 278774b31d3c |
comparison
equal
deleted
inserted
replaced
174:a2d041e0ab83 | 175:3d3efc5648cc |
---|---|
1 """Mess where crew eat. Fun stuff.""" | 1 """Mess where crew eat. Fun stuff.""" |
2 | |
3 from random import choice | |
2 | 4 |
3 from gamelib.state import Scene, Item, Thing, InteractImage, InteractNoImage, Result | 5 from gamelib.state import Scene, Item, Thing, InteractImage, InteractNoImage, Result |
4 from gamelib.cursor import CursorSprite | 6 from gamelib.cursor import CursorSprite |
5 | 7 |
6 | 8 |
76 } | 78 } |
77 | 79 |
78 INITIAL = "cans" | 80 INITIAL = "cans" |
79 | 81 |
80 INITIAL_DATA = { | 82 INITIAL_DATA = { |
81 "cans": True, | 83 'taken_one': False, |
82 } | 84 } |
83 | 85 |
84 def interact_without(self): | 86 def interact_without(self): |
85 if self.data['cans']: | 87 self.state.add_inventory_item('full_can') |
86 self.state.add_inventory_item('full_can') | 88 if not self.data['taken_one']: |
87 self.set_data("cans", False) | 89 self.set_data('taken_one', True) |
88 self.set_interact("nocans") | |
89 return Result("Best before along time in the past. Better not eat these.") | 90 return Result("Best before along time in the past. Better not eat these.") |
91 else: | |
92 return Result(choice(( | |
93 'Another can of imitation chicken? Great.', | |
94 'Mmmm. Nutritious Bacteria Stew.', | |
95 "The label has rusted off, I don't want to know what's inside.", | |
96 "I hope I don't get hungry enough to open these.", | |
97 ))) | |
90 | 98 |
91 def get_description(self): | 99 def get_description(self): |
92 if self.data["cans"]: | 100 return "The contents of these cans looks synthetic." |
93 return "The contents of these cans looks synthetic." | |
94 else: | |
95 return "You've pillaged these shelves already." | |
96 | 101 |
97 | 102 |
98 class Tubes(Thing): | 103 class Tubes(Thing): |
99 | 104 |
100 NAME = "mess.tubes" | 105 NAME = "mess.tubes" |