comparison gamelib/scenes/machine.py @ 764:a8510f4e2ea1 pyntnclick

Conditionally add things based on state.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 26 Jan 2013 15:24:56 +0200
parents 386475464202
children a35f5364437d
comparison
equal deleted inserted replaced
763:afe7b1cb16c0 764:a8510f4e2ea1
1 """Machine room where tools and machines are found.""" 1 """Machine room where tools and machines are found."""
2 2
3 from pyntnclick.state import Scene, Item, Thing, Result 3 from pyntnclick.state import Scene, Item, Thing, Result
4 from pyntnclick.cursor import CursorSprite 4 from pyntnclick.cursor import CursorSprite
5 from pyntnclick.scenewidgets import (InteractNoImage, InteractImage, 5 from pyntnclick.scenewidgets import (
6 InteractAnimated, GenericDescThing) 6 InteractNoImage, InteractImage, InteractAnimated, GenericDescThing,
7 TakeableThing)
7 8
8 from gamelib.scenes.game_widgets import Door 9 from gamelib.scenes.game_widgets import Door
9 10
10 11
11 class Machine(Scene): 12 class Machine(Scene):
274 275
275 INVENTORY_IMAGE = "machete.png" 276 INVENTORY_IMAGE = "machete.png"
276 CURSOR = CursorSprite('machete_cursor.png', 23, 1) 277 CURSOR = CursorSprite('machete_cursor.png', 23, 1)
277 278
278 279
279 class ManualThing(Thing): 280 class ManualThing(TakeableThing):
280 281
281 NAME = "machine.manual" 282 NAME = "machine.manual"
282 283
283 INTERACTS = { 284 INTERACTS = {
284 "manual": InteractImage(432, 493, "manual_on_floor.png"), 285 "manual": InteractImage(432, 493, "manual_on_floor.png"),
285 } 286 }
286 287
287 INITIAL = "manual" 288 INITIAL = "manual"
288 289 ITEM = 'manual'
289 def interact_without(self): 290
290 self.scene.remove_thing(self) 291 def interact_without(self):
291 self.game.add_inventory_item("manual") 292 self.take()
292 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"
293 " 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"
294 " gaping hole in his rib cage.") 295 " gaping hole in his rib cage.")
295 296
296 297