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

StatesConfig

A machine, as states takes it: XState’s config, with id the name its trait dumps and streams under.

Type Parameter Default type
Context extends MachineContext -
States extends Record<string, StateConfig<Context>> -
On extends Record<string, TransitionTarget<Context>> -
Tagged extends boolean boolean
Id extends string string
Property Type Description
context? Context Each field’s value on a fresh trait.
description? string -
heldBy? readonly Trait[] Traits that hold this machine alone where it is, as MachinePausedTrait holds every machine: on an entity with one of them, its wait counts no seconds and its when rules go untested, while the entity’s other machines run on. An NPC’s routine names TalkingTrait.
id Id The machine’s name: its trait dumps, streams and checkpoints under it, the devtools list it by it, and a target names a state from the top by it, as #id.state.
initial Extract<keyof States, string> -
on? On Events every state takes. Its targets name a state from the machine’s top, as XState’s do there: after a dot, .state.child, or by the machine’s id, #id.state.child.
ownerOnly? boolean Whether a room streams its trait to the player whose character holds it and to nobody else, as it streams her bag, as Unreal’s COND_OwnerOnly does: for a machine on a character that is hers alone, such as a conversation’s. The dump shows it.
states States -
tags? Tagged false leaves the states’ tags off, so is is empty and the machine writes its record alone: for a machine many kinds of entity each declare their own of, such as an NPC’s routines, whose systems read the state from read. Each tag is a koota trait, and the dump tests each entity for every one.