Mercurial > pyntnclick
diff 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 |
line wrap: on
line diff
--- a/gamelib/scenes/machine.py Sat Jan 26 13:24:01 2013 +0200 +++ b/gamelib/scenes/machine.py Sat Jan 26 15:24:56 2013 +0200 @@ -2,8 +2,9 @@ from pyntnclick.state import Scene, Item, Thing, Result from pyntnclick.cursor import CursorSprite -from pyntnclick.scenewidgets import (InteractNoImage, InteractImage, - InteractAnimated, GenericDescThing) +from pyntnclick.scenewidgets import ( + InteractNoImage, InteractImage, InteractAnimated, GenericDescThing, + TakeableThing) from gamelib.scenes.game_widgets import Door @@ -276,7 +277,7 @@ CURSOR = CursorSprite('machete_cursor.png', 23, 1) -class ManualThing(Thing): +class ManualThing(TakeableThing): NAME = "machine.manual" @@ -285,10 +286,10 @@ } INITIAL = "manual" + ITEM = 'manual' def interact_without(self): - self.scene.remove_thing(self) - self.game.add_inventory_item("manual") + self.take() return Result("Ah! The ship's instruction manual. You'd feel better" " if the previous owner wasn't lying next to it with a" " gaping hole in his rib cage.")