comparison gamelib/scenes/machine.py @ 750:ef4bda7d623d pyntnclick

Better state and inventory management.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 20 Jan 2013 20:20:36 +0200
parents 2f74064bc779
children c910c8b51d55
comparison
equal deleted inserted replaced
749:a453731e4531 750:ef4bda7d623d
178 return Result("The laser welder needs something to weld the" 178 return Result("The laser welder needs something to weld the"
179 " tube fragments to.") 179 " tube fragments to.")
180 else: 180 else:
181 welder_slot.set_data("contents", set()) 181 welder_slot.set_data("contents", set())
182 welder_slot.update_contents() 182 welder_slot.update_contents()
183 if self.game.items["cryo_pipes_one"] in self.game.inventory: 183 if self.game.is_in_inventory("cryo_pipes_one"):
184 self.game.replace_inventory_item("cryo_pipes_one", 184 self.game.replace_inventory_item("cryo_pipes_one",
185 "cryo_pipes_two") 185 "cryo_pipes_two")
186 return Result("With high-precision spitzensparken, you weld" 186 return Result("With high-precision spitzensparken, you weld"
187 " together a second pipe. You bundle the two" 187 " together a second pipe. You bundle the two"
188 " pipes together.", 188 " pipes together.",
189 soundfile='laser.ogg') 189 soundfile='laser.ogg')
190 elif self.game.items["cryo_pipes_two"] in self.game.inventory: 190 elif self.game.is_in_inventory("cryo_pipes_two"):
191 self.game.replace_inventory_item("cryo_pipes_two", 191 self.game.replace_inventory_item("cryo_pipes_two",
192 "cryo_pipes_three") 192 "cryo_pipes_three")
193 return Result("With high-precision spitzensparken, you create" 193 return Result("With high-precision spitzensparken, you create"
194 " yet another pipe. You store it with the other" 194 " yet another pipe. You store it with the other"
195 " two.", 195 " two.",
196 soundfile='laser.ogg') 196 soundfile='laser.ogg')
197 elif self.game.items["cryo_pipes_three"] in self.game.inventory: 197 elif self.game.is_in_inventory("cryo_pipes_three"):
198 # just for safety 198 # just for safety
199 return None 199 return None
200 else: 200 else:
201 self.game.add_inventory_item("cryo_pipes_one") 201 self.game.add_inventory_item("cryo_pipes_one")
202 return Result("With high-precision spitzensparken, the can and" 202 return Result("With high-precision spitzensparken, the can and"