Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions addons/gecs/ecs/query_builder.gd
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,25 @@ func matches(entities: Array) -> Array:
matches = false
break

# Check required groups
if matches and not _groups.is_empty():
for group in _groups:
if not entity.is_in_group(group):
matches = false
break

# Check excluded groups
if matches and not _exclude_groups.is_empty():
for group in _exclude_groups:
if entity.is_in_group(group):
matches = false
break

# Check enabled filter
if matches and _enabled_filter != null:
if entity.enabled != _enabled_filter:
matches = false

if matches:
result.append(entity)

Expand Down Expand Up @@ -453,6 +472,9 @@ func is_empty() -> bool:
and _exclude_components.is_empty()
and _relationships.is_empty()
and _exclude_relationships.is_empty()
and _groups.is_empty()
and _exclude_groups.is_empty()
and _enabled_filter == null
)


Expand Down
5 changes: 5 additions & 0 deletions addons/gecs/ecs/system.gd
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ func _query_has_non_structural_filters(qb: QueryBuilder) -> bool:
return true
if not qb._exclude_groups.is_empty():
return true
if qb._enabled_filter != null:
return true
# Component property queries (ensure actual queries, not placeholders)
if not qb._all_components_queries.is_empty():
for query in qb._all_components_queries:
Expand Down Expand Up @@ -436,6 +438,9 @@ func _filter_entities_global(qb: QueryBuilder, entities: Array[Entity]) -> Array
for g in qb._exclude_groups:
if e.is_in_group(g):
include = false; break
if include and qb._enabled_filter != null:
if e.enabled != qb._enabled_filter:
include = false
if include and not qb._all_components_queries.is_empty():
for i in range(qb._all_components.size()):
if i >= qb._all_components_queries.size():
Expand Down