diff gamelib/scenes/crew_quarters.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/crew_quarters.py	Sat Jan 26 13:24:01 2013 +0200
+++ b/gamelib/scenes/crew_quarters.py	Sat Jan 26 15:24:56 2013 +0200
@@ -2,8 +2,9 @@
 
 from pyntnclick.cursor import CursorSprite
 from pyntnclick.state import Scene, Item, Thing, Result
-from pyntnclick.scenewidgets import (InteractNoImage, InteractImage,
-                                  InteractAnimated, GenericDescThing)
+from pyntnclick.scenewidgets import (
+    InteractNoImage, InteractImage, InteractAnimated, GenericDescThing,
+    TakeableThing)
 
 from gamelib.scenes.game_constants import PLAYER_ID
 from gamelib.scenes.game_widgets import Door, BaseCamera, make_jim_dialog
@@ -187,7 +188,7 @@
     }
 
 
-class PosterThing(Thing):
+class PosterThing(TakeableThing):
     "A innocent poster on the wall"
 
     NAME = 'crew.poster'
@@ -197,10 +198,10 @@
     }
 
     INITIAL = 'poster'
+    ITEM = 'escher_poster'
 
     def interact_without(self):
-        self.game.add_inventory_item('escher_poster')
-        self.scene.remove_thing(self)
+        self.take()
         return Result("This poster will go nicely on your bedroom wall.")
 
     def get_description(self):