Without

View source

Filters a Query to archetypes that do not contain a component type.

Use without when constructing this filter through the factory API.

Examples

import { Query, Without, World } from '@wimaengine/ecs'

class Position {}
class Parent {}

const world = new World()
world.spawn([new Position()])
const query = new Query(world, [Position], [new Without(Parent)])

Constructor


constructor<T>(component: Constructor<T>)

View source

Creates a filter that excludes a component type from matching archetypes.

The component constructor is converted to a TypeId with typeid and stored in Without#typeid. This does not remove a component from a Query; pass the filter to the query directly or use without.

Type Parameters

T

Parameters

NameDescriptionDefault
component

Component constructor whose TypeId must be absent.

—

Properties


typeid: TypeId

View source

TypeId of the component that a matching archetype must not contain.

The constructor stores typeid(component) here. The Without#archetype method compares this value with the archetype’s complete component TypeId list.

Methods


archetype(types: readonly TypeId[]): boolean

View source

Checks whether an archetype excludes the configured component type.

This method receives the archetype’s complete TypeId list. Extra types are allowed, but a list containing this filter’s TypeId is rejected. The inherited QueryFilter#isRequired behavior leaves descriptor requirements unchanged, so this filter does not make an excluded descriptor optional.

Parameters

NameDescriptionDefault
types

Complete component TypeIds in the archetype.

—

Returns

true when the archetype excludes Without#typeid.