Mercurial > pyntnclick
comparison gamelib/scenes/bridge.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 |
---|---|
6 from pygame.color import Color | 6 from pygame.color import Color |
7 from pygame.rect import Rect | 7 from pygame.rect import Rect |
8 | 8 |
9 from pyntnclick.cursor import CursorSprite | 9 from pyntnclick.cursor import CursorSprite |
10 from pyntnclick.state import Scene, Item, Thing, Result | 10 from pyntnclick.state import Scene, Item, Thing, Result |
11 from pyntnclick.scenewidgets import (InteractNoImage, InteractRectUnion, | 11 from pyntnclick.scenewidgets import ( |
12 InteractImage, InteractAnimated, | 12 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated, |
13 GenericDescThing) | 13 GenericDescThing, TakeableThing) |
14 | 14 |
15 from gamelib.scenes.game_constants import PLAYER_ID | 15 from gamelib.scenes.game_constants import PLAYER_ID |
16 from gamelib.scenes.game_widgets import Door, BaseCamera, make_jim_dialog | 16 from gamelib.scenes.game_widgets import Door, BaseCamera, make_jim_dialog |
17 | 17 |
18 | 18 |
174 | 174 |
175 INVENTORY_IMAGE = 'stethoscope.png' | 175 INVENTORY_IMAGE = 'stethoscope.png' |
176 CURSOR = CursorSprite('stethoscope.png') | 176 CURSOR = CursorSprite('stethoscope.png') |
177 | 177 |
178 | 178 |
179 class StethoscopeThing(Thing): | 179 class StethoscopeThing(TakeableThing): |
180 "Stehoscope on the doctor" | 180 "Stethoscope on the doctor" |
181 | 181 |
182 NAME = 'bridge.stethoscope' | 182 NAME = 'bridge.stethoscope' |
183 | 183 |
184 INTERACTS = { | 184 INTERACTS = { |
185 'stethoscope': InteractImage(650, 178, 'hanging_stethoscope.png'), | 185 'stethoscope': InteractImage(650, 178, 'hanging_stethoscope.png'), |
186 } | 186 } |
187 | 187 |
188 INITIAL = 'stethoscope' | 188 INITIAL = 'stethoscope' |
189 ITEM = 'stethoscope' | |
189 | 190 |
190 def get_description(self): | 191 def get_description(self): |
191 return "A stethoscope hangs from the neck of the skeleton." | 192 return "A stethoscope hangs from the neck of the skeleton." |
192 | 193 |
193 def interact_without(self): | 194 def interact_without(self): |
194 self.game.add_inventory_item('stethoscope') | 195 self.take() |
195 self.scene.remove_thing(self) | |
196 # Fill in the doctor's rect | 196 # Fill in the doctor's rect |
197 self.scene.doctor.rect.append(self.rect) | 197 self.scene.doctor.rect.append(self.rect) |
198 return Result("You pick up the stethoscope and verify that the" | 198 return Result("You pick up the stethoscope and verify that the" |
199 " doctor's heart has stopped. Probably a while ago.") | 199 " doctor's heart has stopped. Probably a while ago.") |
200 | 200 |
219 return Result("You rip off a piece of duct tape and stick it on the" | 219 return Result("You rip off a piece of duct tape and stick it on the" |
220 " superconductor. It almost sticks to itself, but you" | 220 " superconductor. It almost sticks to itself, but you" |
221 " successfully avoid disaster.") | 221 " successfully avoid disaster.") |
222 | 222 |
223 | 223 |
224 class SuperconductorThing(Thing): | 224 class SuperconductorThing(TakeableThing): |
225 "Superconductor from the massage chair." | 225 "Superconductor from the massage chair." |
226 | 226 |
227 NAME = 'bridge.superconductor' | 227 NAME = 'bridge.superconductor' |
228 | 228 |
229 INTERACTS = { | 229 INTERACTS = { |
230 'superconductor': InteractImage(158, 138, 'superconductor.png'), | 230 'superconductor': InteractImage(158, 138, 'superconductor.png'), |
231 } | 231 } |
232 | 232 |
233 INITIAL = 'superconductor' | 233 INITIAL = 'superconductor' |
234 | 234 ITEM = 'superconductor' |
235 def interact_without(self): | 235 |
236 self.game.add_inventory_item('superconductor') | 236 def interact_without(self): |
237 self.game.scenes['bridge'].things['bridge.massagechair_base'] \ | 237 self.game.scenes['bridge'].things['bridge.massagechair_base'] \ |
238 .set_data('contains_superconductor', False) | 238 .set_data('contains_superconductor', False) |
239 self.scene.remove_thing(self) | 239 self.take() |
240 return (Result("The superconductor module unclips easily."), | 240 return (Result("The superconductor module unclips easily."), |
241 make_jim_dialog(("Prisoner %s. That chair you've destroyed" | 241 make_jim_dialog(("Prisoner %s. That chair you've destroyed" |
242 " was property of the ship's captain. " | 242 " was property of the ship's captain. " |
243 "You will surely be punished." | 243 "You will surely be punished." |
244 % PLAYER_ID), self.game)) | 244 % PLAYER_ID), self.game)) |