Skip to content

DebugRegistryImpl

Defined in: DebugRegistryImpl.ts:11

Concrete implementation of the DebugRegistry interface.

new DebugRegistryImpl(): DebugRegistryImpl

DebugRegistryImpl

readonly contributors: Map<string, DebugContributor>

Defined in: DebugRegistryImpl.ts:12


enabled: boolean = false

Defined in: DebugRegistryImpl.ts:15


readonly vectors: VectorDrawStore

Defined in: DebugRegistryImpl.ts:14

Backs drawVector; read by the built-in vectors contributor.

drawVector(entity, vector, options?): () => void

Defined in: DebugRegistryImpl.ts:26

Draw an arrow on entity for a vector that is read fresh every frame — velocity, aim direction, knockback, steering output.

// tryResolve, not use(): use() throws without DebugPlugin installed.
const debug = this.context.tryResolve(DebugRegistryKey);
this.stopArrow = debug?.drawVector(this.entity, () => agent.velocity, {
scale: 0.35,
color: 0x4ade80,
minLength: 1,
});

The arrow starts at the entity’s world position (plus options.origin) and points along the vector. Nothing is retained but the provider itself: it is called once per frame while the overlay is on and the vectors contributor’s arrows flag is enabled, and not at all otherwise — a drawVector call in a hot path costs nothing while debug is off.

Returns a disposer that stops the drawing. Calling it twice is harmless. The registration is also dropped when the entity’s life ends — destroyed, or a pool member whose lease ended — so a provider closure never outlives the entity it draws for, and a per-lease registration never accumulates.

Entity

DebugVectorProvider

DebugVectorOptions

() => void

DebugRegistry.drawVector


isEnabled(): boolean

Defined in: DebugRegistryImpl.ts:34

boolean

DebugRegistry.isEnabled


isFlagEnabled(contributorName, flag): boolean

Defined in: DebugRegistryImpl.ts:38

string

string

boolean

DebugRegistry.isFlagEnabled


register(contributor): void

Defined in: DebugRegistryImpl.ts:18

DebugContributor

void

DebugRegistry.register


setFlag(contributorName, flag, value): void

Defined in: DebugRegistryImpl.ts:51

string

string

boolean

void


toggle(): void

Defined in: DebugRegistryImpl.ts:42

void


toggleFlag(contributorName, flag): void

Defined in: DebugRegistryImpl.ts:46

string

string

void