comparison gamelib/scenes/mess.py @ 228:ce1e85768f7b

Flavour interactions for mess hall
author Neil Muller <neil@dip.sun.ac.za>
date Thu, 26 Aug 2010 23:11:32 +0200
parents a5325919342e
children ec2682b373e7
comparison
equal deleted inserted replaced
227:be4ac4418aa2 228:ce1e85768f7b
1 """Mess where crew eat. Fun stuff.""" 1 """Mess where crew eat. Fun stuff."""
2 2
3 from random import choice 3 from random import choice
4 4
5 from gamelib.state import Scene, Item, CloneableItem, Thing, InteractImage, InteractNoImage, Result 5 from gamelib.state import Scene, Item, CloneableItem, Thing, InteractImage, InteractNoImage, Result
6 from gamelib.statehelpers import GenericDescThing
6 from gamelib.cursor import CursorSprite 7 from gamelib.cursor import CursorSprite
7 8
8 9
9 class Mess(Scene): 10 class Mess(Scene):
10 11
18 def __init__(self, state): 19 def __init__(self, state):
19 super(Mess, self).__init__(state) 20 super(Mess, self).__init__(state)
20 self.add_thing(CansOnShelf()) 21 self.add_thing(CansOnShelf())
21 self.add_thing(Tubes()) 22 self.add_thing(Tubes())
22 self.add_thing(ToMap()) 23 self.add_thing(ToMap())
24 # Flavour items
25 # extra cans on shelf
26 self.add_thing(GenericDescThing('mess.cans', 1,
27 "A large collection of rusted, useless cans",
28 (
29 (154, 335, 89, 106),
30 (152, 435, 63, 66),
31 )))
32 self.add_thing(GenericDescThing('mess.broccoli', 2,
33 "An impressively overgrown broccoli.",
34 (
35 (503, 89, 245, 282),
36 (320, 324, 229, 142),
37 )))
38 self.add_thing(GenericDescThing('mess.cans', 2,
39 "Empty plastic containers. They used to hold dish washer soap",
40 ((565, 399, 62, 95),)))
41
23 42
24 43
25 class BaseCan(CloneableItem): 44 class BaseCan(CloneableItem):
26 """Base class for the cans""" 45 """Base class for the cans"""
27 46
124 "status": "blocked", 143 "status": "blocked",
125 "pipes_replaced": 0, 144 "pipes_replaced": 0,
126 "fixed": False, 145 "fixed": False,
127 } 146 }
128 147
148 def get_description(self):
149 return "The brocolli seems to have become entangled with something"
150
129 def interact_with_machete(self, item): 151 def interact_with_machete(self, item):
130 if self.get_data("status") == "blocked": 152 if self.get_data("status") == "blocked":
131 self.set_data("status", "broken") 153 self.set_data("status", "broken")
132 self.set_interact("broken") 154 self.set_interact("broken")
133 return Result("With a flurry of disgusting mutant vegetable chunks," 155 return Result("With a flurry of disgusting mutant vegetable chunks,"
177 "door": InteractNoImage(20, 390, 85, 150), 199 "door": InteractNoImage(20, 390, 85, 150),
178 } 200 }
179 201
180 INITIAL = "door" 202 INITIAL = "door"
181 203
204 def get_description(self):
205 return "A doorway leads out to the rest of the ship"
206
182 def interact_without(self): 207 def interact_without(self):
183 """Go to map.""" 208 """Go to map."""
184 self.state.set_current_scene("map") 209 self.state.set_current_scene("map")
185 210
186 211