annotate gamelib/scenes/machine.py @ 317:3d1a5c0c362a

Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
author Simon Cross <hodgestar+bzr@gmail.com>
date Sat, 28 Aug 2010 12:38:28 +0200
parents 5031b84fbb4c
children 0bb1ab329bee
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())
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
24 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
25 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
26 self.add_thing(LaserWelderPowerLights())
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
27 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
28 self.add_thing(ManualThing())
219
326300c218a6 Choppable cryopipes and can refactoring.
Jeremy Thurgood <firxen@gmail.com>
parents: 215
diff changeset
29 self.add_item(TitaniumMachete('machete'))
239
366c8fe16697 Fix reference to tin pipe.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 228
diff changeset
30 self.add_item(TinPipe('tin_pipe'))
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
31 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
32 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
33 "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
34 (
4adb64d349bc Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents: 283
diff changeset
35 (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
36 (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
37 (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
38 (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
39 (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
40 (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
41 (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
42 (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
43 (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
44 (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
45 (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
46 (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
47 (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
48 (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
49 (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
50 (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
51 )))
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.diagram', 3,
4adb64d349bc Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents: 283
diff changeset
53 "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
54 ((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
55 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
56 "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
57 ((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
58 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
59 "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
60 ((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
61 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
62 "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
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
64 (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
65 (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
66 (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
67 (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
68 (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
69 (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
70 (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
71 (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
72 (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
73 )))
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
74 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
75 "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
76 ((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
77
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 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
79 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
80
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
242
12c4f87ea424 Unify doors a bit
Neil Muller <neil@dip.sun.ac.za>
parents: 239
diff changeset
82 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
83
252
dfc89bc64fdb Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents: 242
diff changeset
84 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
85
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
86 INTERACTS = {
262
5f58da9eeb52 Replace text interacts with doors.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 260
diff changeset
87 "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
88 }
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
89
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
90 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
91
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
92
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
93 class LaserWelderSlot(Thing):
47
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
94
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
95 NAME = "machine.welder.slot"
190
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 INTERACTS = {
297
4adb64d349bc Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents: 283
diff changeset
98 "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
99 }
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
100
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
101 INITIAL = "weld"
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_DATA = {
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
104 'cans_in_place': 0,
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
105 }
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
106
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
107 def interact_without(self):
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
108 return Result("You really don't want to but your hand in there.")
190
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
109
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
110 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
111 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
112 if starting_cans < 3:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
113 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
114 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
115 return Result({
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
116 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
117 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
118 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
119 }[starting_cans])
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
120 else:
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
121 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
122
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
123 def get_description(self):
193
738608e90e9c CloneableItem tweaks and a usable laser welder. zOMG!
Jeremy Thurgood <firxen@gmail.com>
parents: 190
diff changeset
124 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
125 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
126 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
127 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
128 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
129 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
130 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
131 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
132 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
133 return msg
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
134
30f2308c1efc Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents: 151
diff changeset
135
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
136 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
137
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
138 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
139
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
140 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
141 "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
142 }
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
143
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
144 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
145
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
146 def interact_without(self):
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
147 cans_in_place = self.scene.things["machine.welder.slot"].get_data("cans_in_place")
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
148 if cans_in_place < 1:
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
149 return Result("The laser welder doesn't currently contain anything weldable.")
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
150 elif cans_in_place < 3:
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
151 return Result("You'll need more cans than that.")
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
152 else:
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
153 self.scene.things["machine.welder.slot"].set_data("cans_in_place", 0)
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 self.state.add_inventory_item('tin_pipe')
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 return Result("With high-precision spitzensparken, the cans are welded into a replacement tube.",
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 soundfile='laser.ogg')
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
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
159 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
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 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
162
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
163 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
164 "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
165 }
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
166
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
167 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
168
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
169 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
170 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
171 "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
172 ])
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
173
eb3cfcaff469 Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 263
diff changeset
174
226
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
175 class TinPipe(Item):
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
176 "A pipe made out of welded-together tins."
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
177
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
178 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
179 CURSOR = CursorSprite('tube_fragments_cursor.png')
226
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
180 TOOL_NAME = "pipe"
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
181
a5325919342e Tubes, pipes and ducts.
Jeremy Thurgood <firxen@gmail.com>
parents: 219
diff changeset
182
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
183 class Grinder(Thing):
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
184
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
185 NAME = "machine.grinder"
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
186
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
187 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
188 "grind": InteractNoImage(86, 402, 94, 63),
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
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
191 INITIAL = "grind"
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 def interact_without(self):
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
194 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
195
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
196 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
197 self.state.replace_inventory_item(item.name, 'machete')
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
198 return Result("After much delicate grinding and a few close calls with"
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
199 " 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
200 " 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
201 soundfile="grinder.ogg")
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
202
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
203 def get_description(self):
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
204 return "A pretty ordinary, albeit rather industrial, grinding machine."
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
205
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
206
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
207 class TitaniumMachete(Item):
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
208 "Titanium machete, formerly a leg."
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
209
307
5031b84fbb4c Hook up new machete, can_opener, and titanium_femur images
Stefano Rivera <stefano@rivera.za.net>
parents: 306
diff changeset
210 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
211 CURSOR = CursorSprite('machete_cursor.png', 23, 1)
194
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
212
9887c68110d8 Sharp things.
Jeremy Thurgood <firxen@gmail.com>
parents: 193
diff changeset
213
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
214 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
215
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
216 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
217
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
218 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
219 "manual": InteractNoImage(434, 496, 66, 34), # TODO: replace with 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
220 "empty": InteractNoImage(434, 496, 66, 34),
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
221 }
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
222
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
223 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
224
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
225 def interact_without(self):
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
226 if self.current_interact is self.interacts["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
227 self.state.add_inventory_item("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
228 self.set_interact("empty")
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
229 return Result("Ah! The ship's instruction manual. You'd feel better"
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
230 " if the previous owner wasn't lying next to it with a"
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
231 " gaping hole in his rib cage.")
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
232
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
233
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
234 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
235 "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
236
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
237 INVENTORY_IMAGE = "manual.png"
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
238 CURSOR = CursorSprite('traingle.png', 23, 1) # TODO: replace with manual_cursor.png
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
239
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
240
47
8f1fccb8cadf Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff changeset
241 SCENES = [Machine]