Mercurial > pyntnclick
comparison gamelib/scenes/machine.py @ 792:bdaffaa8b6bf pyntnclick
Loading and saving! (Plus a bunch of other stuff to make it possible.)
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 27 Jan 2013 12:43:28 +0200 |
parents | a35f5364437d |
children | eed75a1d50c4 |
comparison
equal
deleted
inserted
replaced
791:56ec01e51f3d | 792:bdaffaa8b6bf |
---|---|
97 } | 97 } |
98 | 98 |
99 INITIAL = "empty" | 99 INITIAL = "empty" |
100 | 100 |
101 INITIAL_DATA = { | 101 INITIAL_DATA = { |
102 'contents': set(), | 102 'contents': [], |
103 } | 103 } |
104 | 104 |
105 def select_interact(self): | 105 def select_interact(self): |
106 contents = self.get_data('contents') | 106 contents = self.get_data('contents') |
107 if not contents: | 107 if not contents: |
120 def interact_with_empty_can(self, item): | 120 def interact_with_empty_can(self, item): |
121 contents = self.get_data('contents') | 121 contents = self.get_data('contents') |
122 if "can" in contents: | 122 if "can" in contents: |
123 return Result(_("There is already a can in the welder.")) | 123 return Result(_("There is already a can in the welder.")) |
124 self.game.remove_inventory_item(item.name) | 124 self.game.remove_inventory_item(item.name) |
125 contents.add("can") | 125 contents.append("can") |
126 self.set_interact() | 126 self.set_interact() |
127 return Result(_("You carefully place the can in the laser welder.")) | 127 return Result(_("You carefully place the can in the laser welder.")) |
128 | 128 |
129 def interact_with_tube_fragment(self, item): | 129 def interact_with_tube_fragment(self, item): |
130 contents = self.get_data('contents') | 130 contents = self.get_data('contents') |
131 if "tube" in contents: | 131 if "tube" in contents: |
132 return Result(_("There is already a tube fragment in the welder.")) | 132 return Result(_("There is already a tube fragment in the welder.")) |
133 self.game.remove_inventory_item(item.name) | 133 self.game.remove_inventory_item(item.name) |
134 contents.add("tube") | 134 contents.append("tube") |
135 self.set_interact() | 135 self.set_interact() |
136 return Result(_("You carefully place the tube fragments in the" | 136 return Result(_("You carefully place the tube fragments in the" |
137 " laser welder.")) | 137 " laser welder.")) |
138 | 138 |
139 def get_description(self): | 139 def get_description(self): |
177 " can to.")) | 177 " can to.")) |
178 elif "tube" in contents: | 178 elif "tube" in contents: |
179 return Result(_("The laser welder needs something to weld the" | 179 return Result(_("The laser welder needs something to weld the" |
180 " tube fragments to.")) | 180 " tube fragments to.")) |
181 else: | 181 else: |
182 welder_slot.set_data("contents", set()) | 182 welder_slot.set_data("contents", []) |
183 welder_slot.set_interact() | 183 welder_slot.set_interact() |
184 if self.game.is_in_inventory("cryo_pipes_one"): | 184 if self.game.is_in_inventory("cryo_pipes_one"): |
185 self.game.replace_inventory_item("cryo_pipes_one", | 185 self.game.replace_inventory_item("cryo_pipes_one", |
186 "cryo_pipes_two") | 186 "cryo_pipes_two") |
187 return Result(_("With high-precision spitzensparken, you weld" | 187 return Result(_("With high-precision spitzensparken, you weld" |