comparison gamelib/scenes/crew_quarters.py @ 816:eed75a1d50c4 pyntnclick

Better Item handling.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 27 Jan 2013 22:19:39 +0200
parents a35f5364437d
children bdebe693453f
comparison
equal deleted inserted replaced
815:8f94fbf05ab9 816:eed75a1d50c4
20 20
21 def setup(self): 21 def setup(self):
22 self.add_thing(ToMap()) 22 self.add_thing(ToMap())
23 self.add_thing(Safe()) 23 self.add_thing(Safe())
24 self.add_thing(FishbowlThing()) 24 self.add_thing(FishbowlThing())
25 self.add_item(Fishbowl('fishbowl')) 25 self.add_item_factory(Fishbowl)
26 self.add_item(DuctTape('duct_tape')) 26 self.add_item_factory(DuctTape)
27 self.add_item(EscherPoster('escher_poster')) 27 self.add_item_factory(EscherPoster)
28 self.add_item_factory(FishbowlHelmet)
28 self.add_thing(PosterThing()) 29 self.add_thing(PosterThing())
29 self.add_thing(MonitorCamera()) 30 self.add_thing(MonitorCamera())
30 self.add_thing(GenericDescThing('crew.plant', 1, 31 self.add_thing(GenericDescThing('crew.plant', 1,
31 _("The plant is doing surprisingly well for centuries of neglect"), 32 _("The plant is doing surprisingly well for centuries of neglect"),
32 ((624, 215, 61, 108),))) 33 ((624, 215, 61, 108),)))
152 INVENTORY_IMAGE = 'fishbowl.png' 153 INVENTORY_IMAGE = 'fishbowl.png'
153 CURSOR = CursorSprite('fishbowl.png') 154 CURSOR = CursorSprite('fishbowl.png')
154 NAME = "fishbowl" 155 NAME = "fishbowl"
155 156
156 def interact_with_duct_tape(self, item): 157 def interact_with_duct_tape(self, item):
157 helmet = FishbowlHelmet('helmet') 158 self.game.replace_inventory_item(self.name, 'helmet')
158 self.game.add_item(helmet)
159 self.game.replace_inventory_item(self.name, helmet.name)
160 return Result(_("You duct tape the edges of the helmet. The seal is" 159 return Result(_("You duct tape the edges of the helmet. The seal is"
161 " crude, but it will serve as a workable helmet if" 160 " crude, but it will serve as a workable helmet if"
162 " needed.")) 161 " needed."))
163 162
164 163
171 170
172 171
173 class DuctTape(Item): 172 class DuctTape(Item):
174 "A bowl. Sans fish." 173 "A bowl. Sans fish."
175 174
175 NAME = 'duct_tape'
176 INVENTORY_IMAGE = 'duct_tape.png' 176 INVENTORY_IMAGE = 'duct_tape.png'
177 CURSOR = CursorSprite('duct_tape.png') 177 CURSOR = CursorSprite('duct_tape.png')
178 178
179 179
180 class MonitorCamera(BaseCamera): 180 class MonitorCamera(BaseCamera):