Skip to content

WorldQuery beta ​

Interface of @v12-engine/engine

ts
export interface WorldQuery extends UnitCondition

What a query of the world asks (world.query): each part it says must hold. What a UnitCondition says too (a buff, health under a share, a hero, tags, enemy or ally of of)

Members ​

area ​

ts
area?: string;

Only what is inside this area (defineArea, a region of the map)

dead ​

ts
dead?: boolean | 'only';

The dead as well (true), or the dead alone ('only'). The living alone when left out

except ​

ts
except?: Entity | readonly Entity[];

Not these: the caster, the one already hit

hidden ​

ts
hidden?: boolean;

What is out of the world for now as well (a worker in a mine, a unit in a transport). Left out when left out

kinds ​

ts
kinds?: readonly EntityKind[];

Only these kinds of things (unit, building, resource…). Everything when left out

layers ​

ts
layers?: readonly Layer[];

Only what is there: on the ground or in the air. Both when left out

limit ​

ts
limit?: number;

At most this many, the first of the order

near ​

ts
near?: Vec2 | Entity;

Around this point or unit: within radius of it, and what nearest and farthest sort by

of ​

ts
of?: PlayerId;

Whose eyes is (enemy or ally) looks with: the owner of near, where that is a unit, when left out

owner ​

ts
owner?: PlayerId | readonly PlayerId[];

Only what these players own

radius ​

ts
radius?: number;

How far from near (to the edge of each, as an effect's radius reaches). Anywhere when left out

sort ​

ts
sort?: TargetOrder | ((a: Entity, b: Entity) => number);

The order to give them in (TargetOrder), or a comparison. In the order they came into the world when left out

type ​

ts
type?: string | readonly string[];

Only these unit types, by id

visibleTo ​

ts
visibleTo?: PlayerId;

Only what this player's team sees now (fog, invisibility)

where ​

ts
where?: (entity: Entity, world: World) => boolean;

Code that says yes or no of each, after the rest: anything the parts above do not say