comparison gamelib/scenes/bridge.py @ 354:09efb8b7c132

Hook up panel part of AI puzzle
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 28 Aug 2010 16:30:43 +0200
parents 88c1a59b0544
children 452230d78541
comparison
equal deleted inserted replaced
353:b61dccc7fb42 354:09efb8b7c132
34 'silent.ogg', 34 'silent.ogg',
35 ] 35 ]
36 36
37 INITIAL_DATA = { 37 INITIAL_DATA = {
38 'accessible': True, 38 'accessible': True,
39 'ai online' : True, 39 'ai status' : 'online',
40 'ai panel' : 'closed',
40 } 41 }
41 42
42 def __init__(self, state): 43 def __init__(self, state):
43 super(Bridge, self).__init__(state) 44 super(Bridge, self).__init__(state)
44 self.background_playlist = None 45 self.background_playlist = None
50 self.add_thing(MassageChairBase()) 51 self.add_thing(MassageChairBase())
51 self.add_thing(StethoscopeThing()) 52 self.add_thing(StethoscopeThing())
52 self.add_thing(BridgeComputer()) 53 self.add_thing(BridgeComputer())
53 self.add_thing(LeftLights()) 54 self.add_thing(LeftLights())
54 self.add_thing(RightLights()) 55 self.add_thing(RightLights())
56 self.add_thing(JimPanel())
55 self.add_thing(GenericDescThing('bridge.wires', 1, 57 self.add_thing(GenericDescThing('bridge.wires', 1,
56 "The brightly coloured wires contrast with the drab walls.", 58 "The brightly coloured wires contrast with the drab walls.",
57 ((46, 4, 711, 143),))) 59 ((46, 4, 711, 143),)))
58 self.add_thing(GenericDescThing('bridge.note', 2, 60 self.add_thing(GenericDescThing('bridge.note', 2,
59 "\"Dammit JIM, I'm a doctor, not an engineer!\"", 61 "\"Dammit JIM, I'm a doctor, not an engineer!\"",
74 76
75 def enter(self): 77 def enter(self):
76 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC] 78 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC]
77 self.background_playlist = PlayList(pieces, random=True, repeat=True) 79 self.background_playlist = PlayList(pieces, random=True, repeat=True)
78 change_playlist(self.background_playlist) 80 change_playlist(self.background_playlist)
79 if self.get_data('ai online'):
80 return Result("JIM says: 'Prisone %s. The bridge is a restricted area. "
81 "Entering this area is a class 3 offence and each infraction carries a minimal "
82 "penalty of an additional 6 months on your sentence;" % PLAYER_ID,
83 style="JIM")
84 81
85 def leave(self): 82 def leave(self):
86 change_playlist(None) 83 change_playlist(None)
87 84
88 85
258 "lights": InteractAnimated(559, 332, ["bridge_lights_2_1.png", "bridge_lights_2_2.png", "bridge_lights_2_3.png", "bridge_lights_2_2.png"], 5) 255 "lights": InteractAnimated(559, 332, ["bridge_lights_2_1.png", "bridge_lights_2_2.png", "bridge_lights_2_3.png", "bridge_lights_2_2.png"], 5)
259 } 256 }
260 257
261 INITIAL = 'lights' 258 INITIAL = 'lights'
262 259
263 260 class JimPanel(Thing):
261 "The panel to JIM's internals'"
262
263 NAME = "jim_panel"
264
265 INTERACTS = {
266 'closed' : InteractNoImage(506, 430, 137, 47),
267 'open' : InteractImage(500, 427, 'jim_panel_open.png'),
268 'broken' : InteractImage(488, 412, 'jim_panel_destroyed.png'),
269 }
270
271 INITIAL = 'closed'
272
273 def get_description(self):
274 if self.scene.get_data('ai panel') == 'closed':
275 return "The sign reads 'Warning. Authorized Techinicians Only'"
276
277 def interact_without(self):
278 if self.scene.get_data('ai status') == 'online':
279 return self.interact_default()
280 elif self.scene.get_data('ai panel') == 'closed':
281 return Result("You are unable to open the panel with you bare hands")
282 elif self.scene.get_data('ai panel') == 'open':
283 self.scene.set_data('ai panel', 'broken')
284 self.scene.set_data('ai status', 'dead')
285 self.set_interact('broken')
286 return Result("You unplug various important looking wires.")
287
288
289 def interact_with_machete(self, item):
290 if self.scene.get_data('ai status') == 'online':
291 return self.interact_default()
292 elif self.scene.get_data('ai panel') == 'closed':
293 self.scene.set_data('ai panel', 'open')
294 self.set_interact('open')
295 return Result("Using the machete, you lever the panel off.")
296 elif self.scene.get_data('ai panel') == 'open':
297 self.scene.set_data('ai panel', 'broken')
298 self.scene.set_data('ai status', 'dead')
299 self.set_interact('broken')
300 return Result("You smash various delicate components with the machete.")
301
302 def interact_default(self):
303 if self.scene.get_data('ai status') == 'online':
304 return (Result('You feel a shock from the panel'),
305 Result("JIM says: 'Prisoner %s. Please step away from the panel. "
306 "You are not an authorized techinican.'" % PLAYER_ID, style="JIM"))
264 307
265 class ChairDetail(Scene): 308 class ChairDetail(Scene):
266 309
267 FOLDER = 'bridge' 310 FOLDER = 'bridge'
268 BACKGROUND = 'chair_detail.png' 311 BACKGROUND = 'chair_detail.png'