Skip to content

Builtin

const Builtin: object

Defined in: index.ts:46

A collection of built-in Handles.

AddedByPlugin: ComponentHandle<undefined>

Built-in component used as a relation for entities spawned within plugins.

ChildOf: ComponentHandle<undefined>

Built-in component used to represent parent-child relationships between entities.

const alice = entity()
const bob = entity().set(pair(ChildOf, alice))
assert(bob.parent() === alice)

Component: ComponentHandle<undefined>

Built-in component used to distinguish entities that represent components.

Internal: ComponentHandle<undefined>

Built-in component used to distinguish entities created internally by Toucan.

Label: ComponentHandle<string>

Built-in component used by Toucan to assign human-readable labels to entities.

Persistent: ComponentHandle<undefined>

Built-in component used to…

  1. Mark entities that cannot be despawned by any means;
  2. Mark components that cannot be removed by any means.

Plugin: ComponentHandle<{ args: unknown[]; built: boolean; fn: PluginFn; }>

Built-in component used to distinguish entities that represent plugins.

Resource: ComponentHandle<undefined>

Built-in component used to distinguish entities that represent resources.

Schedule: ComponentHandle<{ kind: Schedules; }>

Built-in component used to distinguish entities that represent schedules.

System: ComponentHandle<{ after: (SystemFn<unknown[]> | SystemSet)[]; args: unknown[]; before: (SystemFn<unknown[]> | SystemSet)[]; fn: SystemFn; runIfs: RunCondition[]; schedule: Schedules; }>

Built-in component used to distinguish entities that represent systems.

ThirdParty: ComponentHandle<undefined>

Built-in component used to distinguish entities created by third-party packages.

Wildcard: ComponentHandle<undefined>

Built-in component that acts as a wildcard in queries. It has two use cases:

  1. To query for all entities, including variations, such as components, systems and so on;
  2. To query for all sources or targets of a relationship, without caring about the other end of the relationship.
// 1. Query all simple entities (entities that are not also components, systems, resources or plugins):
query(Wildcard).withoutAny(Component, System, Resource, Plugin).forEach((id) => {
...
})
// 2. Query all entities that are children of any other entity:
query(pair(ChildOf, Wildcard)).forEach((child) => {
const parent = child.targetOf(ChildOf)
})