@codehz/ecs 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +7 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -528,6 +528,7 @@ class ComponentChangeset {
528
528
  let changed = false;
529
529
  for (const componentType of this.removes) {
530
530
  if (!finalComponentTypes.has(componentType)) {
531
+ this.removes.delete(componentType);
531
532
  continue;
532
533
  }
533
534
  changed = true;
@@ -601,7 +602,12 @@ function matchesComponentTypes(archetype, componentTypes) {
601
602
  return componentTypes.every((type) => {
602
603
  const detailedType = getDetailedIdType(type);
603
604
  if (detailedType.type === "wildcard-relation") {
604
- return archetype.componentTypes.includes(detailedType.componentId);
605
+ return archetype.componentTypes.some((archetypeType) => {
606
+ if (!isRelationId(archetypeType))
607
+ return false;
608
+ const decoded = decodeRelationId(archetypeType);
609
+ return decoded.componentId === detailedType.componentId;
610
+ });
605
611
  } else {
606
612
  return archetype.componentTypes.includes(type);
607
613
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codehz/ecs",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",