/query/game/cql
with the CQL query. See the REST API documentation for more information.
EXACT(…) and CONTAINS(…)
EXACT
is a query for entities that contain “exactly” the specified the components. Nothing more nothing less.
Examples:
EXACT(healthComponent)
is a query for all entities with exactly one health component; nothing more.EXACT(healthComponent, attackComponent)
is a query for all entities with exactly one health component and one attack component; nothing more.CONTAINS
is a query for entities that only need to “contain” the specified components. If an entity has more components than just the specified component(s), it is still a valid entity for that query.
Examples:
CONTAINS(armComponent)
is a query for all entities that have an arm component. The entity can have more components than just the arm.CONTAINS(armComponent, legComponent)
is query for all entities that have both an arm component and a leg component. The entity can have more components than the arm and the leg.!
(not), &
(and), and |
(or).
NOT (!)
!
negates a query.
!CONTAINS(healthComponent)
queries all entities that do not contain a health component.&
performs the “and” operation on two queries.
CONTAINS(healthComponent) & !CONTAINS(attackComponent)
is a query for all entities that contain a health component “and” does not contain an attack component|
performs the “or” operation on two queries.
CONTAINS(healthComponent) | !CONTAINS(attackComponent)
is a query for all entities that either contains a health component “or” does not contain an attack componentA & B | C & D | F
is equivalent to ( ( A & B ) | C ) & D ) | F)
EXACT(legComponent) | (!CONTAINS(healthComponent) & !CONTAINS(attackComponent))
(EXACT(legComponent) | !CONTAINS(healthComponent)) & !CONTAINS(attackComponent)