MCPcopy Create free account
hub / github.com/esengine/esengine / addComponentInternal

Method addComponentInternal

packages/core/src/ECS/Entity.ts:423–430  ·  view source on GitHub ↗
(component: T)

Source from the content-addressed store, hash-verified

421 }
422
423 private addComponentInternal<T extends Component>(component: T): T {
424 const componentType = component.constructor as ComponentType<T>;
425 const registry = this.scene?.componentRegistry ?? GlobalComponentRegistry;
426 const componentMask = registry.getBitMask(componentType);
427 BitMask64Utils.orInPlace(this._componentMask, componentMask);
428 this._componentCache = null;
429 return component;
430 }
431
432 private notifyQuerySystems(changedComponentType?: ComponentType): void {
433 if (!this.scene?.querySystem) return;

Callers 1

addComponentMethod · 0.95

Calls 2

getBitMaskMethod · 0.45
orInPlaceMethod · 0.45

Tested by

no test coverage detected