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.
Properties
Section titled “Properties”| 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. |
Methods
Section titled “Methods”aim():
AimReading
Where the crosshair points, and the shots the page sent beside it.
Returns
Section titled “Returns”AimReading
count()
Section titled “count()”count(
trait):number
How many entities hold the trait.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
trait |
string |
Returns
Section titled “Returns”number
engine()
Section titled “engine()”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 Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Module |
Readonly<Record<string, unknown>> |
Returns
Section titled “Returns”Module
find()
Section titled “find()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
subject |
string |
Returns
Section titled “Returns”Entity[]
has(
key,trait):boolean
Whether the entity filed under key holds the trait.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
string |
trait |
string |
Returns
Section titled “Returns”boolean
load()
Section titled “load()”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 Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Module |
Record<string, unknown> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
path |
string |
Returns
Section titled “Returns”Promise<Module>
player()
Section titled “player()”player():
Record<string,unknown> |undefined
The player’s character’s traits, as the dump files them.
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
subject? |
string |
options? |
SeeOptions |
Returns
Section titled “Returns”Sighting[]