In-game tools · interface

InspectableWorld

What the inspector needs of a world.

Explained in In-game tools.

interface InspectableWorld
import type { InspectableWorld } from '@driftengine/tools';

In depth

Four reads and three writes, so a panel can be tested against plain maps — this plan's second constraint — and so the same panel serves @driftengine/entities, a .drs file's declarations and anything else that can answer these. A caller holding a World wraps it in seven lines.

Methods

componentsOf

componentsOf(entity: number): readonly string[]
ParameterTypeDescription
entitynumber

schemaOf

schemaOf(component: string): readonly { readonly name: string; readonly type: string; }[]
ParameterTypeDescription
componentstring

read

read(entity: number, component: string, field: string): unknown
ParameterTypeDescription
entitynumber
componentstring
fieldstring

write

write(entity: number, component: string, field: string, value: unknown): void
ParameterTypeDescription
entitynumber
componentstring
fieldstring
valueunknown

hasComponent

hasComponent(entity: number, component: string): boolean
ParameterTypeDescription
entitynumber
componentstring

addComponent

addComponent(entity: number, component: string): void
ParameterTypeDescription
entitynumber
componentstring

removeComponent

removeComponent(entity: number, component: string): void
ParameterTypeDescription
entitynumber
componentstring