comparison 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
comparison
equal deleted inserted replaced
316:4a7aa7fcd191 317:3d1a5c0c362a
19 } 19 }
20 20
21 def __init__(self, state): 21 def __init__(self, state):
22 super(Machine, self).__init__(state) 22 super(Machine, self).__init__(state)
23 self.add_thing(ToMap()) 23 self.add_thing(ToMap())
24 self.add_thing(LaserWelder()) 24 self.add_thing(LaserWelderSlot())
25 self.add_thing(LaserWelderButton())
25 self.add_thing(LaserWelderPowerLights()) 26 self.add_thing(LaserWelderPowerLights())
26 self.add_thing(Grinder()) 27 self.add_thing(Grinder())
28 self.add_thing(ManualThing())
27 self.add_item(TitaniumMachete('machete')) 29 self.add_item(TitaniumMachete('machete'))
28 self.add_item(TinPipe('tin_pipe')) 30 self.add_item(TinPipe('tin_pipe'))
31 self.add_item(Manual('manual'))
29 self.add_thing(GenericDescThing('machine.wires', 2, 32 self.add_thing(GenericDescThing('machine.wires', 2,
30 "Wires run to all the machines in the room", 33 "Wires run to all the machines in the room",
31 ( 34 (
32 (250, 172, 252, 12), 35 (250, 172, 252, 12),
33 (388, 183, 114, 13), 36 (388, 183, 114, 13),
53 "The cables to this power point have been cut", 56 "The cables to this power point have been cut",
54 ((155, 22, 92, 74),))) 57 ((155, 22, 92, 74),)))
55 self.add_thing(GenericDescThing("machine.powerpoint", 5, 58 self.add_thing(GenericDescThing("machine.powerpoint", 5,
56 "All the machines run off this powerpoint", 59 "All the machines run off this powerpoint",
57 ((593, 19, 74, 57),))) 60 ((593, 19, 74, 57),)))
61 self.add_thing(GenericDescThing("machine.drill_press", 6,
62 "An impressive looking laser drill press",
63 (
64 (519, 338, 36, 63),
65 (545, 348, 93, 46),
66 (599, 309, 41, 150),
67 (588, 445, 66, 42),
68 (616, 479, 41, 14),
69 (527, 393, 15, 17),
70 (510, 360, 13, 11),
71 (532, 331, 14, 11),
72 (605, 304, 26, 8),
73 )))
74 self.add_thing(GenericDescThing("machine.drill_press_block", 7,
75 "The block for the laser drill press", # TODO: fix description
76 ((461, 446, 38, 27),)))
58 77
59 def enter(self): 78 def enter(self):
60 return Result("The machine room is dark and forbidding.") 79 return Result("The machine room is dark and forbidding.")
61 80
62 81
68 "door": InteractNoImage(695, 350, 97, 212), 87 "door": InteractNoImage(695, 350, 97, 212),
69 } 88 }
70 89
71 INITIAL = "door" 90 INITIAL = "door"
72 91
73 # welder.slot: 249, 324, 167, 51 92
74 # welder.button: 406, 389, 28, 31 93 class LaserWelderSlot(Thing):
75 # welder.power lights: 201, 278, 16, 170 94
76 # manual: 434, 496, 66, 34 95 NAME = "machine.welder.slot"
77
78 # broken power socket: 160, 28, 68, 51
79 # working power socket: 587, 23, 82, 50
80 # poster: 706, 157, 76, 158
81
82 # drill press block: 461, 446, 38, 27
83 # drill press:
84 #Rect 0 :
85 # (519, 338, 36, 63),
86 # (545, 348, 93, 46),
87 # (599, 309, 41, 150),
88 # (588, 445, 66, 42),
89 # (616, 479, 41, 14),
90 # (527, 393, 15, 17),
91 # (510, 360, 13, 11),
92 # (532, 331, 14, 11),
93 # (605, 304, 26, 8),
94
95 class LaserWelder(Thing):
96
97 NAME = "machine.laser_welder"
98 96
99 INTERACTS = { 97 INTERACTS = {
100 "weld": InteractNoImage(241, 310, 178, 66), 98 "weld": InteractNoImage(241, 310, 178, 66),
101 } 99 }
102 100
105 INITIAL_DATA = { 103 INITIAL_DATA = {
106 'cans_in_place': 0, 104 'cans_in_place': 0,
107 } 105 }
108 106
109 def interact_without(self): 107 def interact_without(self):
110 if self.get_data('cans_in_place') < 1: 108 return Result("You really don't want to but your hand in there.")
111 return Result("The laser welder doesn't currently contain anything weldable.")
112 elif self.get_data('cans_in_place') < 3:
113 return Result("You'll need more cans than that.")
114 else:
115 self.set_data('cans_in_place', 0)
116 self.state.add_inventory_item('tin_pipe')
117 return Result("With high-precision spitzensparken, the cans are welded into a replacement tube.",
118 soundfile='laser.ogg')
119 109
120 def interact_with_empty_can(self, item): 110 def interact_with_empty_can(self, item):
121 starting_cans = self.get_data('cans_in_place') 111 starting_cans = self.get_data('cans_in_place')
122 if starting_cans < 3: 112 if starting_cans < 3:
123 self.state.remove_inventory_item(item.name) 113 self.state.remove_inventory_item(item.name)
141 elif self.get_data('cans_in_place') == 3: 131 elif self.get_data('cans_in_place') == 3:
142 msg += " It currently contains three empty cans." 132 msg += " It currently contains three empty cans."
143 return msg 133 return msg
144 134
145 135
136 class LaserWelderButton(Thing):
137
138 NAME = "machine.welder.button"
139
140 INTERACTS = {
141 "button": InteractNoImage(406, 389, 28, 31),
142 }
143
144 INITIAL = "button"
145
146 def interact_without(self):
147 cans_in_place = self.scene.things["machine.welder.slot"].get_data("cans_in_place")
148 if cans_in_place < 1:
149 return Result("The laser welder doesn't currently contain anything weldable.")
150 elif cans_in_place < 3:
151 return Result("You'll need more cans than that.")
152 else:
153 self.scene.things["machine.welder.slot"].set_data("cans_in_place", 0)
154 self.state.add_inventory_item('tin_pipe')
155 return Result("With high-precision spitzensparken, the cans are welded into a replacement tube.",
156 soundfile='laser.ogg')
157
158
146 class LaserWelderPowerLights(Thing): 159 class LaserWelderPowerLights(Thing):
147 160
148 NAME = "machine.welder.lights" 161 NAME = "machine.welder.lights"
149 162
150 INTERACTS = { 163 INTERACTS = {
196 209
197 INVENTORY_IMAGE = "machete.png" 210 INVENTORY_IMAGE = "machete.png"
198 CURSOR = CursorSprite('machete_cursor.png', 23, 1) 211 CURSOR = CursorSprite('machete_cursor.png', 23, 1)
199 212
200 213
214 class ManualThing(Thing):
215
216 NAME = "machine.manual"
217
218 INTERACTS = {
219 "manual": InteractNoImage(434, 496, 66, 34), # TODO: replace with manual
220 "empty": InteractNoImage(434, 496, 66, 34),
221 }
222
223 INITIAL = "manual"
224
225 def interact_without(self):
226 if self.current_interact is self.interacts["manual"]:
227 self.state.add_inventory_item("manual")
228 self.set_interact("empty")
229 return Result("Ah! The ship's instruction manual. You'd feel better"
230 " if the previous owner wasn't lying next to it with a"
231 " gaping hole in his rib cage.")
232
233
234 class Manual(Item):
235 "A ship instruction manual."
236
237 INVENTORY_IMAGE = "manual.png"
238 CURSOR = CursorSprite('traingle.png', 23, 1) # TODO: replace with manual_cursor.png
239
240
201 SCENES = [Machine] 241 SCENES = [Machine]