Mercurial > boomslang
annotate gamelib/scenes/cryo.py @ 120:48d24a48d0ce
Enter and leave hooks
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Tue, 24 Aug 2010 17:24:54 +0200 |
parents | d5f7cccfdb6c |
children | d3ca34a664fd |
rev | line source |
---|---|
39
088a101f5b94
Add an example Thing to cryo scene.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
35
diff
changeset
|
1 """Cryo room where the prisoner starts out.""" |
088a101f5b94
Add an example Thing to cryo scene.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
35
diff
changeset
|
2 |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
3 import random |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
4 |
86
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
5 from gamelib.state import Scene, Item, Thing, Result, \ |
105
65976205fc2d
Rough Stab at basic animation support
Neil Muller <neil@dip.sun.ac.za>
parents:
103
diff
changeset
|
6 InteractImage, InteractNoImage, InteractRectUnion, \ |
65976205fc2d
Rough Stab at basic animation support
Neil Muller <neil@dip.sun.ac.za>
parents:
103
diff
changeset
|
7 InteractAnimated |
109
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
8 from gamelib import speech |
39
088a101f5b94
Add an example Thing to cryo scene.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
35
diff
changeset
|
9 |
28
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
10 |
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
11 class Cryo(Scene): |
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
12 |
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
13 FOLDER = "cryo" |
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
14 BACKGROUND = "cryo_room.png" |
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
15 |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
16 INITIAL_DATA = { |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
17 'accessible': True, |
120 | 18 'greet' : True |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
19 } |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
20 |
28
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
21 def __init__(self, state): |
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
22 super(Cryo, self).__init__(state) |
35 | 23 self.add_item(Triangle("triangle")) |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
24 self.add_item(TitaniumLeg("titanium_leg")) |
86
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
25 self.add_thing(CryoUnitAlpha()) |
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
26 self.add_thing(CryoRoomDoor()) |
89
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
27 self.add_thing(CryoComputer()) |
35 | 28 |
120 | 29 def enter(self): |
30 if self.get_data('greet'): | |
31 self.set_data('greet', False) | |
32 return Result("Greetings Prisoner id. You have woken early under" | |
33 " the terms of the emergency conscription act to help with" | |
34 " repairs to the ship. Your behaviour during this time will" | |
35 " be added to your record and will be relayed to " | |
36 " prison officials when we reach the destination." | |
37 " Please report to the bridge.") | |
35 | 38 |
39 class Triangle(Item): | |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
40 "Test item. Needs to go away at some point." |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
41 |
35 | 42 INVENTORY_IMAGE = "triangle.png" |
43 | |
44 | |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
45 class TitaniumLeg(Item): |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
46 "Titanium leg, found on a piratical corpse." |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
47 |
91
542ede2896bb
Link in femur inventory image.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
89
diff
changeset
|
48 INVENTORY_IMAGE = "titanium_femur.png" |
28
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
49 |
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
50 |
39
088a101f5b94
Add an example Thing to cryo scene.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
35
diff
changeset
|
51 class CryoUnitAlpha(Thing): |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
52 "Cryo unit containing titanium leg." |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
53 |
86
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
54 NAME = "cryo.unit.1" |
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
55 |
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
56 INTERACTS = { |
94
ce23fad8ecb3
More complex shaped interactables
Neil Muller <neil@dip.sun.ac.za>
parents:
91
diff
changeset
|
57 "unit": InteractRectUnion(((520, 430, 80, 50), (550, 470, 90, 60), |
ce23fad8ecb3
More complex shaped interactables
Neil Muller <neil@dip.sun.ac.za>
parents:
91
diff
changeset
|
58 (600, 510, 60, 40))) |
86
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
59 } |
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
60 |
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
61 INITIAL = "unit" |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
62 |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
63 INITIAL_DATA = { |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
64 'contains_titanium_leg': True, |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
65 } |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
66 |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
67 def interact_without(self): |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
68 self.state.add_inventory_item('titanium_leg') |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
69 self.set_data('contains_titanium_leg', False) |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
70 return Result("The skeletal occupant of this cryo unit has an artificial femur made of titanium. You take it.") |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
71 |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
72 def is_interactive(self): |
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
73 return self.get_data('contains_titanium_leg') |
39
088a101f5b94
Add an example Thing to cryo scene.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
35
diff
changeset
|
74 |
94
ce23fad8ecb3
More complex shaped interactables
Neil Muller <neil@dip.sun.ac.za>
parents:
91
diff
changeset
|
75 def get_description(self): |
ce23fad8ecb3
More complex shaped interactables
Neil Muller <neil@dip.sun.ac.za>
parents:
91
diff
changeset
|
76 if self.get_data('contains_titanium_leg'): |
ce23fad8ecb3
More complex shaped interactables
Neil Muller <neil@dip.sun.ac.za>
parents:
91
diff
changeset
|
77 return "A broken cryo chamber, with an poor unfortunate corpse inside" |
ce23fad8ecb3
More complex shaped interactables
Neil Muller <neil@dip.sun.ac.za>
parents:
91
diff
changeset
|
78 return "A broken cryo chamber. The corpse inside is missing a leg" |
ce23fad8ecb3
More complex shaped interactables
Neil Muller <neil@dip.sun.ac.za>
parents:
91
diff
changeset
|
79 |
39
088a101f5b94
Add an example Thing to cryo scene.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
35
diff
changeset
|
80 |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
81 class CryoRoomDoor(Thing): |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
82 "Door to the cryo room." |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
83 |
86
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
84 NAME = "cryo.door" |
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
85 |
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
86 INTERACTS = { |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
87 "shut": InteractNoImage(290, 260, 99, 152), |
87
4c6fea1b242b
Fix interact positions.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
86
diff
changeset
|
88 "ajar": InteractImage(290, 260, "door_ajar.png"), |
4c6fea1b242b
Fix interact positions.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
86
diff
changeset
|
89 "open": InteractImage(290, 260, "door_open.png"), |
86
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
90 } |
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
91 |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
92 INITIAL = "shut" |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
93 |
55
2e2f6ff54780
Part of the cryo door puzzle.
Jeremy Thurgood <firxen@gmail.com>
parents:
41
diff
changeset
|
94 INITIAL_DATA = { |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
95 'door': "shut", |
55
2e2f6ff54780
Part of the cryo door puzzle.
Jeremy Thurgood <firxen@gmail.com>
parents:
41
diff
changeset
|
96 } |
2e2f6ff54780
Part of the cryo door puzzle.
Jeremy Thurgood <firxen@gmail.com>
parents:
41
diff
changeset
|
97 |
109
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
98 SPEECH = [ |
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
99 "Sadly, this isn't that sort of game.", |
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
100 "Your valiant efforts are foiled by the Evil Game Designer.", |
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
101 "The door resists. Try something else, perhaps?", |
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
102 "You bang on the door with the titanium femur. It makes a clanging sound.", |
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
103 ] |
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
104 |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
105 def interact_with_titanium_leg(self, item): |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
106 if self.get_data('door') == "ajar": |
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
107 self.open_door() |
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
108 return Result("You wedge the titanium femur into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens.") |
118
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
109 elif self.get_data('door') == "shut": |
109
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
110 text = "You bang on the door with the titanium femur. It makes a clanging sound." |
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
111 speech.say(self.name, text) |
66898d810247
Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
Simon Cross <simon@simonx>
parents:
105
diff
changeset
|
112 return Result(text) |
118
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
113 else: |
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
114 return Result("You wave the femur in the doorway. Nothing happens.") |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
115 |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
116 def interact_without(self): |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
117 if self.get_data('door') == "shut": |
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
118 self.half_open_door() |
118
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
119 if self.get_data('door') != "open": |
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
120 return Result("It moves slightly and then stops. A chain on the other side is preventing it from opening completely.") |
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
121 else: |
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
122 self.state.set_current_scene('bridge') |
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
123 return Result("you leave the room, hoping to never return.") |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
124 |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
125 def interact_default(self, item): |
78 | 126 return Result(random.choice([ |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
127 "Sadly, this isn't that sort of game.", |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
128 "Your valiant efforts are foiled by the Evil Game Designer.", |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
129 "The door resists. Try something else, perhaps?", |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
130 ])) |
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
131 |
56
75bf3d3689e9
Refactor thing interactivity and add "fake" bridge scene.
Jeremy Thurgood <firxen@gmail.com>
parents:
55
diff
changeset
|
132 def is_interactive(self): |
118
e548f4a13741
Add a transition, on general principles
Neil Muller <neil@dip.sun.ac.za>
parents:
109
diff
changeset
|
133 return True |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
134 |
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
135 def half_open_door(self): |
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
136 self.set_data('door', "ajar") |
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
137 self.set_interact("ajar") |
56
75bf3d3689e9
Refactor thing interactivity and add "fake" bridge scene.
Jeremy Thurgood <firxen@gmail.com>
parents:
55
diff
changeset
|
138 |
55
2e2f6ff54780
Part of the cryo door puzzle.
Jeremy Thurgood <firxen@gmail.com>
parents:
41
diff
changeset
|
139 def open_door(self): |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
140 self.set_data('door', "open") |
86
593bddfacf18
Refactor Things a bit to render images.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
78
diff
changeset
|
141 self.set_interact("open") |
55
2e2f6ff54780
Part of the cryo door puzzle.
Jeremy Thurgood <firxen@gmail.com>
parents:
41
diff
changeset
|
142 self.state.scenes['bridge'].set_data('accessible', True) |
67
6b0f7364f3bf
Inventory-related game state.
Jeremy Thurgood <firxen@gmail.com>
parents:
63
diff
changeset
|
143 self.state.remove_inventory_item('titanium_leg') |
55
2e2f6ff54780
Part of the cryo door puzzle.
Jeremy Thurgood <firxen@gmail.com>
parents:
41
diff
changeset
|
144 |
63
3087be3463e0
Some framework support for better message handling
Neil Muller <neil@dip.sun.ac.za>
parents:
56
diff
changeset
|
145 def get_description(self): |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
146 if self.get_data('door') == "open": |
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
147 return 'An open doorway leads to the rest of the ship.' |
103 | 148 elif self.get_data('door') == "ajar": |
95
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
149 return "A rusty door. It can't open all the way because of a chain on the other side." |
7590586180f5
door goes from shut to ajar to open
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
94
diff
changeset
|
150 return 'A rusty door. It is currently closed.' |
63
3087be3463e0
Some framework support for better message handling
Neil Muller <neil@dip.sun.ac.za>
parents:
56
diff
changeset
|
151 |
41
ad6f56bfa8b7
Cryo door, titanium leg and some interaction prototypes.
Jeremy Thurgood <firxen@gmail.com>
parents:
39
diff
changeset
|
152 |
89
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
153 class CryoComputer(Thing): |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
154 "Computer in the cryo room." |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
155 |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
156 NAME = "cryo.computer" |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
157 |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
158 INTERACTS = { |
105
65976205fc2d
Rough Stab at basic animation support
Neil Muller <neil@dip.sun.ac.za>
parents:
103
diff
changeset
|
159 "info": InteractAnimated(416, 290, ["comp_info.png", "comp_warn.png"], |
65976205fc2d
Rough Stab at basic animation support
Neil Muller <neil@dip.sun.ac.za>
parents:
103
diff
changeset
|
160 10), |
89
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
161 "warn": InteractImage(416, 290, "comp_warn.png"), |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
162 "error": InteractImage(416, 290, "comp_error.png"), |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
163 } |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
164 |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
165 INITIAL = "info" |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
166 |
4625efe69c37
Hook up cryo computer.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
87
diff
changeset
|
167 |
119
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
168 class CryoTriangle(Thing): |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
169 "Triangle in the cryo room." |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
170 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
171 NAME = "cryo.triangle" |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
172 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
173 INTERACTS = { |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
174 "triangular": InteractImage(50, 50, "door_open.png"), |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
175 } |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
176 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
177 INITIAL = "triangular" |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
178 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
179 def interact_without(self): |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
180 return Result("You interacted.") |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
181 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
182 def is_interactive(self): |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
183 return True |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
184 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
185 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
186 class CryoUnitWithCorpse(Scene): |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
187 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
188 FOLDER = "cryo" |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
189 BACKGROUND = "cryo_room.png" |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
190 NAME = "cryo_detail" |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
191 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
192 SIZE = (300, 300) |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
193 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
194 def __init__(self, state): |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
195 super(CryoUnitWithCorpse, self).__init__(state) |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
196 self.add_thing(CryoTriangle()) |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
197 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
198 |
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
199 |
28
0f25f7b9b37a
Add loading of initial state.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
200 SCENES = [Cryo] |
119
d5f7cccfdb6c
Hook up "detail view" scenes.
Jeremy Thurgood <firxen@gmail.com>
parents:
118
diff
changeset
|
201 DETAIL_VIEWS = [CryoUnitWithCorpse] |