Man extensions
From LSWiki
Revision as of 16:46, 11 June 2007 (edit) Laine (Talk | contribs) ← Previous diff |
Current revision (16:46, 11 June 2007) (edit) Laine (Talk | contribs) |
Current revision
Files
/mod/basic/extensions.c /std/extension.c /obj/extensions/
Description
The extensions mechanism is a general method of attaching functionality modules to objects. It is specifically intended to replace the (extremely troublesome) method of adding functionality by multiple inheritance.
Generally, all you need to do in order to use extensions, as a content developer, is to place a statement like the following in a configure():
add_extension(LS_Extension("post_office"));
This example is how you add post office functionality to a room. The LS_Extension() macro is from master.h (do #include <master.h>), and should always be used instead of literal pathnames.
Extensions are supported by anything that inherits /std/item, /std/room, /std/daemon, or /mod/character/body.
The lib's supply of extension modules is located in /obj/extensions, which is the directory referred to by the LS_Extension() macro.
In their internals, extensions work in a matter fairly similar to the affiliation support. More information will be forthcoming at a later date. The curious are referred to the code; the post office extension is a very simple, straightforward example.