diff options
| author | Thomas Kluyver <takowl@gmail.com> | 2013-01-13 15:35:49 +0000 |
|---|---|---|
| committer | Thomas Kluyver <takowl@gmail.com> | 2013-01-13 15:35:49 +0000 |
| commit | 727343ffdc825be9e7981a57cf592594f358da94 (patch) | |
| tree | 6e3f122bf8b5b8b156a3316eb10a7f647e449fdc /doc | |
| parent | 8ac7a65685ffe58529087bbe5a0063d1e0168f5c (diff) | |
Document combining items
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/api_misc.rst | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/api_misc.rst b/doc/api_misc.rst index 674ab08..3a68d81 100644 --- a/doc/api_misc.rst +++ b/doc/api_misc.rst @@ -24,6 +24,26 @@ Understanding commands .. automodule:: weatbag.words +Combining items +--------------- + +To allow items to be combined to form other items, add a module in ``weatbag.items`` +with the same name as one of the items, replacing spaces with underscores. There, +define a function called ``combine``, which will take the name of a second +object. You only need to define this for one object; the game will try to find +it for both objects being combined. + +If the objects can be combined, it should describe what has happened, and return +a list of the new objects created. Otherwise, it should return ``None``. For +example, this function is in :mod:`weatbag.items.unlit_torch`:: + + def combine(other): + if other == 'match': + print("The torch sputters into life.") + return ['flaming torch'] + + return None + Utility functions ----------------- |
