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

PlayScope

What a read of the page sees: the world as a dump files it, the engine’s own state, the live world and scene, the game’s modules, the reads of what the camera sees and aims at, and the director’s input and time.

Property Modifier Type Description
at readonly number | undefined The moment a replay’s page stands on, in seconds; undefined on a live page.
camera readonly EngineCamera | undefined The engine’s camera, loop, cursor and room, as spawnite play state reads them; undefined in a world with no page.
cursor readonly EngineCursor | undefined -
entities readonly Record<string, Record<string, unknown>> Every entity’s traits, as spawnite play dump files them.
input readonly PlayInput -
loop readonly EngineLoop | undefined -
room readonly EngineRoom | undefined -
steps readonly number | undefined Steps a step has taken toward its condition; undefined outside one.
three readonly RootState | undefined React Three Fiber’s state: the scene, the camera, the renderer and the canvas’s size; undefined in a world with no page.
time readonly PlayTime -
views readonly Record<string, Record<string, unknown>> What each view exposes through useInspect, by entity key or page.
world readonly World The Koota world the page runs.

aim(): AimReading

Where the crosshair points, and the shots the page sent beside it.

AimReading


count(trait): number

How many entities hold the trait.

Parameter Type
trait string

number


engine<Module>(): Module

The engine’s own module, as the game loaded it: its traits read the world’s entities, as find(subject)[0].get(engine().TransformTrait). A typed read names the module, as engine<typeof import("@spawnite/engine")>().

Type Parameter Default type
Module Readonly<Record<string, unknown>>

Module


find(subject): Entity[]

The entities a subject picks, as spawnite play dump --where reads one: a dump key, a selector such as [monster.kind=colossus], or a row’s name.

Parameter Type
subject string

Entity[]


has(key, trait): boolean

Whether the entity filed under key holds the trait.

Parameter Type
key string
trait string

boolean


load<Module>(path): Promise<Module>

One of the game’s modules by its path from the game’s folder, such as src/siege/traits.ts: the instance the game runs.

Type Parameter Default type
Module Record<string, unknown>
Parameter Type
path string

Promise<Module>


player(): Record<string, unknown> | undefined

The player’s character’s traits, as the dump files them.

Record<string, unknown> | undefined


see(subject?, options?): Sighting[]

What the player’s camera sees of each entity a subject picks, or of every entity it draws.

Parameter Type
subject? string
options? SeeOptions

Sighting[]