Host types
A script's host type (extends) is not a behaviour but a category: it says what the script can
be attached to, what it can use and, on the client, its entry point. The language knows none of
them; Caria gives them in its catalog.
| Host type | Side | Goes on | For |
|---|---|---|---|
World | server | the world (.world) | decisions for the whole town: power, weather |
Building | server | a building (.building) | a building's fields and the events it receives |
Character | server | a character (.character) | a resident: mood, where they are, their day |
Part | server | a part of a package, an object (.object) | a door, a sign, a lamp |
Area | server | — (coming) | a square, a street |
VisualEffect | client | a part | a part's colour, every frame |
Light | client | a part | the light a part casts, every frame |
- A package is Caria's unit of design: a folder with its document (
object.json) and its model. Its parts are the nodes of its model (a door, a sign's letters). - In the editor, Add Component offers only the scripts whose host type fits the selection:
Buildingscripts on a building,Partscripts on a part or an object, and so on. - A server script is bound to an object of its host type; binding it anywhere else is refused.
Client entry points
| Host type | Entry point | Effect |
|---|---|---|
VisualEffect | function apply(baseColor: color, elapsedSeconds: float): color | pure |
Light | function apply(elapsedSeconds: float): color | pure |
Every Light script declares property reach: float, the distance in metres at which its light
fades out; the view reads it from every binding. See Client scripts.
The calendar
The server side of Caria also gives the calendar, as library functions: year(), month(),
day(), weekday() and season() (Library).