Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

BehaviourConfig

What defineBehaviour takes: the behaviour and its name.

Type Parameter Default type
T extends Trait Trait
Property Type Description
ai? AiDescriber<T> What it is, its state and what can be done with it, in words, from its props: its entity’s node in the AI tree.
description? string One line on what it does, which the inspector shows under its name.
handles? readonly EventHandle<unknown, EventDelivery, EventScope>[] The events its system reads with readEvents or its view hears with useEvent, each made by defineEvent, which the devtools’ wiki links it to.
name string The name the devtools’ Add behaviour offers it by and the Wiki lists it by, which its page at wiki/behaviour/<name>.md takes: camel case, as "trackMover" is. Its trait dumps under it too, unless defineTrait made the trait, which keeps the name it was defined under.
plugin? string The name of the plugin whose system runs it, such as "behaviours" for the engine’s or lamps.name for a game’s own plugin: its component throws where the game does not list that plugin, naming what to add. Left out, the component checks no plugin.
ranges? Partial<Record<keyof TraitRecord<T>, PropRange>> A slider’s bounds, by number prop; a prop left out has no slider.
runsOn? RunContext Where a consequence of it is trusted: Server or Both for one the room decides, whose component takes no callback, and Client, where undeclared, for one a page may hear and answer. A system’s runsOn is its entry’s, not this.
source? string The file that declares it, for a game’s own behaviour, from the game’s own folder, where its dev server opens a file in the editor; the engine’s are documented by their wiki page instead.
trait T -
wiki? string The wiki route that documents it, which describe() hands an agent.