comparison gamelib/scenes/cryo.py @ 157:153dcb313057

Fill in more cryo room stuff
author Neil Muller <neil@dip.sun.ac.za>
date Wed, 25 Aug 2010 00:09:15 +0200
parents d6b293d46d23
children 0db92b3b5833
comparison
equal deleted inserted replaced
156:02f8b8487210 157:153dcb313057
1 """Cryo room where the prisoner starts out.""" 1 """Cryo room where the prisoner starts out."""
2 2
3 import random 3 import random
4 from albow.music import change_playlist, get_music, PlayList 4 from albow.music import change_playlist, get_music, PlayList
5 from pygame.colordict import THECOLORS
6 from pygame.color import Color
5 7
6 from gamelib import speech 8 from gamelib import speech
7 from gamelib.sound import get_sound 9 from gamelib.sound import get_sound
8 from gamelib.cursor import CursorSprite 10 from gamelib.cursor import CursorSprite
9 from gamelib.state import Scene, Item, Thing, Result, \ 11 from gamelib.state import Scene, Item, Thing, Result, \
10 InteractImage, InteractNoImage, InteractRectUnion, \ 12 InteractImage, InteractNoImage, InteractRectUnion, \
11 InteractAnimated 13 InteractAnimated
14 from gamelib.constants import DEBUG
12 15
13 16
14 class Cryo(Scene): 17 class Cryo(Scene):
15 18
16 FOLDER = "cryo" 19 FOLDER = "cryo"
34 super(Cryo, self).__init__(state) 37 super(Cryo, self).__init__(state)
35 self.add_item(TitaniumLeg("titanium_leg")) 38 self.add_item(TitaniumLeg("titanium_leg"))
36 self.add_thing(CryoUnitAlpha()) 39 self.add_thing(CryoUnitAlpha())
37 self.add_thing(CryoRoomDoor()) 40 self.add_thing(CryoRoomDoor())
38 self.add_thing(CryoComputer()) 41 self.add_thing(CryoComputer())
42 self.add_thing(GenericCryoUnit(2,
43 "An empty cryo chamber.",
44 "Prisoner 81e4-c8900480e635. Embezzlement. 10 years.",
45 ((155, 430, 50, 35), (125, 450, 60, 35), (95, 470, 60, 35),
46 (55, 490, 60, 55))))
47 self.add_thing(GenericCryoUnit(3,
48 "A working cryo chamber. The frosted glass obscures the details of the occupant.",
49 "Prisoner 9334-ce1eb0243bab. Murder. 40 years.",
50 ((215, 430, 50, 35), (205, 450, 50, 35), (185, 470, 50, 35),
51 (125, 505, 80, 40))))
52 self.add_thing(GenericCryoUnit(4,
53 "A broken cryo chamber. The skeleton inside has been picked clean.",
54 "Prisoner bfbc-8bf4c6b7492b. Importing illegal alien biomatter. 15 years.",
55 ((275, 430, 50, 70), (255, 460, 50, 70), (235, 490, 50, 60))))
56 self.add_thing(GenericCryoUnit(5,
57 "A working cryo chamber. The frosted glass obscures the details of the occupant.",
58 "Prisoner b520-99495b8c41ce. Copyright infringment. 60 years.",
59 ((340, 430, 50, 70), (330, 500, 60, 50))))
60
39 61
40 def enter(self): 62 def enter(self):
41 # Setup music 63 # Setup music
42 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC] 64 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC]
43 background_playlist = PlayList(pieces, random=True, repeat=True) 65 background_playlist = PlayList(pieces, random=True, repeat=True)
68 90
69 NAME = "cryo.unit.1" 91 NAME = "cryo.unit.1"
70 92
71 INTERACTS = { 93 INTERACTS = {
72 "unit": InteractRectUnion(( 94 "unit": InteractRectUnion((
73 (520, 430, 80, 50), 95 (530, 430, 80, 50),
74 (550, 470, 90, 60), 96 (560, 470, 70, 50),
75 (600, 510, 60, 40), 97 (600, 510, 70, 40),
76 )) 98 ))
77 } 99 }
78 100
79 INITIAL = "unit" 101 INITIAL = "unit"
80 102
85 def interact_without(self): 107 def interact_without(self):
86 return Result(detail_view='cryo_detail') 108 return Result(detail_view='cryo_detail')
87 109
88 def get_description(self): 110 def get_description(self):
89 if self.get_data('contains_titanium_leg'): 111 if self.get_data('contains_titanium_leg'):
90 return "A broken cryo chamber, with an poor unfortunate corpse inside" 112 return "A broken cryo chamber, with an poor unfortunate corpse inside."
91 return "A broken cryo chamber. The corpse inside is missing a leg" 113 return "A broken cryo chamber. The corpse inside is missing a leg."
114
115 class GenericCryoUnit(Thing):
116 "Generic Cryo unit"
117
118 INITIAL = 'unit'
119
120 def __init__(self, number, description, detailed_description, areas):
121 super(GenericCryoUnit, self).__init__()
122 self.description = description
123 self.detailed_description = detailed_description
124 self.name = 'cryo.unit.%d' % number
125 self.interacts = {
126 'unit' : InteractRectUnion(areas)
127 }
128 if DEBUG:
129 # Individual colors to make debugging easier
130 self._interact_hilight_color = Color(THECOLORS.keys()[number])
131
132 def interact_without(self):
133 return Result(self.detailed_description)
134
135 def get_description(self):
136 return self.description
92 137
93 138
94 class CryoRoomDoor(Thing): 139 class CryoRoomDoor(Thing):
95 "Door to the cryo room." 140 "Door to the cryo room."
96 141
189 return Result("The skeletal occupant of this cryo unit has an artificial femur made of titanium. You take it.") 234 return Result("The skeletal occupant of this cryo unit has an artificial femur made of titanium. You take it.")
190 235
191 def get_description(self): 236 def get_description(self):
192 return "This femur looks synthetic." 237 return "This femur looks synthetic."
193 238
239 class PlaqueThing(Thing):
240 "Plaque on the detailed cryo chamber"
241
242 NAME = "cryo.plaque"
243
244 INTERACTS = {
245 "plaque": InteractImage(150, 150, "triangle.png"),
246 }
247
248 INITIAL = "plaque"
249
250 def interact_without(self):
251 return Result("The plaque is welded to the unit. You can't shift it")
252
253 def get_description(self):
254 return "'Prisoner 98cc-764e646391ee. War crimes. 45 years."
255
194 256
195 class CryoUnitWithCorpse(Scene): 257 class CryoUnitWithCorpse(Scene):
196 258
197 FOLDER = "cryo" 259 FOLDER = "cryo"
198 BACKGROUND = "cryo_unit_detail.png" 260 BACKGROUND = "cryo_unit_detail.png"
201 SIZE = (300, 300) 263 SIZE = (300, 300)
202 264
203 def __init__(self, state): 265 def __init__(self, state):
204 super(CryoUnitWithCorpse, self).__init__(state) 266 super(CryoUnitWithCorpse, self).__init__(state)
205 self.add_thing(TitaniumLegThing()) 267 self.add_thing(TitaniumLegThing())
268 self.add_thing(PlaqueThing())
206 269
207 270
208 SCENES = [Cryo] 271 SCENES = [Cryo]
209 DETAIL_VIEWS = [CryoUnitWithCorpse] 272 DETAIL_VIEWS = [CryoUnitWithCorpse]