Mercurial > pyntnclick
comparison gamelib/scenes/machine.py @ 194:9887c68110d8
Sharp things.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Wed, 25 Aug 2010 23:23:37 +0200 |
parents | 738608e90e9c |
children | 6a52752f4920 |
comparison
equal
deleted
inserted
replaced
193:738608e90e9c | 194:9887c68110d8 |
---|---|
1 """Machine room where tools and machines are found.""" | 1 """Machine room where tools and machines are found.""" |
2 | 2 |
3 from gamelib.state import Scene, Item, Thing, InteractText, Result | 3 from gamelib.state import Scene, Item, Thing, InteractText, Result |
4 from gamelib.cursor import CursorSprite | |
4 | 5 |
5 | 6 |
6 class Machine(Scene): | 7 class Machine(Scene): |
7 | 8 |
8 FOLDER = "machine" | 9 FOLDER = "machine" |
14 | 15 |
15 def __init__(self, state): | 16 def __init__(self, state): |
16 super(Machine, self).__init__(state) | 17 super(Machine, self).__init__(state) |
17 self.add_thing(ToMap()) | 18 self.add_thing(ToMap()) |
18 self.add_thing(LaserWelder()) | 19 self.add_thing(LaserWelder()) |
20 self.add_thing(Grinder()) | |
21 self.add_item(TitaniumMachete('titanium_machete')) | |
19 | 22 |
20 def enter(self): | 23 def enter(self): |
21 return Result("The machine room is dark and forbidding.") | 24 return Result("The machine room is dark and forbidding.") |
22 | 25 |
23 | 26 |
89 elif self.get_data('cans_in_place') == 3: | 92 elif self.get_data('cans_in_place') == 3: |
90 msg += " It currently contains three empty cans." | 93 msg += " It currently contains three empty cans." |
91 return msg | 94 return msg |
92 | 95 |
93 | 96 |
97 class Grinder(Thing): | |
98 | |
99 NAME = "machine.grinder" | |
100 | |
101 INTERACTS = { | |
102 "grind": InteractText(200, 300, "Grinder"), | |
103 } | |
104 | |
105 INITIAL = "grind" | |
106 | |
107 def interact_without(self): | |
108 return Result("It looks like it eats fingers. Perhaps a different approach is in order?") | |
109 | |
110 def interact_with_titanium_leg(self, item): | |
111 self.state.replace_inventory_item(item, self.state.items['titanium_machete']) | |
112 return Result("After much delicate grinding and a few close calls with" | |
113 " various body parts, the titanium femur now resembles" | |
114 " a machete more than a bone. Nice and sharp, too.") | |
115 | |
116 def get_description(self): | |
117 return "A pretty ordinary, albeit rather industrial, grinding machine." | |
118 | |
119 | |
120 class TitaniumMachete(Item): | |
121 "Titanium machete, formerly a leg." | |
122 | |
123 INVENTORY_IMAGE = "triangle.png" | |
124 CURSOR = CursorSprite('titanium_femur_cursor.png', 47, 3) | |
125 | |
126 | |
94 SCENES = [Machine] | 127 SCENES = [Machine] |