Mercurial > boomslang
comparison gamelib/scenes/machine.py @ 603:3ce19d33b51f pyntnclick
Rename state to game to not cause confusion with the other state
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sat, 11 Feb 2012 20:09:47 +0200 |
parents | 4e9178215e75 |
children | 2f74064bc779 |
comparison
equal
deleted
inserted
replaced
602:1aac5a3b17e1 | 603:3ce19d33b51f |
---|---|
118 | 118 |
119 def interact_with_empty_can(self, item): | 119 def interact_with_empty_can(self, item): |
120 contents = self.get_data('contents') | 120 contents = self.get_data('contents') |
121 if "can" in contents: | 121 if "can" in contents: |
122 return Result("There is already a can in the welder.") | 122 return Result("There is already a can in the welder.") |
123 self.state.remove_inventory_item(item.name) | 123 self.game.remove_inventory_item(item.name) |
124 contents.add("can") | 124 contents.add("can") |
125 self.update_contents() | 125 self.update_contents() |
126 return Result("You carefully place the can in the laser welder.") | 126 return Result("You carefully place the can in the laser welder.") |
127 | 127 |
128 def interact_with_tube_fragment(self, item): | 128 def interact_with_tube_fragment(self, item): |
129 contents = self.get_data('contents') | 129 contents = self.get_data('contents') |
130 if "tube" in contents: | 130 if "tube" in contents: |
131 return Result("There is already a tube fragment in the welder.") | 131 return Result("There is already a tube fragment in the welder.") |
132 self.state.remove_inventory_item(item.name) | 132 self.game.remove_inventory_item(item.name) |
133 contents.add("tube") | 133 contents.add("tube") |
134 self.update_contents() | 134 self.update_contents() |
135 return Result("You carefully place the tube fragments in the" | 135 return Result("You carefully place the tube fragments in the" |
136 " laser welder.") | 136 " laser welder.") |
137 | 137 |
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.state.items["cryo_pipes_one"] in self.state.inventory: | 183 if self.game.items["cryo_pipes_one"] in self.game.inventory: |
184 self.state.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.state.items["cryo_pipes_two"] in self.state.inventory: | 190 elif self.game.items["cryo_pipes_two"] in self.game.inventory: |
191 self.state.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.state.items["cryo_pipes_three"] in self.state.inventory: | 197 elif self.game.items["cryo_pipes_three"] in self.game.inventory: |
198 # just for safety | 198 # just for safety |
199 return None | 199 return None |
200 else: | 200 else: |
201 self.state.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" |
203 " tube are welded into a whole greater than the" | 203 " tube are welded into a whole greater than the" |
204 " sum of the parts.", | 204 " sum of the parts.", |
205 soundfile='laser.ogg') | 205 soundfile='laser.ogg') |
206 | 206 |
258 def interact_without(self): | 258 def interact_without(self): |
259 return Result("It looks like it eats fingers. Perhaps a different" | 259 return Result("It looks like it eats fingers. Perhaps a different" |
260 " approach is in order?") | 260 " approach is in order?") |
261 | 261 |
262 def interact_with_titanium_leg(self, item): | 262 def interact_with_titanium_leg(self, item): |
263 self.state.replace_inventory_item(item.name, 'machete') | 263 self.game.replace_inventory_item(item.name, 'machete') |
264 return Result("After much delicate grinding and a few close calls with" | 264 return Result("After much delicate grinding and a few close calls with" |
265 " various body parts, the titanium femur now resembles" | 265 " various body parts, the titanium femur now resembles" |
266 " a machete more than a bone. Nice and sharp, too.", | 266 " a machete more than a bone. Nice and sharp, too.", |
267 soundfile="grinder.ogg") | 267 soundfile="grinder.ogg") |
268 | 268 |
287 | 287 |
288 INITIAL = "manual" | 288 INITIAL = "manual" |
289 | 289 |
290 def interact_without(self): | 290 def interact_without(self): |
291 self.scene.remove_thing(self) | 291 self.scene.remove_thing(self) |
292 self.state.add_inventory_item("manual") | 292 self.game.add_inventory_item("manual") |
293 return Result("Ah! The ship's instruction manual. You'd feel better" | 293 return Result("Ah! The ship's instruction manual. You'd feel better" |
294 " if the previous owner wasn't lying next to it with a" | 294 " if the previous owner wasn't lying next to it with a" |
295 " gaping hole in his rib cage.") | 295 " gaping hole in his rib cage.") |
296 | 296 |
297 | 297 |