Builtin
constBuiltin:object
Defined in: index.ts:46
A collection of built-in Handles.
Type Declaration
Section titled “Type Declaration”AddedByPlugin
Section titled “AddedByPlugin”AddedByPlugin:
ComponentHandle<undefined>
Built-in component used as a relation for entities spawned within plugins.
ChildOf
Section titled “ChildOf”ChildOf:
ComponentHandle<undefined>
Built-in component used to represent parent-child relationships between entities.
Example
Section titled “Example”const alice = entity()const bob = entity().set(pair(ChildOf, alice))assert(bob.parent() === alice)Component
Section titled “Component”Component:
ComponentHandle<undefined>
Built-in component used to distinguish entities that represent components.
Internal
Section titled “Internal”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
Section titled “Persistent”Persistent:
ComponentHandle<undefined>
Built-in component used to…
- Mark entities that cannot be despawned by any means;
- Mark components that cannot be removed by any means.
Plugin
Section titled “Plugin”Plugin:
ComponentHandle<{args:unknown[];built:boolean;fn:PluginFn; }>
Built-in component used to distinguish entities that represent plugins.
Resource
Section titled “Resource”Resource:
ComponentHandle<undefined>
Built-in component used to distinguish entities that represent resources.
Schedule
Section titled “Schedule”Schedule:
ComponentHandle<{kind:Schedules; }>
Built-in component used to distinguish entities that represent schedules.
System
Section titled “System”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
Section titled “ThirdParty”ThirdParty:
ComponentHandle<undefined>
Built-in component used to distinguish entities created by third-party packages.
Wildcard
Section titled “Wildcard”Wildcard:
ComponentHandle<undefined>
Built-in component that acts as a wildcard in queries. It has two use cases:
- To query for all entities, including variations, such as components, systems and so on;
- To query for all sources or targets of a relationship, without caring about the other end of the relationship.
Example
Section titled “Example”// 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)})