annotate gamelib/scenes/machine.py @ 306:bd9a760eeb18

Hook up canopener. Fix for replace_inventory changes
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 28 Aug 2010 01:28:51 +0200
parents 6d93e04036c9
children 5031b84fbb4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
283
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 281
diff changeset
3 import random
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 281
diff changeset
4
263
3b4a78422201 Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents: 262
diff changeset
5 from gamelib.state import Scene, Item, Thing, Result
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
6 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
7 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
8 InteractRectUnion, InteractImage,
3b4a78422201 Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents: 262
diff changeset
9 InteractAnimated, GenericDescThing)
47
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
10
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 class Machine(Scene):
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
13
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
14 FOLDER = "machine"
260
020f83305bf3 Line art machine room.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 252
diff changeset
15 BACKGROUND = "machine_room.png"
47
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
16
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
17 INITIAL_DATA = {
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
18 'accessible': True,
47
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
19 }
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
20
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
21 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
22 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
23 self.add_thing(ToMap())
193
738608e90e9c CloneableItem tweaks and a usable laser welder. zOMG!
Jeremy Thurgood <firxen@gmail.com>
parents: 190
diff changeset
24 self.add_thing(LaserWelder())
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
25 self.add_thing(LaserWelderPowerLights())
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
26 self.add_thing(Grinder())
219
326300c218a6 Choppable cryopipes and can refactoring.
Jeremy Thurgood <firxen@gmail.com>
parents: 215
diff changeset
27 self.add_item(TitaniumMachete('machete'))
239
366c8fe16697 Fix reference to tin pipe.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 228
diff changeset
28 self.add_item(TinPipe('tin_pipe'))
297
4adb64d349bc Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents: 283
diff changeset
29 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
30 "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
31 (
4adb64d349bc Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents: 283
diff changeset
32 (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
33 (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
34 (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
35 (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
36 (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
37 (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
38 (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
39 (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
40 (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
41 (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
42 (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
43 (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
44 (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
45 (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
46 (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
47 (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
48 )))
4adb64d349bc Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents: 283
diff changeset
49 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
50 "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
51 ((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
52 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
53 "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
54 ((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
55 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
56 "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
57 ((593, 19, 74, 57),)))
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
58
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
59 def enter(self):
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
60 return Result("The machine room is dark and forbidding.")
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
61
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
62
242
12c4f87ea424 Unify doors a bit
Neil Muller <neil@dip.sun.ac.za>
parents: 239
diff changeset
63 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
64
252
dfc89bc64fdb Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents: 242
diff changeset
65 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
66
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
67 INTERACTS = {
262
5f58da9eeb52 Replace text interacts with doors.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 260
diff changeset
68 "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
69 }
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
70
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
71 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
72
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
73 # welder.slot: 249, 324, 167, 51
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
74 # welder.button: 406, 389, 28, 31
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
75 # welder.power lights: 201, 278, 16, 170
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
76 # manual: 434, 496, 66, 34
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
77
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
78 # broken power socket: 160, 28, 68, 51
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
79 # working power socket: 587, 23, 82, 50
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
80 # poster: 706, 157, 76, 158
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
81
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
82 # drill press block: 461, 446, 38, 27
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
83 # drill press:
297
4adb64d349bc Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents: 283
diff changeset
84 #Rect 0 :
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 # (519, 338, 36, 63),
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
86 # (545, 348, 93, 46),
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
87 # (599, 309, 41, 150),
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
88 # (588, 445, 66, 42),
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
89 # (616, 479, 41, 14),
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
90 # (527, 393, 15, 17),
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
91 # (510, 360, 13, 11),
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
92 # (532, 331, 14, 11),
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
93 # (605, 304, 26, 8),
47
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
94
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
95 class LaserWelder(Thing):
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
96
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
97 NAME = "machine.laser_welder"
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
98
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
99 INTERACTS = {
297
4adb64d349bc Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents: 283
diff changeset
100 "weld": InteractNoImage(241, 310, 178, 66),
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
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
103 INITIAL = "weld"
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
104
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
105 INITIAL_DATA = {
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
106 'cans_in_place': 0,
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
107 }
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
108
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
109 def interact_without(self):
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
110 if self.get_data('cans_in_place') < 1:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
111 return Result("The laser welder doesn't currently contain anything weldable.")
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
112 elif self.get_data('cans_in_place') < 3:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
113 return Result("You'll need more cans than that.")
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
114 else:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
115 self.set_data('cans_in_place', 0)
239
366c8fe16697 Fix reference to tin pipe.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 228
diff changeset
116 self.state.add_inventory_item('tin_pipe')
215
08f39251c6a5 Laser sound
Neil Muller <neil@dip.sun.ac.za>
parents: 206
diff changeset
117 return Result("With high-precision spitzensparken, the cans are welded into a replacement tube.",
08f39251c6a5 Laser sound
Neil Muller <neil@dip.sun.ac.za>
parents: 206
diff changeset
118 soundfile='laser.ogg')
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
119
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
120 def interact_with_empty_can(self, item):
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
121 starting_cans = self.get_data('cans_in_place')
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
122 if starting_cans < 3:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
123 self.state.remove_inventory_item(item.name)
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
124 self.set_data('cans_in_place', starting_cans + 1)
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
125 return Result({
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
126 0: "You carefully place the empty can in the area marked 'to weld'.",
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
127 1: "You carefully place the empty can next to the other.",
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
128 2: "You carefully place the empty can next to its mates.",
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
129 }[starting_cans])
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
130 else:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
131 return Result("The machine has enough cans to weld for the moment.")
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
132
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
133 def get_description(self):
193
738608e90e9c CloneableItem tweaks and a usable laser welder. zOMG!
Jeremy Thurgood <firxen@gmail.com>
parents: 190
diff changeset
134 if self.get_data('cans_in_place') == 0:
738608e90e9c CloneableItem tweaks and a usable laser welder. zOMG!
Jeremy Thurgood <firxen@gmail.com>
parents: 190
diff changeset
135 return "This is a Smith and Wesson 'zOMG' class high-precision laser welder."
738608e90e9c CloneableItem tweaks and a usable laser welder. zOMG!
Jeremy Thurgood <firxen@gmail.com>
parents: 190
diff changeset
136 msg = "The laser welder looks hungry, somehow."
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
137 if self.get_data('cans_in_place') == 1:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
138 msg += " It currently contains an empty can."
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
139 elif self.get_data('cans_in_place') == 2:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
140 msg += " It currently contains two empty cans."
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
141 elif self.get_data('cans_in_place') == 3:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
142 msg += " It currently contains three empty cans."
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
143 return msg
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
144
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
145
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
146 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
147
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
148 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
149
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
150 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
151 "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
152 }
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
153
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
154 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
155
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
156 def get_description(self):
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
157 return random.choice([
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
158 "The power lights pulse expectantly.",
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
159 ])
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
160
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
161
226
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
162 class TinPipe(Item):
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
163 "A pipe made out of welded-together tins."
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
164
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
165 INVENTORY_IMAGE = "tube_fragments.png"
302
6d93e04036c9 CursorSprite: Default pointer-position to the centre of the cursor
Stefano Rivera <stefano@rivera.za.net>
parents: 297
diff changeset
166 CURSOR = CursorSprite('tube_fragments_cursor.png')
226
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
167 TOOL_NAME = "pipe"
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
168
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
169
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
170 class Grinder(Thing):
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
171
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
172 NAME = "machine.grinder"
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
173
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
174 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
175 "grind": InteractNoImage(86, 402, 94, 63),
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
176 }
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
177
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
178 INITIAL = "grind"
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
179
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
180 def interact_without(self):
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
181 return Result("It looks like it eats fingers. Perhaps a different approach is in order?")
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
182
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
183 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
184 self.state.replace_inventory_item(item.name, 'machete')
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
185 return Result("After much delicate grinding and a few close calls with"
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
186 " 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
187 " 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
188 soundfile="grinder.ogg")
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
189
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
190 def get_description(self):
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
191 return "A pretty ordinary, albeit rather industrial, grinding machine."
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
192
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
193
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
194 class TitaniumMachete(Item):
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
195 "Titanium machete, formerly a leg."
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
196
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
197 INVENTORY_IMAGE = "triangle.png"
228
ce1e85768f7b Flavour interactions for mess hall
Neil Muller <neil@dip.sun.ac.za>
parents: 226
diff changeset
198 CURSOR = CursorSprite('titanium_femur_cursor.png', 20, 3)
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
199
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
200
47
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
201 SCENES = [Machine]