DSB/Archetypes
Overview
An Archetype is a general category of item, such as "Axe", "Iron Keyhole", "Screamer" or "Wooden Door".
The base code defines hundreds of different archetypes that fall into broad categories. Every archetype has a number of properties that define its type, graphics, sounds and behaviour. There are many different properties available, and different types of archetypes will use different properties. Every customisation you make to a dungeon object is made by altering or adding to the properties of its archetype.
Here's a very basic example of a simple archetype, an apple, as defined in DSBs base code:
obj.apple = { name="APPLE", type="THING", shortdesc="CONSUMABLE", class="FOOD", mass=4, icon=gfx.icons[168], dungeon=gfx.apple, foodval=500, fit_pouch = true, on_consume=eatdrink }
Types
An archetype's TYPE defines its core behaviour. For example, type "DOOR" automatically sets the item to behave as a door, while type "THING" is anything that can be picked up by the party.
Here's the full list of types, and a brief explanation of how they are used. Follow the Properties link under each type to learn more about the properties you can set for that type. (This is fairly core to DSB customisation, so it's a good idea to familiarise yourself with these properties.)
- UNDEFINED
- Special types used by core engine system functions
- FLOORFLAT
- A dungeon object that sits on a tile, such as a drain, pit, trigger, movable wall, etc. Floorflats include decorative items as well as dungeon mechanics. By default, foorflats occupy an entire tile and are placed in the centre of a tile when using the ESB editor. You can also move floorflats to the corners of a tile, but this may invoke odd behaviour.
- FLOORUPRIGHT
- Flooruprights are items that sit within the centre of a tile and may block or otherwise affect party progress. The default items of this type are stairs and doorframes, but you can create new types such as tables, pillars and statues.
Classes
Classes are used to arrange archetypes into sensible groups for easy identification in the editor, ESB. Classes do not define any behaviour, graphics or sounds are are simply labels collecting together similar archetypes. For example, the DECO class is used to identify archetypes that are certain style of decorative dungeon object.
Classes can be used to sub-group items based on their type. For example, both the FLOORFLAT type and the WALLITEM type contain a DECO class. This is useful for quickly finding the archetype you need while building your dungeon in the editor.