comparison gamelib/scenes/crew_quarters.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
6 from gamelib.scenes.game_constants import PLAYER_ID 6 from gamelib.scenes.game_constants import PLAYER_ID
7 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage, 7 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage,
8 InteractRectUnion, InteractImage, 8 InteractRectUnion, InteractImage,
9 InteractAnimated, GenericDescThing, 9 InteractAnimated, GenericDescThing,
10 BaseCamera, make_jim_dialog) 10 BaseCamera, make_jim_dialog)
11
12 from gamelib.i18n import _
11 13
12 class CrewQuarters(Scene): 14 class CrewQuarters(Scene):
13 15
14 FOLDER = "crew_quarters" 16 FOLDER = "crew_quarters"
15 BACKGROUND = "crew_quarters.png" 17 BACKGROUND = "crew_quarters.png"
25 self.add_item(DuctTape('duct_tape')) 27 self.add_item(DuctTape('duct_tape'))
26 self.add_item(EscherPoster('escher_poster')) 28 self.add_item(EscherPoster('escher_poster'))
27 self.add_thing(PosterThing()) 29 self.add_thing(PosterThing())
28 self.add_thing(MonitorCamera()) 30 self.add_thing(MonitorCamera())
29 self.add_thing(GenericDescThing('crew.plant', 1, 31 self.add_thing(GenericDescThing('crew.plant', 1,
30 "The plant is doing surprisingly well for centuries of neglect", 32 _("The plant is doing surprisingly well for centuries of neglect"),
31 ((624, 215, 61, 108),))) 33 ((624, 215, 61, 108),)))
32 self.add_thing(GenericDescThing('crew.cat', 2, 34 self.add_thing(GenericDescThing('crew.cat', 2,
33 "A picture of a cat labelled 'Clementine'", 35 _("A picture of a cat labelled 'Clementine'"),
34 ((722, 382, 66, 72),))) 36 ((722, 382, 66, 72),)))
35 37
36 38
37 class ToMap(Door): 39 class ToMap(Door):
38 40
67 if self.get_data('is_cracked'): 69 if self.get_data('is_cracked'):
68 if self.get_data('has_tape'): 70 if self.get_data('has_tape'):
69 self.set_data('has_tape', False) 71 self.set_data('has_tape', False)
70 self.state.add_inventory_item('duct_tape') 72 self.state.add_inventory_item('duct_tape')
71 self.set_interact('empty_safe') 73 self.set_interact('empty_safe')
72 return Result("Duct tape. It'll stick to everything except " 74 return Result(_("Duct tape. It'll stick to everything except "
73 "ducts, apparently.") 75 "ducts, apparently."))
74 return Result("The perfectly balanced door swings frictionlessly " 76 return Result(_("The perfectly balanced door swings frictionlessly "
75 "to and fro. What craftsmanship!") 77 "to and fro. What craftsmanship!"))
76 return Result("The safe is locked. This might be an interesting " 78 return Result(_("The safe is locked. This might be an interesting "
77 "challenge, if suitable equipment can be found.") 79 "challenge, if suitable equipment can be found."))
78 80
79 def interact_with_stethoscope(self, item): 81 def interact_with_stethoscope(self, item):
80 if self.get_data('is_cracked'): 82 if self.get_data('is_cracked'):
81 return Result("It's already unlocked. There's no more challenge.") 83 return Result(_("It's already unlocked. There's no more challenge."))
82 # TODO: Add years to the sentence for safecracking. 84 # TODO: Add years to the sentence for safecracking.
83 # TODO: Wax lyrical some more about safecracking. 85 # TODO: Wax lyrical some more about safecracking.
84 self.set_data('is_cracked', True) 86 self.set_data('is_cracked', True)
85 self.set_interact('full_safe') 87 self.set_interact('full_safe')
86 return (Result("Even after centuries of neglect, the tumblers slide" 88 return (Result(_("Even after centuries of neglect, the tumblers slide"
87 " almost silently into place. Turns out the combination" 89 " almost silently into place. Turns out the combination"
88 " was '1 2 3 4 5'. An idiot must keep his luggage in" 90 " was '1 2 3 4 5'. An idiot must keep his luggage in"
89 " here."), 91 " here.")),
90 make_jim_dialog("Prisoner %s, you have been observed committing a felony violation. " 92 make_jim_dialog(_("Prisoner %s, you have been observed committing a felony violation. "
91 "This will go onto your permanent record, and your sentence may be extended by up to twenty years." 93 "This will go onto your permanent record, and your sentence may be extended by up to twenty years.")
92 % PLAYER_ID, self.state)) 94 % PLAYER_ID, self.state))
93 95
94 def get_description(self): 96 def get_description(self):
95 return "Ah, a vintage Knoxx & Co. model QR3. Quaint, but reasonably secure." 97 return _("Ah, a vintage Knoxx & Co. model QR3. Quaint, but reasonably secure.")
96 98
97 99
98 class FishbowlThing(Thing): 100 class FishbowlThing(Thing):
99 "A safe, for keeping things safe." 101 "A safe, for keeping things safe."
100 102
111 'has_bowl': True, 113 'has_bowl': True,
112 } 114 }
113 115
114 def interact_without(self): 116 def interact_without(self):
115 if not self.get_data('has_bowl'): 117 if not self.get_data('has_bowl'):
116 return Result("What's the point of lugging around a very dead fish " 118 return Result(_("What's the point of lugging around a very dead fish "
117 "and a kilogram or so of sand?") 119 "and a kilogram or so of sand?"))
118 self.set_interact('fish_no_bowl') 120 self.set_interact('fish_no_bowl')
119 self.set_data('has_bowl', False) 121 self.set_data('has_bowl', False)
120 self.state.add_inventory_item('fishbowl') 122 self.state.add_inventory_item('fishbowl')
121 return Result("The fishbowl is useful, but its contents aren't.") 123 return Result(_("The fishbowl is useful, but its contents aren't."))
122 124
123 def get_description(self): 125 def get_description(self):
124 return "This fishbowl looks exactly like an old science fiction space helmet." 126 return _("This fishbowl looks exactly like an old science fiction space helmet.")
125 127
126 class Fishbowl(Item): 128 class Fishbowl(Item):
127 "A bowl. Sans fish." 129 "A bowl. Sans fish."
128 130
129 INVENTORY_IMAGE = 'fishbowl.png' 131 INVENTORY_IMAGE = 'fishbowl.png'
132 134
133 def interact_with_duct_tape(self, item, state): 135 def interact_with_duct_tape(self, item, state):
134 helmet = FishbowlHelmet('helmet') 136 helmet = FishbowlHelmet('helmet')
135 state.add_item(helmet) 137 state.add_item(helmet)
136 state.replace_inventory_item(self.name, helmet.name) 138 state.replace_inventory_item(self.name, helmet.name)
137 return Result("You duct tape the edges of the helmet. The seal is" 139 return Result(_("You duct tape the edges of the helmet. The seal is"
138 " crude, but it will serve as a workable helmet if needed.") 140 " crude, but it will serve as a workable helmet if needed."))
139 141
140 142
141 class FishbowlHelmet(Item): 143 class FishbowlHelmet(Item):
142 "A bowl with duct-tape" 144 "A bowl with duct-tape"
143 145
179 INITIAL = 'poster' 181 INITIAL = 'poster'
180 182
181 def interact_without(self): 183 def interact_without(self):
182 self.state.add_inventory_item('escher_poster') 184 self.state.add_inventory_item('escher_poster')
183 self.scene.remove_thing(self) 185 self.scene.remove_thing(self)
184 return Result("This poster will go nicely on your bedroom wall.") 186 return Result(_("This poster will go nicely on your bedroom wall."))
185 187
186 def get_description(self): 188 def get_description(self):
187 return "A paradoxical poster hangs below the security camera." 189 return _("A paradoxical poster hangs below the security camera.")
188 190
189 191
190 class EscherPoster(Item): 192 class EscherPoster(Item):
191 "A confusing poster to disable JIM" 193 "A confusing poster to disable JIM"
192 194