comparison gamelib/scenes/mess.py @ 769:43b49f1de828 pyntnclick-i18n

Merge i18n for before the pyntnclick split
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 26 Jan 2013 16:57:33 +0200
parents 386475464202 2f1952748cdb
children a35f5364437d
comparison
equal deleted inserted replaced
763:afe7b1cb16c0 769:43b49f1de828
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
138 self.set_data('cans_available', starting_cans - 1) 139 self.set_data('cans_available', starting_cans - 1)
139 self.set_interact() 140 self.set_interact()
140 if starting_cans == 1: 141 if starting_cans == 1:
141 self.scene.remove_thing(self) 142 self.scene.remove_thing(self)
142 return Result({ 143 return Result({
143 3: "Best before a long time in the past." 144 3: _("Best before a long time in the past."
144 " Better not eat these.", 145 " Better not eat these."),
145 2: "Mmmm. Nutritious bacteria stew.", 146 2: _("Mmmm. Nutritious bacteria stew."),
146 1: "Candied silkworms. Who stocked this place?!", 147 1: _("Candied silkworms. Who stocked this place?!"),
147 }[starting_cans]) 148 }[starting_cans])
148 else: 149 else:
149 return Result("The rest of the cans are rusted beyond usefulness.") 150 return Result(_("The rest of the cans are rusted beyond "
151 "usefulness."))
150 152
151 def get_description(self): 153 def get_description(self):
152 return "The contents of these cans look synthetic." 154 return _("The contents of these cans look synthetic.")
153 155
154 156
155 class Tubes(Thing): 157 class Tubes(Thing):
156 158
157 NAME = "mess.tubes" 159 NAME = "mess.tubes"
169 "status": "blocked", 171 "status": "blocked",
170 } 172 }
171 173
172 def get_description(self): 174 def get_description(self):
173 if self.get_data('status') == "blocked": 175 if self.get_data('status') == "blocked":
174 return ("The broccoli seems to have become" 176 return _("The broccoli seems to have become"
175 " entangled with something.") 177 " entangled with something.")
176 elif self.get_data("status") == "broken": 178 elif self.get_data("status") == "broken":
177 return "These broken pipes look important." 179 return _("These broken pipes look important.")
178 elif self.get_data("status") == "replaced": 180 elif self.get_data("status") == "replaced":
179 return ("The pipes have been repaired but are the repairs" 181 return _("The pipes have been repaired but are the repairs"
180 " aren't airtight, yet") 182 " aren't airtight, yet")
181 else: 183 else:
182 return "Your fix looks like it's holding up well." 184 return _("Your fix looks like it's holding up well.")
183 185
184 def select_interact(self): 186 def select_interact(self):
185 return self.get_data('status') 187 return self.get_data('status')
186 188
187 def interact_with_machete(self, item): 189 def interact_with_machete(self, item):
188 if self.get_data("status") == "blocked": 190 if self.get_data("status") == "blocked":
189 self.set_data("status", "broken") 191 self.set_data("status", "broken")
190 self.set_interact() 192 self.set_interact()
191 return Result("With a flurry of disgusting mutant vegetable " 193 return Result(_("With a flurry of disgusting mutant vegetable "
192 "chunks, you clear the overgrown broccoli away from " 194 "chunks, you clear the overgrown broccoli away "
193 "the access panel and reveal some broken tubes. " 195 "from the access panel and reveal some broken "
194 "They look important.", 196 "tubes. They look important."),
195 soundfile='chopping.ogg') 197 soundfile='chopping.ogg')
196 elif self.get_data("status") == "broken": 198 elif self.get_data("status") == "broken":
197 return Result("It looks broken enough already.") 199 return Result(_("It looks broken enough already."))
198 elif self.get_data("status") == "replaced": 200 elif self.get_data("status") == "replaced":
199 return Result("Cutting holes won't repair the leaks.") 201 return Result(_("Cutting holes won't repair the leaks."))
200 else: 202 else:
201 return Result("After all that effort fixing it, chopping it to " 203 return Result(_("After all that effort fixing it, chopping it to "
202 "bits doesn't seem very smart.") 204 "bits doesn't seem very smart."))
203 205
204 def interact_with_cryo_pipes_three(self, item): 206 def interact_with_cryo_pipes_three(self, item):
205 if self.get_data("status") == "blocked": 207 if self.get_data("status") == "blocked":
206 return Result("It would get lost in the fronds.") 208 return Result(_("It would get lost in the fronds."))
207 else: 209 else:
208 self.game.remove_inventory_item(item.name) 210 self.game.remove_inventory_item(item.name)
209 self.set_data('status', 'replaced') 211 self.set_data('status', 'replaced')
210 self.set_interact() 212 self.set_interact()
211 self.scene.set_data('life support status', 'replaced') 213 self.scene.set_data('life support status', 'replaced')
212 return Result("The pipes slot neatly into place, but don't make" 214 return Result(_("The pipes slot neatly into place, but don't make"
213 " an airtight seal. One of the pipes has cracked" 215 " an airtight seal. One of the pipes has cracked"
214 " slightly as well.") 216 " slightly as well."))
215 217
216 def interact_with_duct_tape(self, item): 218 def interact_with_duct_tape(self, item):
217 if self.get_data("status") == "broken": 219 if self.get_data("status") == "broken":
218 return Result("It would get lost in the fronds.") 220 return Result(_("It would get lost in the fronds."))
219 elif self.get_data("status") == 'fixed': 221 elif self.get_data("status") == 'fixed':
220 return Result("There's quite enough tape on the ducting already.") 222 return Result(_("There's quite enough tape on the ducting already."
223 ))
221 else: 224 else:
222 self.set_data("fixed", True) 225 self.set_data("fixed", True)
223 self.set_data("status", "fixed") 226 self.set_data("status", "fixed")
224 self.set_interact() 227 self.set_interact()
225 self.scene.set_data('life support status', 'fixed') 228 self.scene.set_data('life support status', 'fixed')
226 return Result("It takes quite a lot of tape, but eventually" 229 return Result(_("It takes quite a lot of tape, but eventually "
227 "everything is airtight and ready to hold pressure." 230 "everything is airtight and ready to hold "
228 " Who'd've thought duct tape could actually be used" 231 "pressure. Who'd've thought duct tape could "
229 " to tape ducts?") 232 "actually be used to tape ducts?"))
230 233
231 def interact_without(self): 234 def interact_without(self):
232 if self.get_data("status") == "blocked": 235 if self.get_data("status") == "blocked":
233 return Result("The mutant broccoli resists your best efforts.") 236 return Result(_("The mutant broccoli resists your best efforts."))
234 elif self.get_data("status") == "broken": 237 elif self.get_data("status") == "broken":
235 return Result("Shoving the broken pipes around doesn't help much.") 238 return Result(_("Shoving the broken pipes around doesn't help "
239 "much."))
236 elif self.get_data("status") == "replaced": 240 elif self.get_data("status") == "replaced":
237 return Result("Do you really want to hold it together for the " 241 return Result(_("Do you really want to hold it together for the "
238 "rest of the voyage?") 242 "rest of the voyage?"))
239 else: 243 else:
240 return Result("You don't find any leaks. Good job, Prisoner %s." 244 return Result(_("You don't find any leaks. Good job, Prisoner %s.")
241 % PLAYER_ID) 245 % PLAYER_ID)
242 246
243 247
244 class Boomslang(Thing): 248 class Boomslang(Thing):
245 NAME = 'mess.boomslang' 249 NAME = 'mess.boomslang'
302 return 'taken' 306 return 'taken'
303 return self.INITIAL 307 return self.INITIAL
304 308
305 def interact_without(self): 309 def interact_without(self):
306 if self.get_data('taken'): 310 if self.get_data('taken'):
307 return Result("The remaining bottles leak.") 311 return Result(_("The remaining bottles leak."))
308 self.set_data('taken', True) 312 self.set_data('taken', True)
309 self.set_interact() 313 self.set_interact()
310 self.game.add_inventory_item('detergent_bottle') 314 self.game.add_inventory_item('detergent_bottle')
311 return Result("You pick up an empty dishwashing liquid bottle. You" 315 return Result(_("You pick up an empty dishwashing liquid bottle. You"
312 " can't find any sponges.") 316 " can't find any sponges."))
313 317
314 def get_description(self): 318 def get_description(self):
315 return "Empty plastic containers. They used to hold dishwasher soap." 319 return _("Empty plastic containers. "
320 "They used to hold dishwasher soap.")
316 321
317 322
318 class DetergentBottle(Item): 323 class DetergentBottle(Item):
319 INVENTORY_IMAGE = 'bottle_empty.png' 324 INVENTORY_IMAGE = 'bottle_empty.png'
320 CURSOR = CursorSprite('bottle_empty_cursor.png', 27, 7) 325 CURSOR = CursorSprite('bottle_empty_cursor.png', 27, 7)