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

Better Item handling.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 27 Jan 2013 22:19:39 +0200
parents 374d96e0b55e
children e81facd05e00
comparison
equal deleted inserted replaced
815:8f94fbf05ab9 816:eed75a1d50c4
40 'ai panel': 'closed', # closed, open, broken 40 'ai panel': 'closed', # closed, open, broken
41 } 41 }
42 42
43 def setup(self): 43 def setup(self):
44 self.background_playlist = None 44 self.background_playlist = None
45 self.add_item(Superconductor('superconductor')) 45 self.add_item_factory(Superconductor)
46 self.add_item(Stethoscope('stethoscope')) 46 self.add_item_factory(TapedSuperconductor)
47 self.add_item_factory(Stethoscope)
47 self.add_thing(ToMap()) 48 self.add_thing(ToMap())
48 self.add_thing(MonitorCamera()) 49 self.add_thing(MonitorCamera())
49 self.add_thing(MassageChair()) 50 self.add_thing(MassageChair())
50 self.add_thing(MassageChairBase()) 51 self.add_thing(MassageChairBase())
51 self.add_thing(StethoscopeThing()) 52 self.add_thing(StethoscopeThing())
171 172
172 173
173 class Stethoscope(Item): 174 class Stethoscope(Item):
174 "Used for cracking safes. Found on the doctor on the chair" 175 "Used for cracking safes. Found on the doctor on the chair"
175 176
177 NAME = 'stethoscope'
176 INVENTORY_IMAGE = 'stethoscope.png' 178 INVENTORY_IMAGE = 'stethoscope.png'
177 CURSOR = CursorSprite('stethoscope.png') 179 CURSOR = CursorSprite('stethoscope.png')
178 180
179 181
180 class StethoscopeThing(TakeableThing): 182 class StethoscopeThing(TakeableThing):
201 203
202 204
203 class TapedSuperconductor(Item): 205 class TapedSuperconductor(Item):
204 "Used for connecting high-powered parts of the ship up" 206 "Used for connecting high-powered parts of the ship up"
205 207
208 NAME = 'taped_superconductor'
206 INVENTORY_IMAGE = 'superconductor_taped.png' 209 INVENTORY_IMAGE = 'superconductor_taped.png'
207 CURSOR = CursorSprite('superconductor_taped_cursor.png') 210 CURSOR = CursorSprite('superconductor_taped_cursor.png')
208 211
209 212
210 class Superconductor(Item): 213 class Superconductor(Item):
211 "Used for connecting high-powered parts of the ship up" 214 "Used for connecting high-powered parts of the ship up"
212 215
216 NAME = 'superconductor'
213 INVENTORY_IMAGE = 'superconductor_fixed.png' 217 INVENTORY_IMAGE = 'superconductor_fixed.png'
214 CURSOR = CursorSprite('superconductor_fixed.png') 218 CURSOR = CursorSprite('superconductor_fixed.png')
215 219
216 def interact_with_duct_tape(self, item): 220 def interact_with_duct_tape(self, item):
217 taped_superconductor = TapedSuperconductor('taped_superconductor') 221 self.game.replace_inventory_item(self.name, 'taped_superconductor')
218 self.game.add_item(taped_superconductor)
219 self.game.replace_inventory_item(self.name, taped_superconductor.name)
220 return Result(_("You rip off a piece of duct tape and stick it on the" 222 return Result(_("You rip off a piece of duct tape and stick it on the"
221 " superconductor. It almost sticks to itself, but you" 223 " superconductor. It almost sticks to itself, but you"
222 " successfully avoid disaster.")) 224 " successfully avoid disaster."))
223 225
224 226