@c -*-texinfo-*-
@node Addons, XML Behaviour Layer, Property Classes, Using CEL
@section Addons
Although you can fully work with Crystal Entity Layer by using C++ @sc{api}
calls, Crystal Entity Layer has a lot of support for @sc{xml}. To supports this
Crystal Entity Layer uses the @dfn{addon} system that is implemented in
the Crystal Space map loader. Basically the addon system allows one to write
plugins that plug into the loader and allow someone to add additional @sc{xml}
parts to the standard world file. Crystal Entity Layer defines several
addons.
@menu
* Addons CelEntity:: CelEntity Addon
* Addons CelEntityTemplate:: CelEntity Template Addon
* Addons XmlScripts:: XML Scripts Addon
* Addons QuestDef:: Quest Definition Addon
@end menu
@node Addons CelEntity, Addons CelEntityTemplate, Addons, Addons
@subsection CelEntity Addon
@cindex celentity addon
With the @samp{cel.addons.celentity} addon you can define your own entities
directly in the world file. Here is an example on how to use that:
@example
@end example
Here you see how an entity is created with the name @samp{SlidingDoor} and
three property classes: @samp{pcmesh} (@pxref{PropClass Mesh}),
@samp{pctrigger}, and @samp{pcquest} (@pxref{PropClass Quest Manager}). For
every property class we can call actions and set properties.
You can create an entity everywhere in the map file where you can use
addons. If you create an entity as a child of a @samp{meshobj} then the
addon will automatically create a @samp{pcmesh} (@pxref{PropClass Mesh})
property class attached to that mesh.
You can also create an entity from an entity template
(@pxref{Addons CelEntityTemplate}) like this:
@example
@end example
Notice how the @samp{pos} parameter is given to the template. Parameters
for templates are always strings but can often be interpreted differently.
In addition to the @samp{pos} parameter there is always an implicit
@samp{this} parameter which will be set to the name of the entity that is
being created. In this particular example it will be equal to @samp{MyEntity}.
@node Addons CelEntityTemplate, Addons XmlScripts, Addons CelEntity, Addons
@subsection CelEntity Template Addon
@cindex celentity template addon
With the @samp{cel.addons.celentitytpl} addon you can define your own entity
templates directly in the world file. Here is an example on how to use that:
@example
@end example
You can define an entity template just like you would define an entity
(@pxref{Addons CelEntity}) except that you can use parameters. The @samp{$this}
parameter will be set to the name of the entity that is being created from
the template. In addition you can also define other parameters at the time
you create an entity from the template. In the example above the @samp{$pos}
parameter is used.
@node Addons XmlScripts, Addons QuestDef, Addons CelEntityTemplate, Addons
@subsection XML Scripts Addon
@cindex XML scripts addon
The @samp{cel.addons.xmlscripts} addon is specifically made for the @sc{xml}
behaviour layer (@pxref{XML Behaviour Layer}) and gives you the option to define
@sc{xml} scripts directly in a world file. Here is an example:
@example
cel.pcfactory.billboard
cel.pcfactory.timer
cel.pcfactory.properties
@end example
This addon allows you to do two things: first you can load a property class
factory with the @samp{pcfactory} operation. Secondly you can create scripts
(corresponding with behaviours) for the @sc{xml} behaviour layer.
@node Addons QuestDef, , Addons XmlScripts, Addons
@subsection Quest Definition Addon
@cindex quest definition addon
With the @samp{cel.addons.questdef} addon you can define quests for the
quest manager (@pxref{PropClass Quest Manager}) directly in a world file.
Here is an example:
@example
@end example