Crossfire Server, Branches 1.12  R18729
Archetypes

Archetypes define the standard properties of predefined objects: monsters, weapons, armours, walls, spells, etc. Most objects in a map are equivalent to their archetype definition, but it is of course possible to define special properties for specific needs.

Archetypes are not manipulated at runtime (with the exception of temporary archetypes, see below), and are loaded into memory during the server startup.

Archetypes are defined in the arch Subversion module. The definition is split in many .arc files, usually one per predefined item.

Archetype manipulation functions are defined in the arch.c file, and the structure is archt.

Archetypes collection

In order for archetypes to be usable by the server, they need to be collected into the lib/archetypes file. This is merely the concatenation of all .arc files, bundled together for distribution/installation ease.

The lib/collect.pl script handles this collecting process.

Objects in objects

It is possible to add objects in an archetype's inventory. All objects created from this archetype will have a copy of those objects, and additional objects if defined.

To add an object in an archetype, just add a arch archetype_name in the file, followed by custom values for the objects, finished by an end tag. This is equivalent to the format used for saving objects on maps.

Temporary archetypes

Temporary archetypes are special archetypes used for custom monsters. When the map loading code detects a customized monster, it will create a temporary archetype that will contain the initial values of the monster.

This temporary archetype is required for the custom values to survive a call to fix_object(), call that will happen when the monster picks/drops items, is cursed, etc.

Temporary archetypes will be automatically destroyed when the last object they are linked to is free_object()'d.