Mercurial > pyntnclick
annotate gamelib/scenes/machine.py @ 488:d8087848722d engine_refactor
Factor Thing interactive stuff out into a mixing. (Items to follow.)
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 29 Aug 2010 13:15:14 +0200 |
parents | af2a23b9787d |
children | a9925aaf5f61 b10dae40dc32 |
rev | line source |
---|---|
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
1 """Machine room where tools and machines are found.""" |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
2 |
263
3b4a78422201
Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents:
262
diff
changeset
|
3 from gamelib.state import Scene, Item, Thing, Result |
194 | 4 from gamelib.cursor import CursorSprite |
263
3b4a78422201
Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents:
262
diff
changeset
|
5 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage, |
3b4a78422201
Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents:
262
diff
changeset
|
6 InteractRectUnion, InteractImage, |
3b4a78422201
Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents:
262
diff
changeset
|
7 InteractAnimated, GenericDescThing) |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
8 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
9 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
10 class Machine(Scene): |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
11 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
12 FOLDER = "machine" |
260
020f83305bf3
Line art machine room.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
252
diff
changeset
|
13 BACKGROUND = "machine_room.png" |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
14 |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
15 def __init__(self, state): |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
16 super(Machine, self).__init__(state) |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
17 self.add_thing(ToMap()) |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
18 self.add_thing(LaserWelderSlot()) |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
19 self.add_thing(LaserWelderButton()) |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
20 self.add_thing(LaserWelderPowerLights()) |
194 | 21 self.add_thing(Grinder()) |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
22 self.add_thing(ManualThing()) |
219
326300c218a6
Choppable cryopipes and can refactoring.
Jeremy Thurgood <firxen@gmail.com>
parents:
215
diff
changeset
|
23 self.add_item(TitaniumMachete('machete')) |
329 | 24 self.add_item(CryoPipesOne('cryo_pipes_one')) |
25 self.add_item(CryoPipesTwo('cryo_pipes_two')) | |
26 self.add_item(CryoPipesThree('cryo_pipes_three')) | |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
27 self.add_item(Manual('manual')) |
297
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
28 self.add_thing(GenericDescThing('machine.wires', 2, |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
29 "Wires run to all the machines in the room", |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
30 ( |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
31 (250, 172, 252, 12), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
32 (388, 183, 114, 13), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
33 (496, 112, 36, 64), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
34 (533, 85, 19, 45), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
35 (647, 114, 10, 308), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
36 (111, 96, 13, 285), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
37 (152, 106, 34, 30), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
38 (189, 136, 27, 28), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
39 (222, 157, 24, 25), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
40 (120, 86, 34, 29), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
41 (110, 80, 21, 15), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
42 (383, 196, 12, 56), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
43 (553, 61, 26, 50), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
44 (574, 39, 16, 48), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
45 (648, 85, 22, 26), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
46 (674, 54, 23, 36), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
47 ))) |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
48 self.add_thing(GenericDescThing('machine.diagram', 3, |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
49 "A wiring diagram of some sort", |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
50 ((694, 140, 94, 185),))) |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
51 self.add_thing(GenericDescThing('machine.powerpoint', 4, |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
52 "The cables to this power point have been cut", |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
53 ((155, 22, 92, 74),))) |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
54 self.add_thing(GenericDescThing("machine.powerpoint", 5, |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
55 "All the machines run off this powerpoint", |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
56 ((593, 19, 74, 57),))) |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
57 self.add_thing(GenericDescThing("machine.drill_press", 6, |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
58 "An impressive looking laser drill press", |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
59 ( |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
60 (519, 338, 36, 63), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
61 (545, 348, 93, 46), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
62 (599, 309, 41, 150), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
63 (588, 445, 66, 42), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
64 (616, 479, 41, 14), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
65 (527, 393, 15, 17), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
66 (510, 360, 13, 11), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
67 (532, 331, 14, 11), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
68 (605, 304, 26, 8), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
69 ))) |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
70 self.add_thing(GenericDescThing("machine.drill_press_block", 7, |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
71 "The block for the laser drill press", # TODO: fix description |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
72 ((461, 446, 38, 27),))) |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
73 |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
74 |
242 | 75 class ToMap(Door): |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
76 |
252
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
242
diff
changeset
|
77 SCENE = "machine" |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
78 |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
79 INTERACTS = { |
262
5f58da9eeb52
Replace text interacts with doors.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
260
diff
changeset
|
80 "door": InteractNoImage(695, 350, 97, 212), |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
81 } |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
82 |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
83 INITIAL = "door" |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
84 |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
85 |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
86 class LaserWelderSlot(Thing): |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
87 |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
88 NAME = "machine.welder.slot" |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
89 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
90 INTERACTS = { |
329 | 91 "empty": InteractImage(241, 310, "welder_empty.png"), |
92 "can": InteractImage(241, 310, "welder_can.png"), | |
93 "tube": InteractImage(241, 310, "welder_pipe.png"), | |
94 "can_and_tube": InteractImage(241, 310, "welder_can_pipe.png"), | |
95 } | |
96 | |
97 INITIAL = "empty" | |
98 | |
99 INITIAL_DATA = { | |
100 'contents': set(), | |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
101 } |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
102 |
329 | 103 def update_contents(self): |
104 """Update the interact after a contents change.""" | |
105 contents = self.get_data('contents') | |
106 if not contents: | |
107 self.set_interact("empty") | |
108 elif len(contents) == 1: | |
109 if "can" in contents: | |
110 self.set_interact("can") | |
111 elif "tube" in contents: | |
112 self.set_interact("tube") | |
113 else: | |
114 self.set_interact("can_and_tube") | |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
115 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
116 def interact_without(self): |
406 | 117 return Result("You really don't want to put your hand in there.") |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
118 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
119 def interact_with_empty_can(self, item): |
329 | 120 contents = self.get_data('contents') |
121 if "can" in contents: | |
122 return Result("There is already a can in the welder.") | |
123 self.state.remove_inventory_item(item.name) | |
124 contents.add("can") | |
125 self.update_contents() | |
126 return Result("You carefully place the can in the laser welder.") | |
127 | |
128 def interact_with_tube_fragment(self, item): | |
129 contents = self.get_data('contents') | |
130 if "tube" in contents: | |
131 return Result("There is already a tube fragment in the welder.") | |
132 self.state.remove_inventory_item(item.name) | |
133 contents.add("tube") | |
134 self.update_contents() | |
135 return Result("You carefully place the tube fragments in the laser welder.") | |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
136 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
137 def get_description(self): |
329 | 138 contents = self.get_data('contents') |
139 if not contents: | |
193
738608e90e9c
CloneableItem tweaks and a usable laser welder. zOMG!
Jeremy Thurgood <firxen@gmail.com>
parents:
190
diff
changeset
|
140 return "This is a Smith and Wesson 'zOMG' class high-precision laser welder." |
329 | 141 if len(contents) == 1: |
142 msg = "The laser welder looks hungry, somehow." | |
143 if "can" in contents: | |
144 msg += " It currently contains an empty can." | |
145 elif "tube" in contents: | |
146 msg += " It currently contains a tube fragment." | |
147 elif len(contents) == 2: | |
148 msg = "The laser welder looks expectant. " | |
149 if "can" in contents and "tube" in contents: | |
150 msg += " It currently contains an empty can and a tube fragment." | |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
151 return msg |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
152 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
153 |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
154 class LaserWelderButton(Thing): |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
155 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
156 NAME = "machine.welder.button" |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
157 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
158 INTERACTS = { |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
159 "button": InteractNoImage(406, 389, 28, 31), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
160 } |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
161 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
162 INITIAL = "button" |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
163 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
164 def interact_without(self): |
329 | 165 contents = self.scene.things["machine.welder.slot"].get_data("contents") |
166 if not contents: | |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
167 return Result("The laser welder doesn't currently contain anything weldable.") |
329 | 168 elif len(contents) == 1: |
169 if "can" in contents: | |
170 return Result("The laser welder needs something to weld the can to.") | |
171 elif "tube" in contents: | |
172 return Result("The laser welder needs something to weld the tube fragments to.") | |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
173 else: |
329 | 174 self.scene.things["machine.welder.slot"].set_data("contents", set()) |
175 self.scene.things["machine.welder.slot"].update_contents() | |
176 if self.state.items["cryo_pipes_one"] in self.state.inventory: | |
177 self.state.replace_inventory_item("cryo_pipes_one", "cryo_pipes_two") | |
459 | 178 return Result("With high-precision spitzensparken, you weld" |
179 " together a second pipe. You bundle the two pipes together.", | |
180 soundfile='laser.ogg') | |
329 | 181 elif self.state.items["cryo_pipes_two"] in self.state.inventory: |
182 self.state.replace_inventory_item("cryo_pipes_two", "cryo_pipes_three") | |
459 | 183 return Result("With high-precision spitzensparken, you create yet" |
184 " another pipe. You store it with the other two.", | |
185 soundfile='laser.ogg') | |
329 | 186 elif self.state.items["cryo_pipes_three"] in self.state.inventory: |
187 # just for safety | |
459 | 188 return None |
329 | 189 else: |
190 self.state.add_inventory_item("cryo_pipes_one") | |
459 | 191 return Result("With high-precision spitzensparken, the can and tube are welded" |
435 | 192 " into a whole greater than the sum of the parts.", |
329 | 193 soundfile='laser.ogg') |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
194 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
195 |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
196 class LaserWelderPowerLights(Thing): |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
197 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
198 NAME = "machine.welder.lights" |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
199 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
200 INTERACTS = { |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
201 "lights": InteractAnimated(199, 273, ["power_lights_%d.png" % i for i in range(8) + range(6,0,-1)], 10) |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
202 } |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
203 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
204 INITIAL = 'lights' |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
205 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
206 def get_description(self): |
372
3aee5895c2c6
remove random out of 1 choice
Neil Muller <neil@dip.sun.ac.za>
parents:
333
diff
changeset
|
207 return "The power lights pulse expectantly." |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
208 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
209 |
329 | 210 class CryoPipesOne(Item): |
211 "A single cryo pipe (made from a tube fragment and can)." | |
212 | |
213 INVENTORY_IMAGE = "cryo_pipes_one.png" | |
214 CURSOR = CursorSprite('cryo_pipes_one_cursor.png') | |
215 TOOL_NAME = "cryo_pipes_one" | |
216 | |
217 | |
218 class CryoPipesTwo(Item): | |
219 "Two cryo pipes (each made from a tube fragment and can)." | |
226 | 220 |
329 | 221 INVENTORY_IMAGE = "cryo_pipes_two.png" |
222 CURSOR = CursorSprite('cryo_pipes_two_cursor.png') | |
223 TOOL_NAME = "cryo_pipes_two" | |
224 | |
225 | |
226 class CryoPipesThree(Item): | |
227 "Three cryo pipes (each made from a tube fragment and can)." | |
228 | |
229 INVENTORY_IMAGE = "cryo_pipes_three.png" | |
230 CURSOR = CursorSprite('cryo_pipes_three_cursor.png') | |
231 TOOL_NAME = "cryo_pipes_three" | |
226 | 232 |
233 | |
194 | 234 class Grinder(Thing): |
235 | |
236 NAME = "machine.grinder" | |
237 | |
238 INTERACTS = { | |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
239 "grind": InteractNoImage(86, 402, 94, 63), |
194 | 240 } |
241 | |
242 INITIAL = "grind" | |
243 | |
244 def interact_without(self): | |
245 return Result("It looks like it eats fingers. Perhaps a different approach is in order?") | |
246 | |
247 def interact_with_titanium_leg(self, item): | |
306
bd9a760eeb18
Hook up canopener. Fix for replace_inventory changes
Neil Muller <neil@dip.sun.ac.za>
parents:
302
diff
changeset
|
248 self.state.replace_inventory_item(item.name, 'machete') |
194 | 249 return Result("After much delicate grinding and a few close calls with" |
250 " various body parts, the titanium femur now resembles" | |
206
6a52752f4920
some more interacations. Add sound to grinder
Neil Muller <neil@dip.sun.ac.za>
parents:
194
diff
changeset
|
251 " a machete more than a bone. Nice and sharp, too.", |
6a52752f4920
some more interacations. Add sound to grinder
Neil Muller <neil@dip.sun.ac.za>
parents:
194
diff
changeset
|
252 soundfile="grinder.ogg") |
194 | 253 |
254 def get_description(self): | |
255 return "A pretty ordinary, albeit rather industrial, grinding machine." | |
256 | |
257 | |
258 class TitaniumMachete(Item): | |
259 "Titanium machete, formerly a leg." | |
260 | |
307
5031b84fbb4c
Hook up new machete, can_opener, and titanium_femur images
Stefano Rivera <stefano@rivera.za.net>
parents:
306
diff
changeset
|
261 INVENTORY_IMAGE = "machete.png" |
5031b84fbb4c
Hook up new machete, can_opener, and titanium_femur images
Stefano Rivera <stefano@rivera.za.net>
parents:
306
diff
changeset
|
262 CURSOR = CursorSprite('machete_cursor.png', 23, 1) |
194 | 263 |
264 | |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
265 class ManualThing(Thing): |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
266 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
267 NAME = "machine.manual" |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
268 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
269 INTERACTS = { |
333 | 270 "manual": InteractImage(432, 493, "manual_on_floor.png"), |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
271 } |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
272 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
273 INITIAL = "manual" |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
274 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
275 def interact_without(self): |
333 | 276 self.scene.remove_thing(self) |
277 self.state.add_inventory_item("manual") | |
278 return Result("Ah! The ship's instruction manual. You'd feel better" | |
279 " if the previous owner wasn't lying next to it with a" | |
280 " gaping hole in his rib cage.") | |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
281 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
282 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
283 class Manual(Item): |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
284 "A ship instruction manual." |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
285 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
286 INVENTORY_IMAGE = "manual.png" |
384
56a05ae56574
Initial manual implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
372
diff
changeset
|
287 CURSOR = None |
56a05ae56574
Initial manual implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
372
diff
changeset
|
288 |
56a05ae56574
Initial manual implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
372
diff
changeset
|
289 def interact_without(self, state): |
56a05ae56574
Initial manual implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
372
diff
changeset
|
290 return Result(detail_view='manual_detail') |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
291 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
292 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
293 SCENES = [Machine] |