Mercurial > boomslang
comparison gamelib/scenes/mess.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 | 374d96e0b55e |
comparison
equal
deleted
inserted
replaced
764:a8510f4e2ea1 | 770:a35f5364437d |
---|---|
1 """Mess where crew eat. Fun stuff.""" | 1 """Mess where crew eat. Fun stuff.""" |
2 | 2 |
3 from random import randint | 3 from random import randint |
4 | 4 |
5 from pyntnclick.i18n import _ | |
5 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result | 6 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result |
6 from pyntnclick.cursor import CursorSprite | 7 from pyntnclick.cursor import CursorSprite |
7 from pyntnclick.scenewidgets import (InteractNoImage, InteractImage, | 8 from pyntnclick.scenewidgets import (InteractNoImage, InteractImage, |
8 InteractImageRect, InteractAnimated, | 9 InteractImageRect, InteractAnimated, |
9 GenericDescThing) | 10 GenericDescThing) |
29 self.add_thing(Boomslang()) | 30 self.add_thing(Boomslang()) |
30 self.add_item(DetergentBottle('detergent_bottle')) | 31 self.add_item(DetergentBottle('detergent_bottle')) |
31 # Flavour items | 32 # Flavour items |
32 # extra cans on shelf | 33 # extra cans on shelf |
33 self.add_thing(GenericDescThing('mess.cans', 1, | 34 self.add_thing(GenericDescThing('mess.cans', 1, |
34 "A large collection of rusted, useless cans.", | 35 _("A large collection of rusted, useless cans."), |
35 ( | 36 ( |
36 (154, 335, 89, 106), | 37 (154, 335, 89, 106), |
37 (152, 435, 63, 66), | 38 (152, 435, 63, 66), |
38 ))) | 39 ))) |
39 self.add_thing(GenericDescThing('mess.broccoli', 2, | 40 self.add_thing(GenericDescThing('mess.broccoli', 2, |
40 "An impressively overgrown broccoli.", | 41 _("An impressively overgrown broccoli."), |
41 ( | 42 ( |
42 (503, 89, 245, 282), | 43 (503, 89, 245, 282), |
43 (320, 324, 229, 142), | 44 (320, 324, 229, 142), |
44 ))) | 45 ))) |
45 | 46 |
46 | 47 |
47 class BaseCan(CloneableItem): | 48 class BaseCan(CloneableItem): |
48 """Base class for the cans""" | 49 """Base class for the cans""" |
49 | 50 |
50 def interact_with_full_can(self, item): | 51 def interact_with_full_can(self, item): |
51 return Result("You bang the cans together. It sounds like two" | 52 return Result(_("You bang the cans together. It sounds like two" |
52 " cans being banged together.", | 53 " cans being banged together."), |
53 soundfile="can_hit.ogg") | 54 soundfile="can_hit.ogg") |
54 | 55 |
55 def interact_with_dented_can(self, item): | 56 def interact_with_dented_can(self, item): |
56 return self.interact_with_full_can(item) | 57 return self.interact_with_full_can(item) |
57 | 58 |
58 def interact_with_empty_can(self, item): | 59 def interact_with_empty_can(self, item): |
59 return self.interact_with_full_can(item) | 60 return self.interact_with_full_can(item) |
60 | 61 |
61 def interact_with_machete(self, item): | 62 def interact_with_machete(self, item): |
62 return Result("You'd mangle it beyond usefulness.") | 63 return Result(_("You'd mangle it beyond usefulness.")) |
63 | 64 |
64 def interact_with_canopener(self, item): | 65 def interact_with_canopener(self, item): |
65 empty = EmptyCan('empty_can') | 66 empty = EmptyCan('empty_can') |
66 self.game.add_item(empty) | 67 self.game.add_item(empty) |
67 self.game.replace_inventory_item(self.name, empty.name) | 68 self.game.replace_inventory_item(self.name, empty.name) |
68 return Result("You open both ends of the can, discarding the" | 69 return Result(_("You open both ends of the can, discarding the" |
69 " hideous contents.") | 70 " hideous contents.")) |
70 | 71 |
71 | 72 |
72 class EmptyCan(BaseCan): | 73 class EmptyCan(BaseCan): |
73 "After emptying the full can." | 74 "After emptying the full can." |
74 | 75 |
75 INVENTORY_IMAGE = "empty_can.png" | 76 INVENTORY_IMAGE = "empty_can.png" |
76 CURSOR = CursorSprite('empty_can_cursor.png') | 77 CURSOR = CursorSprite('empty_can_cursor.png') |
77 | 78 |
78 def interact_with_titanium_leg(self, item): | 79 def interact_with_titanium_leg(self, item): |
79 return Result("Flattening the can doesn't look like a useful" | 80 return Result(_("Flattening the can doesn't look like a useful" |
80 " thing to do.") | 81 " thing to do.")) |
81 | 82 |
82 def interact_with_canopener(self, item): | 83 def interact_with_canopener(self, item): |
83 return Result("There's nothing left to open on this can") | 84 return Result(_("There's nothing left to open on this can")) |
84 | 85 |
85 | 86 |
86 class FullCan(BaseCan): | 87 class FullCan(BaseCan): |
87 "Found on the shelf." | 88 "Found on the shelf." |
88 | 89 |
91 | 92 |
92 def interact_with_titanium_leg(self, item): | 93 def interact_with_titanium_leg(self, item): |
93 dented = DentedCan("dented_can") | 94 dented = DentedCan("dented_can") |
94 self.game.add_item(dented) | 95 self.game.add_item(dented) |
95 self.game.replace_inventory_item(self.name, dented.name) | 96 self.game.replace_inventory_item(self.name, dented.name) |
96 return Result("You club the can with the femur. The can gets dented," | 97 return Result(_("You club the can with the femur. The can gets dented," |
97 " but doesn't open.", soundfile="can_hit.ogg") | 98 " but doesn't open."), soundfile="can_hit.ogg") |
98 | 99 |
99 | 100 |
100 class DentedCan(BaseCan): | 101 class DentedCan(BaseCan): |
101 "A can banged on with the femur" | 102 "A can banged on with the femur" |
102 | 103 |
103 INVENTORY_IMAGE = "dented_can.png" | 104 INVENTORY_IMAGE = "dented_can.png" |
104 CURSOR = CursorSprite('dented_can_cursor.png') | 105 CURSOR = CursorSprite('dented_can_cursor.png') |
105 | 106 |
106 def interact_with_titanium_leg(self, item): | 107 def interact_with_titanium_leg(self, item): |
107 return Result("You club the can with the femur. The dents shift" | 108 return Result(_("You club the can with the femur. The dents shift" |
108 " around, but it still doesn't open.", | 109 " around, but it still doesn't open."), |
109 soundfile="can_hit.ogg") | 110 soundfile="can_hit.ogg") |
110 | 111 |
111 | 112 |
112 class CansOnShelf(Thing): | 113 class CansOnShelf(Thing): |
113 | 114 |
141 self.set_data('cans_available', starting_cans - 1) | 142 self.set_data('cans_available', starting_cans - 1) |
142 self.set_interact() | 143 self.set_interact() |
143 if starting_cans == 1: | 144 if starting_cans == 1: |
144 self.scene.remove_thing(self) | 145 self.scene.remove_thing(self) |
145 return Result({ | 146 return Result({ |
146 3: "Best before a long time in the past." | 147 3: _("Best before a long time in the past." |
147 " Better not eat these.", | 148 " Better not eat these."), |
148 2: "Mmmm. Nutritious bacteria stew.", | 149 2: _("Mmmm. Nutritious bacteria stew."), |
149 1: "Candied silkworms. Who stocked this place?!", | 150 1: _("Candied silkworms. Who stocked this place?!"), |
150 }[starting_cans]) | 151 }[starting_cans]) |
151 else: | 152 else: |
152 return Result("The rest of the cans are rusted beyond usefulness.") | 153 return Result(_("The rest of the cans are rusted beyond " |
154 "usefulness.")) | |
153 | 155 |
154 def get_description(self): | 156 def get_description(self): |
155 return "The contents of these cans look synthetic." | 157 return _("The contents of these cans look synthetic.") |
156 | 158 |
157 | 159 |
158 class Tubes(Thing): | 160 class Tubes(Thing): |
159 | 161 |
160 NAME = "mess.tubes" | 162 NAME = "mess.tubes" |
172 "status": "blocked", | 174 "status": "blocked", |
173 } | 175 } |
174 | 176 |
175 def get_description(self): | 177 def get_description(self): |
176 if self.get_data('status') == "blocked": | 178 if self.get_data('status') == "blocked": |
177 return ("The broccoli seems to have become" | 179 return _("The broccoli seems to have become" |
178 " entangled with something.") | 180 " entangled with something.") |
179 elif self.get_data("status") == "broken": | 181 elif self.get_data("status") == "broken": |
180 return "These broken pipes look important." | 182 return _("These broken pipes look important.") |
181 elif self.get_data("status") == "replaced": | 183 elif self.get_data("status") == "replaced": |
182 return ("The pipes have been repaired but are the repairs" | 184 return _("The pipes have been repaired but are the repairs" |
183 " aren't airtight, yet") | 185 " aren't airtight, yet") |
184 else: | 186 else: |
185 return "Your fix looks like it's holding up well." | 187 return _("Your fix looks like it's holding up well.") |
186 | 188 |
187 def select_interact(self): | 189 def select_interact(self): |
188 return self.get_data('status') | 190 return self.get_data('status') |
189 | 191 |
190 def interact_with_machete(self, item): | 192 def interact_with_machete(self, item): |
191 if self.get_data("status") == "blocked": | 193 if self.get_data("status") == "blocked": |
192 self.set_data("status", "broken") | 194 self.set_data("status", "broken") |
193 self.set_interact() | 195 self.set_interact() |
194 return Result("With a flurry of disgusting mutant vegetable " | 196 return Result(_("With a flurry of disgusting mutant vegetable " |
195 "chunks, you clear the overgrown broccoli away from " | 197 "chunks, you clear the overgrown broccoli away " |
196 "the access panel and reveal some broken tubes. " | 198 "from the access panel and reveal some broken " |
197 "They look important.", | 199 "tubes. They look important."), |
198 soundfile='chopping.ogg') | 200 soundfile='chopping.ogg') |
199 elif self.get_data("status") == "broken": | 201 elif self.get_data("status") == "broken": |
200 return Result("It looks broken enough already.") | 202 return Result(_("It looks broken enough already.")) |
201 elif self.get_data("status") == "replaced": | 203 elif self.get_data("status") == "replaced": |
202 return Result("Cutting holes won't repair the leaks.") | 204 return Result(_("Cutting holes won't repair the leaks.")) |
203 else: | 205 else: |
204 return Result("After all that effort fixing it, chopping it to " | 206 return Result(_("After all that effort fixing it, chopping it to " |
205 "bits doesn't seem very smart.") | 207 "bits doesn't seem very smart.")) |
206 | 208 |
207 def interact_with_cryo_pipes_three(self, item): | 209 def interact_with_cryo_pipes_three(self, item): |
208 if self.get_data("status") == "blocked": | 210 if self.get_data("status") == "blocked": |
209 return Result("It would get lost in the fronds.") | 211 return Result(_("It would get lost in the fronds.")) |
210 else: | 212 else: |
211 self.game.remove_inventory_item(item.name) | 213 self.game.remove_inventory_item(item.name) |
212 self.set_data('status', 'replaced') | 214 self.set_data('status', 'replaced') |
213 self.set_interact() | 215 self.set_interact() |
214 self.scene.set_data('life support status', 'replaced') | 216 self.scene.set_data('life support status', 'replaced') |
215 return Result("The pipes slot neatly into place, but don't make" | 217 return Result(_("The pipes slot neatly into place, but don't make" |
216 " an airtight seal. One of the pipes has cracked" | 218 " an airtight seal. One of the pipes has cracked" |
217 " slightly as well.") | 219 " slightly as well.")) |
218 | 220 |
219 def interact_with_duct_tape(self, item): | 221 def interact_with_duct_tape(self, item): |
220 if self.get_data("status") == "broken": | 222 if self.get_data("status") == "broken": |
221 return Result("It would get lost in the fronds.") | 223 return Result(_("It would get lost in the fronds.")) |
222 elif self.get_data("status") == 'fixed': | 224 elif self.get_data("status") == 'fixed': |
223 return Result("There's quite enough tape on the ducting already.") | 225 return Result(_("There's quite enough tape on the ducting already." |
226 )) | |
224 else: | 227 else: |
225 self.set_data("fixed", True) | 228 self.set_data("fixed", True) |
226 self.set_data("status", "fixed") | 229 self.set_data("status", "fixed") |
227 self.set_interact() | 230 self.set_interact() |
228 self.scene.set_data('life support status', 'fixed') | 231 self.scene.set_data('life support status', 'fixed') |
229 return Result("It takes quite a lot of tape, but eventually" | 232 return Result(_("It takes quite a lot of tape, but eventually " |
230 "everything is airtight and ready to hold pressure." | 233 "everything is airtight and ready to hold " |
231 " Who'd've thought duct tape could actually be used" | 234 "pressure. Who'd've thought duct tape could " |
232 " to tape ducts?") | 235 "actually be used to tape ducts?")) |
233 | 236 |
234 def interact_without(self): | 237 def interact_without(self): |
235 if self.get_data("status") == "blocked": | 238 if self.get_data("status") == "blocked": |
236 return Result("The mutant broccoli resists your best efforts.") | 239 return Result(_("The mutant broccoli resists your best efforts.")) |
237 elif self.get_data("status") == "broken": | 240 elif self.get_data("status") == "broken": |
238 return Result("Shoving the broken pipes around doesn't help much.") | 241 return Result(_("Shoving the broken pipes around doesn't help " |
242 "much.")) | |
239 elif self.get_data("status") == "replaced": | 243 elif self.get_data("status") == "replaced": |
240 return Result("Do you really want to hold it together for the " | 244 return Result(_("Do you really want to hold it together for the " |
241 "rest of the voyage?") | 245 "rest of the voyage?")) |
242 else: | 246 else: |
243 return Result("You don't find any leaks. Good job, Prisoner %s." | 247 return Result(_("You don't find any leaks. Good job, Prisoner %s.") |
244 % PLAYER_ID) | 248 % PLAYER_ID) |
245 | 249 |
246 | 250 |
247 class Boomslang(Thing): | 251 class Boomslang(Thing): |
248 NAME = 'mess.boomslang' | 252 NAME = 'mess.boomslang' |
305 return 'taken' | 309 return 'taken' |
306 return self.INITIAL | 310 return self.INITIAL |
307 | 311 |
308 def interact_without(self): | 312 def interact_without(self): |
309 if self.get_data('taken'): | 313 if self.get_data('taken'): |
310 return Result("The remaining bottles leak.") | 314 return Result(_("The remaining bottles leak.")) |
311 self.set_data('taken', True) | 315 self.set_data('taken', True) |
312 self.set_interact() | 316 self.set_interact() |
313 self.game.add_inventory_item('detergent_bottle') | 317 self.game.add_inventory_item('detergent_bottle') |
314 return Result("You pick up an empty dishwashing liquid bottle. You" | 318 return Result(_("You pick up an empty dishwashing liquid bottle. You" |
315 " can't find any sponges.") | 319 " can't find any sponges.")) |
316 | 320 |
317 def get_description(self): | 321 def get_description(self): |
318 return "Empty plastic containers. They used to hold dishwasher soap." | 322 return _("Empty plastic containers. " |
323 "They used to hold dishwasher soap.") | |
319 | 324 |
320 | 325 |
321 class DetergentBottle(Item): | 326 class DetergentBottle(Item): |
322 INVENTORY_IMAGE = 'bottle_empty.png' | 327 INVENTORY_IMAGE = 'bottle_empty.png' |
323 CURSOR = CursorSprite('bottle_empty_cursor.png', 27, 7) | 328 CURSOR = CursorSprite('bottle_empty_cursor.png', 27, 7) |