Mercurial > pyntnclick
comparison gamelib/scenes/machine.py @ 765:2f1952748cdb i18n
merge i18n and Russian translation
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Tue, 08 Mar 2011 14:37:43 +0200 |
parents | 0ce08d5e2acb a9925aaf5f61 |
children | 43b49f1de828 |
comparison
equal
deleted
inserted
replaced
528:0ce08d5e2acb | 765:2f1952748cdb |
---|---|
5 from gamelib.scenewidgets import (InteractNoImage, InteractImage, | 5 from gamelib.scenewidgets import (InteractNoImage, InteractImage, |
6 InteractAnimated, GenericDescThing) | 6 InteractAnimated, GenericDescThing) |
7 | 7 |
8 from gamelib.scenes.game_widgets import Door | 8 from gamelib.scenes.game_widgets import Door |
9 | 9 |
10 from gamelib.i18n import _ | |
10 | 11 |
11 class Machine(Scene): | 12 class Machine(Scene): |
12 | 13 |
13 FOLDER = "machine" | 14 FOLDER = "machine" |
14 BACKGROUND = "machine_room.png" | 15 BACKGROUND = "machine_room.png" |
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", # TODO: fix description | 73 _("The block for the laser drill press"), # TODO: fix description |
73 ((461, 446, 38, 27),))) | 74 ((461, 446, 38, 27),))) |
74 | 75 |
75 | 76 |
76 class ToMap(Door): | 77 class ToMap(Door): |
77 | 78 |
113 self.set_interact("tube") | 114 self.set_interact("tube") |
114 else: | 115 else: |
115 self.set_interact("can_and_tube") | 116 self.set_interact("can_and_tube") |
116 | 117 |
117 def interact_without(self): | 118 def interact_without(self): |
118 return Result("You really don't want to put your hand in there.") | 119 return Result(_("You really don't want to put your hand in there.")) |
119 | 120 |
120 def interact_with_empty_can(self, item): | 121 def interact_with_empty_can(self, item): |
121 contents = self.get_data('contents') | 122 contents = self.get_data('contents') |
122 if "can" in contents: | 123 if "can" in contents: |
123 return Result("There is already a can in the welder.") | 124 return Result(_("There is already a can in the welder.")) |
124 self.state.remove_inventory_item(item.name) | 125 self.state.remove_inventory_item(item.name) |
125 contents.add("can") | 126 contents.add("can") |
126 self.update_contents() | 127 self.update_contents() |
127 return Result("You carefully place the can in the laser welder.") | 128 return Result(_("You carefully place the can in the laser welder.")) |
128 | 129 |
129 def interact_with_tube_fragment(self, item): | 130 def interact_with_tube_fragment(self, item): |
130 contents = self.get_data('contents') | 131 contents = self.get_data('contents') |
131 if "tube" in contents: | 132 if "tube" in contents: |
132 return Result("There is already a tube fragment in the welder.") | 133 return Result(_("There is already a tube fragment in the welder.")) |
133 self.state.remove_inventory_item(item.name) | 134 self.state.remove_inventory_item(item.name) |
134 contents.add("tube") | 135 contents.add("tube") |
135 self.update_contents() | 136 self.update_contents() |
136 return Result("You carefully place the tube fragments in the laser welder.") | 137 return Result(_("You carefully place the tube fragments in the 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 laser welder." | 142 return _("This is a Smith and Wesson 'zOMG' class high-precision laser welder.") |
142 if len(contents) == 1: | 143 if len(contents) == 1: |
143 msg = "The laser welder looks hungry, somehow." | 144 msg = _("The laser welder looks hungry, somehow.") |
144 if "can" in contents: | 145 if "can" in contents: |
145 msg += " It currently contains an empty can." | 146 msg += _(" It currently contains an empty can.") |
146 elif "tube" in contents: | 147 elif "tube" in contents: |
147 msg += " It currently contains a tube fragment." | 148 msg += _(" It currently contains a tube fragment.") |
148 elif len(contents) == 2: | 149 elif len(contents) == 2: |
149 msg = "The laser welder looks expectant. " | 150 msg = _("The laser welder looks expectant. ") |
150 if "can" in contents and "tube" in contents: | 151 if "can" in contents and "tube" in contents: |
151 msg += " It currently contains an empty can and a tube fragment." | 152 msg += _(" It currently contains an empty can and a tube fragment.") |
152 return msg | 153 return msg |
153 | 154 |
154 | 155 |
155 class LaserWelderButton(Thing): | 156 class LaserWelderButton(Thing): |
156 | 157 |
163 INITIAL = "button" | 164 INITIAL = "button" |
164 | 165 |
165 def interact_without(self): | 166 def interact_without(self): |
166 contents = self.scene.things["machine.welder.slot"].get_data("contents") | 167 contents = self.scene.things["machine.welder.slot"].get_data("contents") |
167 if not contents: | 168 if not contents: |
168 return Result("The laser welder doesn't currently contain anything weldable.") | 169 return Result(_("The laser welder doesn't currently contain anything weldable.")) |
169 elif len(contents) == 1: | 170 elif len(contents) == 1: |
170 if "can" in contents: | 171 if "can" in contents: |
171 return Result("The laser welder needs something to weld the can to.") | 172 return Result(_("The laser welder needs something to weld the can to.")) |
172 elif "tube" in contents: | 173 elif "tube" in contents: |
173 return Result("The laser welder needs something to weld the tube fragments to.") | 174 return Result(_("The laser welder needs something to weld the tube fragments to.")) |
174 else: | 175 else: |
175 self.scene.things["machine.welder.slot"].set_data("contents", set()) | 176 self.scene.things["machine.welder.slot"].set_data("contents", set()) |
176 self.scene.things["machine.welder.slot"].update_contents() | 177 self.scene.things["machine.welder.slot"].update_contents() |
177 if self.state.items["cryo_pipes_one"] in self.state.inventory: | 178 if self.state.items["cryo_pipes_one"] in self.state.inventory: |
178 self.state.replace_inventory_item("cryo_pipes_one", "cryo_pipes_two") | 179 self.state.replace_inventory_item("cryo_pipes_one", "cryo_pipes_two") |
179 return Result("With high-precision spitzensparken, you weld" | 180 return Result(_("With high-precision spitzensparken, you weld" |
180 " together a second pipe. You bundle the two pipes together.", | 181 " together a second pipe. You bundle the two pipes together."), |
181 soundfile='laser.ogg') | 182 soundfile='laser.ogg') |
182 elif self.state.items["cryo_pipes_two"] in self.state.inventory: | 183 elif self.state.items["cryo_pipes_two"] in self.state.inventory: |
183 self.state.replace_inventory_item("cryo_pipes_two", "cryo_pipes_three") | 184 self.state.replace_inventory_item("cryo_pipes_two", "cryo_pipes_three") |
184 return Result("With high-precision spitzensparken, you create yet" | 185 return Result(_("With high-precision spitzensparken, you create yet" |
185 " another pipe. You store it with the other two.", | 186 " another pipe. You store it with the other two."), |
186 soundfile='laser.ogg') | 187 soundfile='laser.ogg') |
187 elif self.state.items["cryo_pipes_three"] in self.state.inventory: | 188 elif self.state.items["cryo_pipes_three"] in self.state.inventory: |
188 # just for safety | 189 # just for safety |
189 return None | 190 return None |
190 else: | 191 else: |
191 self.state.add_inventory_item("cryo_pipes_one") | 192 self.state.add_inventory_item("cryo_pipes_one") |
192 return Result("With high-precision spitzensparken, the can and tube are welded" | 193 return Result(_("With high-precision spitzensparken, the can and tube are welded" |
193 " into a whole greater than the sum of the parts.", | 194 " into a whole greater than the sum of the parts."), |
194 soundfile='laser.ogg') | 195 soundfile='laser.ogg') |
195 | 196 |
196 | 197 |
197 class LaserWelderPowerLights(Thing): | 198 class LaserWelderPowerLights(Thing): |
198 | 199 |
203 } | 204 } |
204 | 205 |
205 INITIAL = 'lights' | 206 INITIAL = 'lights' |
206 | 207 |
207 def get_description(self): | 208 def get_description(self): |
208 return "The power lights pulse expectantly." | 209 return _("The power lights pulse expectantly.") |
209 | 210 |
210 | 211 |
211 class CryoPipesOne(Item): | 212 class CryoPipesOne(Item): |
212 "A single cryo pipe (made from a tube fragment and can)." | 213 "A single cryo pipe (made from a tube fragment and can)." |
213 | 214 |
241 } | 242 } |
242 | 243 |
243 INITIAL = "grind" | 244 INITIAL = "grind" |
244 | 245 |
245 def interact_without(self): | 246 def interact_without(self): |
246 return Result("It looks like it eats fingers. Perhaps a different approach is in order?") | 247 return Result(_("It looks like it eats fingers. Perhaps a different approach is in order?")) |
247 | 248 |
248 def interact_with_titanium_leg(self, item): | 249 def interact_with_titanium_leg(self, item): |
249 self.state.replace_inventory_item(item.name, 'machete') | 250 self.state.replace_inventory_item(item.name, 'machete') |
250 return Result("After much delicate grinding and a few close calls with" | 251 return Result(_("After much delicate grinding and a few close calls with" |
251 " various body parts, the titanium femur now resembles" | 252 " various body parts, the titanium femur now resembles" |
252 " a machete more than a bone. Nice and sharp, too.", | 253 " a machete more than a bone. Nice and sharp, too."), |
253 soundfile="grinder.ogg") | 254 soundfile="grinder.ogg") |
254 | 255 |
255 def get_description(self): | 256 def get_description(self): |
256 return "A pretty ordinary, albeit rather industrial, grinding machine." | 257 return _("A pretty ordinary, albeit rather industrial, grinding machine.") |
257 | 258 |
258 | 259 |
259 class TitaniumMachete(Item): | 260 class TitaniumMachete(Item): |
260 "Titanium machete, formerly a leg." | 261 "Titanium machete, formerly a leg." |
261 | 262 |
274 INITIAL = "manual" | 275 INITIAL = "manual" |
275 | 276 |
276 def interact_without(self): | 277 def interact_without(self): |
277 self.scene.remove_thing(self) | 278 self.scene.remove_thing(self) |
278 self.state.add_inventory_item("manual") | 279 self.state.add_inventory_item("manual") |
279 return Result("Ah! The ship's instruction manual. You'd feel better" | 280 return Result(_("Ah! The ship's instruction manual. You'd feel better" |
280 " if the previous owner wasn't lying next to it with a" | 281 " if the previous owner wasn't lying next to it with a" |
281 " gaping hole in his rib cage.") | 282 " gaping hole in his rib cage.")) |
282 | 283 |
283 | 284 |
284 class Manual(Item): | 285 class Manual(Item): |
285 "A ship instruction manual." | 286 "A ship instruction manual." |
286 | 287 |