takluyver/weatbag — pull request #9 by kkpattern (2013-01-11 11:58:20+00:00)
Title: Add item interface

I try to add the item interface like the tile interface. If you want to create a new item, just create a module like `weatbag.items.sword` and then define the following methods in the module:

```python
def take(tile, player):
# Called when player try to take the item.
...

def use(tile, player):
# Called when player try to use the item.
...

def drop(tile, player):
# Called when player try to drop the item.
...
```
Then, when player try to pick or use the item in the game, just do:

```python
from weatbag.items import take
...
class Tile:
...
def action(self, player, do):
...
if do[0] in words.take:
take(do[1], self, player)
...
```
I rewrote the code about berries as an example.
If you guys have any better ideas please tell me, I am happy to know.