Hooks and identity¶
Extension API. Bind an actor identity to a world handle and react to world lifecycle events.
ActorCtx
¶
Identity and permissions of the caller.
| Field | Type | Default | Description |
|---|---|---|---|
id |
UUID |
required |
Stable actor identifier used by audit records. |
roles |
set[str] |
generated by <lambda> |
Roles granted to this actor. |
| Field | Type | Default |
|---|---|---|
world_id |
str |
required |
| Field | Type | Default |
|---|---|---|
world_id |
str |
required |
tick |
int |
required |
PostTick
dataclass
¶
Fire after processors finish and the tick is persisted.
tick is the next tick; the completed tick is tick - 1.
| Field | Type | Default |
|---|---|---|
world_id |
str |
required |
tick |
int |
required |
results |
dict[ArchetypeSignature, DataFrame] |
required |
OnSpawn
dataclass
¶
Fire after an entity is registered but before its first row is persisted.
| Field | Type | Default |
|---|---|---|
world_id |
str |
required |
entity_id |
int |
required |
components |
list[Component] |
required |
OnDespawn
dataclass
¶
Fire after an entity is removed from active state.
| Field | Type | Default |
|---|---|---|
world_id |
str |
required |
entity_id |
int |
required |
OnComponentAdded
dataclass
¶
Fire after component types are added to an entity.
components contains the supplied additions, not the entity's complete
component set.
| Field | Type | Default |
|---|---|---|
world_id |
str |
required |
entity_id |
int |
required |
components |
list[Component] |
required |
OnComponentRemoved
dataclass
¶
Fire after component types are removed from an entity.
| Field | Type | Default |
|---|---|---|
world_id |
str |
required |
entity_id |
int |
required |
component_types |
list[type[Component]] |
required |
OnDestroy
dataclass
¶
Fire immediately before a world is destroyed.
Handlers can perform cleanup or final reads while the world is still live.
| Field | Type | Default |
|---|---|---|
world_id |
str |
required |