Mercurial > boomslang
comparison gamelib/scenes/machine.py @ 478:a9925aaf5f61 1.0.1
i18n and Russian translation
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Tue, 08 Mar 2011 12:29:14 +0200 |
parents | af2a23b9787d |
children | 2f1952748cdb |
comparison
equal
deleted
inserted
replaced
477:51055400a9a8 | 478:a9925aaf5f61 |
---|---|
4 from gamelib.cursor import CursorSprite | 4 from gamelib.cursor import CursorSprite |
5 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage, | 5 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage, |
6 InteractRectUnion, InteractImage, | 6 InteractRectUnion, InteractImage, |
7 InteractAnimated, GenericDescThing) | 7 InteractAnimated, GenericDescThing) |
8 | 8 |
9 from gamelib.i18n import _ | |
9 | 10 |
10 class Machine(Scene): | 11 class Machine(Scene): |
11 | 12 |
12 FOLDER = "machine" | 13 FOLDER = "machine" |
13 BACKGROUND = "machine_room.png" | 14 BACKGROUND = "machine_room.png" |
24 self.add_item(CryoPipesOne('cryo_pipes_one')) | 25 self.add_item(CryoPipesOne('cryo_pipes_one')) |
25 self.add_item(CryoPipesTwo('cryo_pipes_two')) | 26 self.add_item(CryoPipesTwo('cryo_pipes_two')) |
26 self.add_item(CryoPipesThree('cryo_pipes_three')) | 27 self.add_item(CryoPipesThree('cryo_pipes_three')) |
27 self.add_item(Manual('manual')) | 28 self.add_item(Manual('manual')) |
28 self.add_thing(GenericDescThing('machine.wires', 2, | 29 self.add_thing(GenericDescThing('machine.wires', 2, |
29 "Wires run to all the machines in the room", | 30 _("Wires run to all the machines in the room"), |
30 ( | 31 ( |
31 (250, 172, 252, 12), | 32 (250, 172, 252, 12), |
32 (388, 183, 114, 13), | 33 (388, 183, 114, 13), |
33 (496, 112, 36, 64), | 34 (496, 112, 36, 64), |
34 (533, 85, 19, 45), | 35 (533, 85, 19, 45), |
44 (574, 39, 16, 48), | 45 (574, 39, 16, 48), |
45 (648, 85, 22, 26), | 46 (648, 85, 22, 26), |
46 (674, 54, 23, 36), | 47 (674, 54, 23, 36), |
47 ))) | 48 ))) |
48 self.add_thing(GenericDescThing('machine.diagram', 3, | 49 self.add_thing(GenericDescThing('machine.diagram', 3, |
49 "A wiring diagram of some sort", | 50 _("A wiring diagram of some sort"), |
50 ((694, 140, 94, 185),))) | 51 ((694, 140, 94, 185),))) |
51 self.add_thing(GenericDescThing('machine.powerpoint', 4, | 52 self.add_thing(GenericDescThing('machine.powerpoint', 4, |
52 "The cables to this power point have been cut", | 53 _("The cables to this power point have been cut"), |
53 ((155, 22, 92, 74),))) | 54 ((155, 22, 92, 74),))) |
54 self.add_thing(GenericDescThing("machine.powerpoint", 5, | 55 self.add_thing(GenericDescThing("machine.powerpoint", 5, |
55 "All the machines run off this powerpoint", | 56 _("All the machines run off this powerpoint"), |
56 ((593, 19, 74, 57),))) | 57 ((593, 19, 74, 57),))) |
57 self.add_thing(GenericDescThing("machine.drill_press", 6, | 58 self.add_thing(GenericDescThing("machine.drill_press", 6, |
58 "An impressive looking laser drill press", | 59 _("An impressive looking laser drill press"), |
59 ( | 60 ( |
60 (519, 338, 36, 63), | 61 (519, 338, 36, 63), |
61 (545, 348, 93, 46), | 62 (545, 348, 93, 46), |
62 (599, 309, 41, 150), | 63 (599, 309, 41, 150), |
63 (588, 445, 66, 42), | 64 (588, 445, 66, 42), |
66 (510, 360, 13, 11), | 67 (510, 360, 13, 11), |
67 (532, 331, 14, 11), | 68 (532, 331, 14, 11), |
68 (605, 304, 26, 8), | 69 (605, 304, 26, 8), |
69 ))) | 70 ))) |
70 self.add_thing(GenericDescThing("machine.drill_press_block", 7, | 71 self.add_thing(GenericDescThing("machine.drill_press_block", 7, |
71 "The block for the laser drill press", # TODO: fix description | 72 _("The block for the laser drill press"), # TODO: fix description |
72 ((461, 446, 38, 27),))) | 73 ((461, 446, 38, 27),))) |
73 | 74 |
74 | 75 |
75 class ToMap(Door): | 76 class ToMap(Door): |
76 | 77 |
112 self.set_interact("tube") | 113 self.set_interact("tube") |
113 else: | 114 else: |
114 self.set_interact("can_and_tube") | 115 self.set_interact("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.state.remove_inventory_item(item.name) | 124 self.state.remove_inventory_item(item.name) |
124 contents.add("can") | 125 contents.add("can") |
125 self.update_contents() | 126 self.update_contents() |
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.state.remove_inventory_item(item.name) | 133 self.state.remove_inventory_item(item.name) |
133 contents.add("tube") | 134 contents.add("tube") |
134 self.update_contents() | 135 self.update_contents() |
135 return Result("You carefully place the tube fragments in the laser welder.") | 136 return Result(_("You carefully place the tube fragments in the laser welder.")) |
136 | 137 |
137 def get_description(self): | 138 def get_description(self): |
138 contents = self.get_data('contents') | 139 contents = self.get_data('contents') |
139 if not contents: | 140 if not contents: |
140 return "This is a Smith and Wesson 'zOMG' class high-precision laser welder." | 141 return _("This is a Smith and Wesson 'zOMG' class high-precision laser welder.") |
141 if len(contents) == 1: | 142 if len(contents) == 1: |
142 msg = "The laser welder looks hungry, somehow." | 143 msg = _("The laser welder looks hungry, somehow.") |
143 if "can" in contents: | 144 if "can" in contents: |
144 msg += " It currently contains an empty can." | 145 msg += _(" It currently contains an empty can.") |
145 elif "tube" in contents: | 146 elif "tube" in contents: |
146 msg += " It currently contains a tube fragment." | 147 msg += _(" It currently contains a tube fragment.") |
147 elif len(contents) == 2: | 148 elif len(contents) == 2: |
148 msg = "The laser welder looks expectant. " | 149 msg = _("The laser welder looks expectant. ") |
149 if "can" in contents and "tube" in contents: | 150 if "can" in contents and "tube" in contents: |
150 msg += " It currently contains an empty can and a tube fragment." | 151 msg += _(" It currently contains an empty can and a tube fragment.") |
151 return msg | 152 return msg |
152 | 153 |
153 | 154 |
154 class LaserWelderButton(Thing): | 155 class LaserWelderButton(Thing): |
155 | 156 |
162 INITIAL = "button" | 163 INITIAL = "button" |
163 | 164 |
164 def interact_without(self): | 165 def interact_without(self): |
165 contents = self.scene.things["machine.welder.slot"].get_data("contents") | 166 contents = self.scene.things["machine.welder.slot"].get_data("contents") |
166 if not contents: | 167 if not contents: |
167 return Result("The laser welder doesn't currently contain anything weldable.") | 168 return Result(_("The laser welder doesn't currently contain anything weldable.")) |
168 elif len(contents) == 1: | 169 elif len(contents) == 1: |
169 if "can" in contents: | 170 if "can" in contents: |
170 return Result("The laser welder needs something to weld the can to.") | 171 return Result(_("The laser welder needs something to weld the can to.")) |
171 elif "tube" in contents: | 172 elif "tube" in contents: |
172 return Result("The laser welder needs something to weld the tube fragments to.") | 173 return Result(_("The laser welder needs something to weld the tube fragments to.")) |
173 else: | 174 else: |
174 self.scene.things["machine.welder.slot"].set_data("contents", set()) | 175 self.scene.things["machine.welder.slot"].set_data("contents", set()) |
175 self.scene.things["machine.welder.slot"].update_contents() | 176 self.scene.things["machine.welder.slot"].update_contents() |
176 if self.state.items["cryo_pipes_one"] in self.state.inventory: | 177 if self.state.items["cryo_pipes_one"] in self.state.inventory: |
177 self.state.replace_inventory_item("cryo_pipes_one", "cryo_pipes_two") | 178 self.state.replace_inventory_item("cryo_pipes_one", "cryo_pipes_two") |
178 return Result("With high-precision spitzensparken, you weld" | 179 return Result(_("With high-precision spitzensparken, you weld" |
179 " together a second pipe. You bundle the two pipes together.", | 180 " together a second pipe. You bundle the two pipes together."), |
180 soundfile='laser.ogg') | 181 soundfile='laser.ogg') |
181 elif self.state.items["cryo_pipes_two"] in self.state.inventory: | 182 elif self.state.items["cryo_pipes_two"] in self.state.inventory: |
182 self.state.replace_inventory_item("cryo_pipes_two", "cryo_pipes_three") | 183 self.state.replace_inventory_item("cryo_pipes_two", "cryo_pipes_three") |
183 return Result("With high-precision spitzensparken, you create yet" | 184 return Result(_("With high-precision spitzensparken, you create yet" |
184 " another pipe. You store it with the other two.", | 185 " another pipe. You store it with the other two."), |
185 soundfile='laser.ogg') | 186 soundfile='laser.ogg') |
186 elif self.state.items["cryo_pipes_three"] in self.state.inventory: | 187 elif self.state.items["cryo_pipes_three"] in self.state.inventory: |
187 # just for safety | 188 # just for safety |
188 return None | 189 return None |
189 else: | 190 else: |
190 self.state.add_inventory_item("cryo_pipes_one") | 191 self.state.add_inventory_item("cryo_pipes_one") |
191 return Result("With high-precision spitzensparken, the can and tube are welded" | 192 return Result(_("With high-precision spitzensparken, the can and tube are welded" |
192 " into a whole greater than the sum of the parts.", | 193 " into a whole greater than the sum of the parts."), |
193 soundfile='laser.ogg') | 194 soundfile='laser.ogg') |
194 | 195 |
195 | 196 |
196 class LaserWelderPowerLights(Thing): | 197 class LaserWelderPowerLights(Thing): |
197 | 198 |
202 } | 203 } |
203 | 204 |
204 INITIAL = 'lights' | 205 INITIAL = 'lights' |
205 | 206 |
206 def get_description(self): | 207 def get_description(self): |
207 return "The power lights pulse expectantly." | 208 return _("The power lights pulse expectantly.") |
208 | 209 |
209 | 210 |
210 class CryoPipesOne(Item): | 211 class CryoPipesOne(Item): |
211 "A single cryo pipe (made from a tube fragment and can)." | 212 "A single cryo pipe (made from a tube fragment and can)." |
212 | 213 |
240 } | 241 } |
241 | 242 |
242 INITIAL = "grind" | 243 INITIAL = "grind" |
243 | 244 |
244 def interact_without(self): | 245 def interact_without(self): |
245 return Result("It looks like it eats fingers. Perhaps a different approach is in order?") | 246 return Result(_("It looks like it eats fingers. Perhaps a different approach is in order?")) |
246 | 247 |
247 def interact_with_titanium_leg(self, item): | 248 def interact_with_titanium_leg(self, item): |
248 self.state.replace_inventory_item(item.name, 'machete') | 249 self.state.replace_inventory_item(item.name, 'machete') |
249 return Result("After much delicate grinding and a few close calls with" | 250 return Result(_("After much delicate grinding and a few close calls with" |
250 " various body parts, the titanium femur now resembles" | 251 " various body parts, the titanium femur now resembles" |
251 " a machete more than a bone. Nice and sharp, too.", | 252 " a machete more than a bone. Nice and sharp, too."), |
252 soundfile="grinder.ogg") | 253 soundfile="grinder.ogg") |
253 | 254 |
254 def get_description(self): | 255 def get_description(self): |
255 return "A pretty ordinary, albeit rather industrial, grinding machine." | 256 return _("A pretty ordinary, albeit rather industrial, grinding machine.") |
256 | 257 |
257 | 258 |
258 class TitaniumMachete(Item): | 259 class TitaniumMachete(Item): |
259 "Titanium machete, formerly a leg." | 260 "Titanium machete, formerly a leg." |
260 | 261 |
273 INITIAL = "manual" | 274 INITIAL = "manual" |
274 | 275 |
275 def interact_without(self): | 276 def interact_without(self): |
276 self.scene.remove_thing(self) | 277 self.scene.remove_thing(self) |
277 self.state.add_inventory_item("manual") | 278 self.state.add_inventory_item("manual") |
278 return Result("Ah! The ship's instruction manual. You'd feel better" | 279 return Result(_("Ah! The ship's instruction manual. You'd feel better" |
279 " if the previous owner wasn't lying next to it with a" | 280 " if the previous owner wasn't lying next to it with a" |
280 " gaping hole in his rib cage.") | 281 " gaping hole in his rib cage.")) |
281 | 282 |
282 | 283 |
283 class Manual(Item): | 284 class Manual(Item): |
284 "A ship instruction manual." | 285 "A ship instruction manual." |
285 | 286 |