comparison gamelib/scenes/mess.py @ 306:bd9a760eeb18

Hook up canopener. Fix for replace_inventory changes
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 28 Aug 2010 01:28:51 +0200
parents 6d93e04036c9
children 1208bb5eaf6f
comparison
equal deleted inserted replaced
305:75783238f73d 306:bd9a760eeb18
55 return self.interact_with_full_can(item, state) 55 return self.interact_with_full_can(item, state)
56 56
57 def interact_with_machete(self, item, state): 57 def interact_with_machete(self, item, state):
58 return Result("You'd mangle it beyond usefulness.") 58 return Result("You'd mangle it beyond usefulness.")
59 59
60 def interact_with_canopener(self, item, state):
61 empty = EmptyCan('empty_can')
62 state.add_item(empty)
63 state.replace_inventory_item(self.name, empty.name)
64 return Result("You open both ends of the can, discarding the hideous contents.")
65
60 66
61 class EmptyCan(BaseCan): 67 class EmptyCan(BaseCan):
62 "After emptying the full can." 68 "After emptying the full can."
63 69
64 INVENTORY_IMAGE = "empty_can.png" 70 INVENTORY_IMAGE = "empty_can.png"
65 CURSOR = CursorSprite('empty_can_cursor.png') 71 CURSOR = CursorSprite('empty_can_cursor.png')
66 72
67 def interact_with_titanium_leg(self, item, state): 73 def interact_with_titanium_leg(self, item, state):
68 return Result("Flattening the can doesn't look like a useful thing to do.") 74 return Result("Flattening the can doesn't look like a useful thing to do.")
75
76 def interact_with_canopener(self, item, state):
77 return Result("There's nothing left to open on this can")
69 78
70 79
71 class FullCan(BaseCan): 80 class FullCan(BaseCan):
72 "Found on the shelf." 81 "Found on the shelf."
73 82
75 CURSOR = CursorSprite('full_can_cursor.png') 84 CURSOR = CursorSprite('full_can_cursor.png')
76 85
77 def interact_with_titanium_leg(self, item, state): 86 def interact_with_titanium_leg(self, item, state):
78 dented = DentedCan("dented_can") 87 dented = DentedCan("dented_can")
79 state.add_item(dented) 88 state.add_item(dented)
80 state.replace_inventory_item(self, dented) 89 state.replace_inventory_item(self.name, dented.name)
81 return Result("You club the can with the femur. The can gets dented, but doesn't open.", soundfile="can_hit.ogg") 90 return Result("You club the can with the femur. The can gets dented, but doesn't open.", soundfile="can_hit.ogg")
82 91
83 92
84 class DentedCan(BaseCan): 93 class DentedCan(BaseCan):
85 "A can banged on with the femur" 94 "A can banged on with the femur"