comparison gamelib/scenes/machine.py @ 770:a35f5364437d pyntnclick

Merge i18n
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 26 Jan 2013 17:00:43 +0200
parents a8510f4e2ea1 43b49f1de828
children bdaffaa8b6bf
comparison
equal deleted inserted replaced
764:a8510f4e2ea1 770:a35f5364437d
1 """Machine room where tools and machines are found.""" 1 """Machine room where tools and machines are found."""
2 2
3 from pyntnclick.i18n import _
3 from pyntnclick.state import Scene, Item, Thing, Result 4 from pyntnclick.state import Scene, Item, Thing, Result
4 from pyntnclick.cursor import CursorSprite 5 from pyntnclick.cursor import CursorSprite
5 from pyntnclick.scenewidgets import ( 6 from pyntnclick.scenewidgets import (
6 InteractNoImage, InteractImage, InteractAnimated, GenericDescThing, 7 InteractNoImage, InteractImage, InteractAnimated, GenericDescThing,
7 TakeableThing) 8 TakeableThing)
25 self.add_item(CryoPipesOne('cryo_pipes_one')) 26 self.add_item(CryoPipesOne('cryo_pipes_one'))
26 self.add_item(CryoPipesTwo('cryo_pipes_two')) 27 self.add_item(CryoPipesTwo('cryo_pipes_two'))
27 self.add_item(CryoPipesThree('cryo_pipes_three')) 28 self.add_item(CryoPipesThree('cryo_pipes_three'))
28 self.add_item(Manual('manual')) 29 self.add_item(Manual('manual'))
29 self.add_thing(GenericDescThing('machine.wires', 2, 30 self.add_thing(GenericDescThing('machine.wires', 2,
30 "Wires run to all the machines in the room", 31 _("Wires run to all the machines in the room"),
31 ( 32 (
32 (250, 172, 252, 12), 33 (250, 172, 252, 12),
33 (388, 183, 114, 13), 34 (388, 183, 114, 13),
34 (496, 112, 36, 64), 35 (496, 112, 36, 64),
35 (533, 85, 19, 45), 36 (533, 85, 19, 45),
45 (574, 39, 16, 48), 46 (574, 39, 16, 48),
46 (648, 85, 22, 26), 47 (648, 85, 22, 26),
47 (674, 54, 23, 36), 48 (674, 54, 23, 36),
48 ))) 49 )))
49 self.add_thing(GenericDescThing('machine.diagram', 3, 50 self.add_thing(GenericDescThing('machine.diagram', 3,
50 "A wiring diagram of some sort", 51 _("A wiring diagram of some sort"),
51 ((694, 140, 94, 185),))) 52 ((694, 140, 94, 185),)))
52 self.add_thing(GenericDescThing('machine.powerpoint', 4, 53 self.add_thing(GenericDescThing('machine.powerpoint', 4,
53 "The cables to this power point have been cut", 54 _("The cables to this power point have been cut"),
54 ((155, 22, 92, 74),))) 55 ((155, 22, 92, 74),)))
55 self.add_thing(GenericDescThing("machine.powerpoint", 5, 56 self.add_thing(GenericDescThing("machine.powerpoint", 5,
56 "All the machines run off this powerpoint", 57 _("All the machines run off this powerpoint"),
57 ((593, 19, 74, 57),))) 58 ((593, 19, 74, 57),)))
58 self.add_thing(GenericDescThing("machine.drill_press", 6, 59 self.add_thing(GenericDescThing("machine.drill_press", 6,
59 "An impressive looking laser drill press", 60 _("An impressive looking laser drill press"),
60 ( 61 (
61 (519, 338, 36, 63), 62 (519, 338, 36, 63),
62 (545, 348, 93, 46), 63 (545, 348, 93, 46),
63 (599, 309, 41, 150), 64 (599, 309, 41, 150),
64 (588, 445, 66, 42), 65 (588, 445, 66, 42),
67 (510, 360, 13, 11), 68 (510, 360, 13, 11),
68 (532, 331, 14, 11), 69 (532, 331, 14, 11),
69 (605, 304, 26, 8), 70 (605, 304, 26, 8),
70 ))) 71 )))
71 self.add_thing(GenericDescThing("machine.drill_press_block", 7, 72 self.add_thing(GenericDescThing("machine.drill_press_block", 7,
72 "The block for the laser drill press", 73 _("The block for the laser drill press"),
73 ((461, 446, 38, 27),))) 74 ((461, 446, 38, 27),)))
74 75
75 76
76 class ToMap(Door): 77 class ToMap(Door):
77 78
112 return "tube" 113 return "tube"
113 else: 114 else:
114 return "can_and_tube" 115 return "can_and_tube"
115 116
116 def interact_without(self): 117 def interact_without(self):
117 return Result("You really don't want to put your hand in there.") 118 return Result(_("You really don't want to put your hand in there."))
118 119
119 def interact_with_empty_can(self, item): 120 def interact_with_empty_can(self, item):
120 contents = self.get_data('contents') 121 contents = self.get_data('contents')
121 if "can" in contents: 122 if "can" in contents:
122 return Result("There is already a can in the welder.") 123 return Result(_("There is already a can in the welder."))
123 self.game.remove_inventory_item(item.name) 124 self.game.remove_inventory_item(item.name)
124 contents.add("can") 125 contents.add("can")
125 self.set_interact() 126 self.set_interact()
126 return Result("You carefully place the can in the laser welder.") 127 return Result(_("You carefully place the can in the laser welder."))
127 128
128 def interact_with_tube_fragment(self, item): 129 def interact_with_tube_fragment(self, item):
129 contents = self.get_data('contents') 130 contents = self.get_data('contents')
130 if "tube" in contents: 131 if "tube" in contents:
131 return Result("There is already a tube fragment in the welder.") 132 return Result(_("There is already a tube fragment in the welder."))
132 self.game.remove_inventory_item(item.name) 133 self.game.remove_inventory_item(item.name)
133 contents.add("tube") 134 contents.add("tube")
134 self.set_interact() 135 self.set_interact()
135 return Result("You carefully place the tube fragments in the" 136 return Result(_("You carefully place the tube fragments in the"
136 " laser welder.") 137 " laser welder."))
137 138
138 def get_description(self): 139 def get_description(self):
139 contents = self.get_data('contents') 140 contents = self.get_data('contents')
140 if not contents: 141 if not contents:
141 return ("This is a Smith and Wesson 'zOMG' class high-precision" 142 return (_("This is a Smith and Wesson 'zOMG' class high-precision"
142 " laser welder.") 143 " laser welder."))
143 if len(contents) == 1: 144 if len(contents) == 1:
144 msg = "The laser welder looks hungry, somehow." 145 msg = _("The laser welder looks hungry, somehow.")
145 if "can" in contents: 146 if "can" in contents:
146 msg += " It currently contains an empty can." 147 msg += _(" It currently contains an empty can.")
147 elif "tube" in contents: 148 elif "tube" in contents:
148 msg += " It currently contains a tube fragment." 149 msg += _(" It currently contains a tube fragment.")
149 elif len(contents) == 2: 150 elif len(contents) == 2:
150 msg = "The laser welder looks expectant. " 151 msg = _("The laser welder looks expectant. ")
151 if "can" in contents and "tube" in contents: 152 if "can" in contents and "tube" in contents:
152 msg += (" It currently contains an empty can and a" 153 msg += _(" It currently contains an empty can and a"
153 " tube fragment.") 154 " tube fragment.")
154 return msg 155 return msg
155 156
156 157
157 class LaserWelderButton(Thing): 158 class LaserWelderButton(Thing):
158 159
166 167
167 def interact_without(self): 168 def interact_without(self):
168 welder_slot = self.scene.things["machine.welder.slot"] 169 welder_slot = self.scene.things["machine.welder.slot"]
169 contents = welder_slot.get_data("contents") 170 contents = welder_slot.get_data("contents")
170 if not contents: 171 if not contents:
171 return Result("The laser welder doesn't currently contain" 172 return Result(_("The laser welder doesn't currently contain"
172 " anything weldable.") 173 " anything weldable."))
173 elif len(contents) == 1: 174 elif len(contents) == 1:
174 if "can" in contents: 175 if "can" in contents:
175 return Result("The laser welder needs something to weld the" 176 return Result(_("The laser welder needs something to weld the"
176 " can to.") 177 " can to."))
177 elif "tube" in contents: 178 elif "tube" in contents:
178 return Result("The laser welder needs something to weld the" 179 return Result(_("The laser welder needs something to weld the"
179 " tube fragments to.") 180 " tube fragments to."))
180 else: 181 else:
181 welder_slot.set_data("contents", set()) 182 welder_slot.set_data("contents", set())
182 welder_slot.set_interact() 183 welder_slot.set_interact()
183 if self.game.is_in_inventory("cryo_pipes_one"): 184 if self.game.is_in_inventory("cryo_pipes_one"):
184 self.game.replace_inventory_item("cryo_pipes_one", 185 self.game.replace_inventory_item("cryo_pipes_one",
185 "cryo_pipes_two") 186 "cryo_pipes_two")
186 return Result("With high-precision spitzensparken, you weld" 187 return Result(_("With high-precision spitzensparken, you weld"
187 " together a second pipe. You bundle the two" 188 " together a second pipe. You bundle the two"
188 " pipes together.", 189 " pipes together."), soundfile='laser.ogg')
189 soundfile='laser.ogg')
190 elif self.game.is_in_inventory("cryo_pipes_two"): 190 elif self.game.is_in_inventory("cryo_pipes_two"):
191 self.game.replace_inventory_item("cryo_pipes_two", 191 self.game.replace_inventory_item("cryo_pipes_two",
192 "cryo_pipes_three") 192 "cryo_pipes_three")
193 return Result("With high-precision spitzensparken, you create" 193 return Result(_("With high-precision spitzensparken, you"
194 " yet another pipe. You store it with the other" 194 " create yet another pipe. You store it with"
195 " two.", 195 " the other two."), soundfile='laser.ogg')
196 soundfile='laser.ogg')
197 elif self.game.is_in_inventory("cryo_pipes_three"): 196 elif self.game.is_in_inventory("cryo_pipes_three"):
198 # just for safety 197 # just for safety
199 return None 198 return None
200 else: 199 else:
201 self.game.add_inventory_item("cryo_pipes_one") 200 self.game.add_inventory_item("cryo_pipes_one")
202 return Result("With high-precision spitzensparken, the can and" 201 return Result(_("With high-precision spitzensparken, the can"
203 " tube are welded into a whole greater than the" 202 " and tube are welded into a whole greater"
204 " sum of the parts.", 203 " than the sum of the parts."),
205 soundfile='laser.ogg') 204 soundfile='laser.ogg')
206 205
207 206
208 class LaserWelderPowerLights(Thing): 207 class LaserWelderPowerLights(Thing):
209 208
210 NAME = "machine.welder.lights" 209 NAME = "machine.welder.lights"
216 } 215 }
217 216
218 INITIAL = 'lights' 217 INITIAL = 'lights'
219 218
220 def get_description(self): 219 def get_description(self):
221 return "The power lights pulse expectantly." 220 return _("The power lights pulse expectantly.")
222 221
223 222
224 class CryoPipesOne(Item): 223 class CryoPipesOne(Item):
225 "A single cryo pipe (made from a tube fragment and can)." 224 "A single cryo pipe (made from a tube fragment and can)."
226 225
254 } 253 }
255 254
256 INITIAL = "grind" 255 INITIAL = "grind"
257 256
258 def interact_without(self): 257 def interact_without(self):
259 return Result("It looks like it eats fingers. Perhaps a different" 258 return Result(_("It looks like it eats fingers. Perhaps a different"
260 " approach is in order?") 259 " approach is in order?"))
261 260
262 def interact_with_titanium_leg(self, item): 261 def interact_with_titanium_leg(self, item):
263 self.game.replace_inventory_item(item.name, 'machete') 262 self.game.replace_inventory_item(item.name, 'machete')
264 return Result("After much delicate grinding and a few close calls with" 263 return Result(_("After much delicate grinding and a few close calls"
265 " various body parts, the titanium femur now resembles" 264 " with various body parts, the titanium femur now"
266 " a machete more than a bone. Nice and sharp, too.", 265 " resembles a machete more than a bone. Nice and"
267 soundfile="grinder.ogg") 266 " sharp, too."), soundfile="grinder.ogg")
268 267
269 def get_description(self): 268 def get_description(self):
270 return "A pretty ordinary, albeit rather industrial, grinding machine." 269 return _("A pretty ordinary, albeit rather industrial, grinding"
270 " machine.")
271 271
272 272
273 class TitaniumMachete(Item): 273 class TitaniumMachete(Item):
274 "Titanium machete, formerly a leg." 274 "Titanium machete, formerly a leg."
275 275
288 INITIAL = "manual" 288 INITIAL = "manual"
289 ITEM = 'manual' 289 ITEM = 'manual'
290 290
291 def interact_without(self): 291 def interact_without(self):
292 self.take() 292 self.take()
293 return Result("Ah! The ship's instruction manual. You'd feel better" 293 return Result(_("Ah! The ship's instruction manual. You'd feel better"
294 " if the previous owner wasn't lying next to it with a" 294 " if the previous owner wasn't lying next to it with a"
295 " gaping hole in his rib cage.") 295 " gaping hole in his rib cage."))
296 296
297 297
298 class Manual(Item): 298 class Manual(Item):
299 "A ship instruction manual." 299 "A ship instruction manual."
300 300