This chapter contains information on working with attributes -- setting, getting, iterating over, etc.
When it's done. Which isn't now.
An attribute is a C struct, of type
ATTR, defined in hdrs/attrib.h.
Common tasks related to attributes are described below:
TODO: Describe attribute struct fields
TODO: Child page on getting/setting
TODO: Child page on attribute flags
TODO: Child page on iteration
Adding new builtin attributes or changing existing ones
There are two ways to add a builtin attribute (One that can be set with @NAME as well as &NAME), or change the default permissions for a built-in one:
- Use @attribute from in the game. This is the preferred way, as it involves no source modifications. Changes made with @attribute are not (As of 1.8.3p2) persistent across reboots, so they should go in a @startup.
- Modify hdrs/atr_tab.h. Detailed instructions to follow.
(TODO: Maybe move this to a child page?)
Attributes are stored (As of 1.8.3p2) as a sorted linked list, one per object. Names of all attributes in the database are held in a shared string tree. The text of attributes are stored in the chunk manager. Attribute flags are in a 32-bit int, one bit per flag. It's almost full.
See the attrib.c documentation for API details.