Mercurial > boomslang
annotate gamelib/scenes/machine.py @ 854:79b5c1be9a5e default tip
Remove pyntnclick, it's its own library, now
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 21 Jun 2014 22:06:09 +0200 |
parents | eed75a1d50c4 |
children |
rev | line source |
---|---|
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
1 """Machine room where tools and machines are found.""" |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
2 |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
3 from pyntnclick.i18n import _ |
549 | 4 from pyntnclick.state import Scene, Item, Thing, Result |
5 from pyntnclick.cursor import CursorSprite | |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
6 from pyntnclick.scenewidgets import ( |
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
7 InteractNoImage, InteractImage, InteractAnimated, GenericDescThing, |
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
8 TakeableThing) |
525
821b322e903b
Separate "scene widgets" from "game-specific widgets".
Jeremy Thurgood <firxen@gmail.com>
parents:
519
diff
changeset
|
9 |
821b322e903b
Separate "scene widgets" from "game-specific widgets".
Jeremy Thurgood <firxen@gmail.com>
parents:
519
diff
changeset
|
10 from gamelib.scenes.game_widgets import Door |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
11 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
12 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
13 class Machine(Scene): |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
14 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
15 FOLDER = "machine" |
260
020f83305bf3
Line art machine room.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
252
diff
changeset
|
16 BACKGROUND = "machine_room.png" |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
17 |
592
4e9178215e75
Introduce .setup() for GameDeveloperGizmos.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
549
diff
changeset
|
18 def setup(self): |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
19 self.add_thing(ToMap()) |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
20 self.add_thing(LaserWelderSlot()) |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
21 self.add_thing(LaserWelderButton()) |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
22 self.add_thing(LaserWelderPowerLights()) |
194 | 23 self.add_thing(Grinder()) |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
24 self.add_thing(ManualThing()) |
816 | 25 self.add_item_factory(TitaniumMachete) |
26 self.add_item_factory(CryoPipesOne) | |
27 self.add_item_factory(CryoPipesTwo) | |
28 self.add_item_factory(CryoPipesThree) | |
29 self.add_item_factory(Manual) | |
297
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
30 self.add_thing(GenericDescThing('machine.wires', 2, |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
31 _("Wires run to all the machines in the room"), |
297
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
32 ( |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
33 (250, 172, 252, 12), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
34 (388, 183, 114, 13), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
35 (496, 112, 36, 64), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
36 (533, 85, 19, 45), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
37 (647, 114, 10, 308), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
38 (111, 96, 13, 285), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
39 (152, 106, 34, 30), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
40 (189, 136, 27, 28), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
41 (222, 157, 24, 25), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
42 (120, 86, 34, 29), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
43 (110, 80, 21, 15), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
44 (383, 196, 12, 56), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
45 (553, 61, 26, 50), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
46 (574, 39, 16, 48), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
47 (648, 85, 22, 26), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
48 (674, 54, 23, 36), |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
49 ))) |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
50 self.add_thing(GenericDescThing('machine.diagram', 3, |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
51 _("A wiring diagram of some sort"), |
297
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
52 ((694, 140, 94, 185),))) |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
53 self.add_thing(GenericDescThing('machine.powerpoint', 4, |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
54 _("The cables to this power point have been cut"), |
297
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
55 ((155, 22, 92, 74),))) |
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
56 self.add_thing(GenericDescThing("machine.powerpoint", 5, |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
57 _("All the machines run off this powerpoint"), |
297
4adb64d349bc
Add some flavour text to machine room. Tweak rects
Neil Muller <neil@dip.sun.ac.za>
parents:
283
diff
changeset
|
58 ((593, 19, 74, 57),))) |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
59 self.add_thing(GenericDescThing("machine.drill_press", 6, |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
60 _("An impressive looking laser drill press"), |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
61 ( |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
62 (519, 338, 36, 63), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
63 (545, 348, 93, 46), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
64 (599, 309, 41, 150), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
65 (588, 445, 66, 42), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
66 (616, 479, 41, 14), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
67 (527, 393, 15, 17), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
68 (510, 360, 13, 11), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
69 (532, 331, 14, 11), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
70 (605, 304, 26, 8), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
71 ))) |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
72 self.add_thing(GenericDescThing("machine.drill_press_block", 7, |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
73 _("The block for the laser drill press"), |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
74 ((461, 446, 38, 27),))) |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
75 |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
76 |
242 | 77 class ToMap(Door): |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
78 |
252
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
242
diff
changeset
|
79 SCENE = "machine" |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
80 |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
81 INTERACTS = { |
262
5f58da9eeb52
Replace text interacts with doors.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
260
diff
changeset
|
82 "door": InteractNoImage(695, 350, 97, 212), |
151
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
83 } |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
84 |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
85 INITIAL = "door" |
d00aa26941c4
Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
55
diff
changeset
|
86 |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
87 |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
88 class LaserWelderSlot(Thing): |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
89 |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
90 NAME = "machine.welder.slot" |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
91 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
92 INTERACTS = { |
329 | 93 "empty": InteractImage(241, 310, "welder_empty.png"), |
94 "can": InteractImage(241, 310, "welder_can.png"), | |
95 "tube": InteractImage(241, 310, "welder_pipe.png"), | |
96 "can_and_tube": InteractImage(241, 310, "welder_can_pipe.png"), | |
97 } | |
98 | |
99 INITIAL = "empty" | |
100 | |
101 INITIAL_DATA = { | |
792
bdaffaa8b6bf
Loading and saving! (Plus a bunch of other stuff to make it possible.)
Jeremy Thurgood <firxen@gmail.com>
parents:
770
diff
changeset
|
102 'contents': [], |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
103 } |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
104 |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
753
diff
changeset
|
105 def select_interact(self): |
329 | 106 contents = self.get_data('contents') |
107 if not contents: | |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
753
diff
changeset
|
108 return "empty" |
329 | 109 elif len(contents) == 1: |
110 if "can" in contents: | |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
753
diff
changeset
|
111 return "can" |
329 | 112 elif "tube" in contents: |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
753
diff
changeset
|
113 return "tube" |
329 | 114 else: |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
753
diff
changeset
|
115 return "can_and_tube" |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
116 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
117 def interact_without(self): |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
118 return Result(_("You really don't want to put your hand in there.")) |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
119 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
120 def interact_with_empty_can(self, item): |
329 | 121 contents = self.get_data('contents') |
122 if "can" in contents: | |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
123 return Result(_("There is already a can in the welder.")) |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
592
diff
changeset
|
124 self.game.remove_inventory_item(item.name) |
792
bdaffaa8b6bf
Loading and saving! (Plus a bunch of other stuff to make it possible.)
Jeremy Thurgood <firxen@gmail.com>
parents:
770
diff
changeset
|
125 contents.append("can") |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
753
diff
changeset
|
126 self.set_interact() |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
127 return Result(_("You carefully place the can in the laser welder.")) |
329 | 128 |
129 def interact_with_tube_fragment(self, item): | |
130 contents = self.get_data('contents') | |
131 if "tube" in contents: | |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
132 return Result(_("There is already a tube fragment in the welder.")) |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
592
diff
changeset
|
133 self.game.remove_inventory_item(item.name) |
792
bdaffaa8b6bf
Loading and saving! (Plus a bunch of other stuff to make it possible.)
Jeremy Thurgood <firxen@gmail.com>
parents:
770
diff
changeset
|
134 contents.append("tube") |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
753
diff
changeset
|
135 self.set_interact() |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
136 return Result(_("You carefully place the tube fragments in the" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
137 " laser welder.")) |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
138 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
139 def get_description(self): |
329 | 140 contents = self.get_data('contents') |
141 if not contents: | |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
142 return (_("This is a Smith and Wesson 'zOMG' class high-precision" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
143 " laser welder.")) |
329 | 144 if len(contents) == 1: |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
145 msg = _("The laser welder looks hungry, somehow.") |
329 | 146 if "can" in contents: |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
147 msg += _(" It currently contains an empty can.") |
731 | 148 elif "tube" in contents: |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
149 msg += _(" It currently contains a tube fragment.") |
329 | 150 elif len(contents) == 2: |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
151 msg = _("The laser welder looks expectant. ") |
329 | 152 if "can" in contents and "tube" in contents: |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
153 msg += _(" It currently contains an empty can and a" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
154 " tube fragment.") |
190
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
155 return msg |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
156 |
30f2308c1efc
Fix tests and add a (currently unhooked) laser welder.
Jeremy Thurgood <firxen@gmail.com>
parents:
151
diff
changeset
|
157 |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
158 class LaserWelderButton(Thing): |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
159 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
160 NAME = "machine.welder.button" |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
161 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
162 INTERACTS = { |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
163 "button": InteractNoImage(406, 389, 28, 31), |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
164 } |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
165 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
166 INITIAL = "button" |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
167 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
168 def interact_without(self): |
539
11530992924a
PEP8 clean-up for engine, machine and mess.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
528
diff
changeset
|
169 welder_slot = self.scene.things["machine.welder.slot"] |
11530992924a
PEP8 clean-up for engine, machine and mess.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
528
diff
changeset
|
170 contents = welder_slot.get_data("contents") |
329 | 171 if not contents: |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
172 return Result(_("The laser welder doesn't currently contain" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
173 " anything weldable.")) |
329 | 174 elif len(contents) == 1: |
175 if "can" in contents: | |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
176 return Result(_("The laser welder needs something to weld the" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
177 " can to.")) |
329 | 178 elif "tube" in contents: |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
179 return Result(_("The laser welder needs something to weld the" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
180 " tube fragments to.")) |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
181 else: |
792
bdaffaa8b6bf
Loading and saving! (Plus a bunch of other stuff to make it possible.)
Jeremy Thurgood <firxen@gmail.com>
parents:
770
diff
changeset
|
182 welder_slot.set_data("contents", []) |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
753
diff
changeset
|
183 welder_slot.set_interact() |
816 | 184 if self.game.is_in_inventory("cryo_pipes_one:"): |
185 self.game.replace_inventory_item("cryo_pipes_one:", | |
539
11530992924a
PEP8 clean-up for engine, machine and mess.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
528
diff
changeset
|
186 "cryo_pipes_two") |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
187 return Result(_("With high-precision spitzensparken, you weld" |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
188 " together a second pipe. You bundle the two" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
189 " pipes together."), soundfile='laser.ogg') |
816 | 190 elif self.game.is_in_inventory("cryo_pipes_two:"): |
191 self.game.replace_inventory_item("cryo_pipes_two:", | |
539
11530992924a
PEP8 clean-up for engine, machine and mess.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
528
diff
changeset
|
192 "cryo_pipes_three") |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
193 return Result(_("With high-precision spitzensparken, you" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
194 " create yet another pipe. You store it with" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
195 " the other two."), soundfile='laser.ogg') |
816 | 196 elif self.game.is_in_inventory("cryo_pipes_three:"): |
329 | 197 # just for safety |
459 | 198 return None |
329 | 199 else: |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
592
diff
changeset
|
200 self.game.add_inventory_item("cryo_pipes_one") |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
201 return Result(_("With high-precision spitzensparken, the can" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
202 " and tube are welded into a whole greater" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
203 " than the sum of the parts."), |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
204 soundfile='laser.ogg') |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
205 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
206 |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
207 class LaserWelderPowerLights(Thing): |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
208 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
209 NAME = "machine.welder.lights" |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
210 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
211 INTERACTS = { |
539
11530992924a
PEP8 clean-up for engine, machine and mess.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
528
diff
changeset
|
212 "lights": InteractAnimated(199, 273, ["power_lights_%d.png" % i for i |
11530992924a
PEP8 clean-up for engine, machine and mess.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
528
diff
changeset
|
213 in range(8) + range(6, 0, -1)], |
11530992924a
PEP8 clean-up for engine, machine and mess.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
528
diff
changeset
|
214 10), |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
215 } |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
216 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
217 INITIAL = 'lights' |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
218 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
219 def get_description(self): |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
220 return _("The power lights pulse expectantly.") |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
221 |
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
222 |
329 | 223 class CryoPipesOne(Item): |
224 "A single cryo pipe (made from a tube fragment and can)." | |
225 | |
816 | 226 NAME = 'cryo_pipes_one' |
329 | 227 INVENTORY_IMAGE = "cryo_pipes_one.png" |
228 CURSOR = CursorSprite('cryo_pipes_one_cursor.png') | |
229 TOOL_NAME = "cryo_pipes_one" | |
230 | |
231 | |
232 class CryoPipesTwo(Item): | |
233 "Two cryo pipes (each made from a tube fragment and can)." | |
226 | 234 |
816 | 235 NAME = 'cryo_pipes_two' |
329 | 236 INVENTORY_IMAGE = "cryo_pipes_two.png" |
237 CURSOR = CursorSprite('cryo_pipes_two_cursor.png') | |
238 TOOL_NAME = "cryo_pipes_two" | |
239 | |
240 | |
241 class CryoPipesThree(Item): | |
242 "Three cryo pipes (each made from a tube fragment and can)." | |
243 | |
816 | 244 NAME = 'cryo_pipes_three' |
329 | 245 INVENTORY_IMAGE = "cryo_pipes_three.png" |
246 CURSOR = CursorSprite('cryo_pipes_three_cursor.png') | |
247 TOOL_NAME = "cryo_pipes_three" | |
226 | 248 |
249 | |
194 | 250 class Grinder(Thing): |
251 | |
252 NAME = "machine.grinder" | |
253 | |
254 INTERACTS = { | |
281
eb3cfcaff469
Too long since last commit. Felt like showing off some machine room progress.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
263
diff
changeset
|
255 "grind": InteractNoImage(86, 402, 94, 63), |
194 | 256 } |
257 | |
258 INITIAL = "grind" | |
259 | |
260 def interact_without(self): | |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
261 return Result(_("It looks like it eats fingers. Perhaps a different" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
262 " approach is in order?")) |
194 | 263 |
264 def interact_with_titanium_leg(self, item): | |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
592
diff
changeset
|
265 self.game.replace_inventory_item(item.name, 'machete') |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
266 return Result(_("After much delicate grinding and a few close calls" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
267 " with various body parts, the titanium femur now" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
268 " resembles a machete more than a bone. Nice and" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
269 " sharp, too."), soundfile="grinder.ogg") |
194 | 270 |
271 def get_description(self): | |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
272 return _("A pretty ordinary, albeit rather industrial, grinding" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
273 " machine.") |
194 | 274 |
275 | |
276 class TitaniumMachete(Item): | |
277 "Titanium machete, formerly a leg." | |
278 | |
816 | 279 NAME = 'machete' |
307
5031b84fbb4c
Hook up new machete, can_opener, and titanium_femur images
Stefano Rivera <stefano@rivera.za.net>
parents:
306
diff
changeset
|
280 INVENTORY_IMAGE = "machete.png" |
5031b84fbb4c
Hook up new machete, can_opener, and titanium_femur images
Stefano Rivera <stefano@rivera.za.net>
parents:
306
diff
changeset
|
281 CURSOR = CursorSprite('machete_cursor.png', 23, 1) |
194 | 282 |
283 | |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
284 class ManualThing(TakeableThing): |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
285 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
286 NAME = "machine.manual" |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
287 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
288 INTERACTS = { |
333 | 289 "manual": InteractImage(432, 493, "manual_on_floor.png"), |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
290 } |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
291 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
292 INITIAL = "manual" |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
293 ITEM = 'manual' |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
294 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
295 def interact_without(self): |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
296 self.take() |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
466
diff
changeset
|
297 return Result(_("Ah! The ship's instruction manual. You'd feel better" |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
298 " if the previous owner wasn't lying next to it with a" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
299 " gaping hole in his rib cage.")) |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
300 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
301 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
302 class Manual(Item): |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
303 "A ship instruction manual." |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
304 |
816 | 305 NAME = 'manual' |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
306 INVENTORY_IMAGE = "manual.png" |
384
56a05ae56574
Initial manual implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
372
diff
changeset
|
307 CURSOR = None |
56a05ae56574
Initial manual implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
372
diff
changeset
|
308 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
513
diff
changeset
|
309 def is_interactive(self, tool=None): |
513
0e8487038834
fixed crash caused by the manual item's special snowflakeness
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
512
diff
changeset
|
310 return True |
0e8487038834
fixed crash caused by the manual item's special snowflakeness
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
512
diff
changeset
|
311 |
512 | 312 def interact_without(self): |
384
56a05ae56574
Initial manual implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
372
diff
changeset
|
313 return Result(detail_view='manual_detail') |
317
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
314 |
3d1a5c0c362a
Split laser welder slot and on button. Add manual thing. Add descriptions for drill press and block.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
307
diff
changeset
|
315 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
316 SCENES = [Machine] |