@codehz/ecs 0.3.2 → 0.3.3

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 (3) hide show
  1. package/index.js +6 -8
  2. package/package.json +1 -1
  3. package/world.d.ts +0 -1
package/index.js CHANGED
@@ -809,11 +809,6 @@ class World {
809
809
  if (snapshot.entityManager) {
810
810
  this.entityIdManager.deserializeState(snapshot.entityManager);
811
811
  }
812
- if (Array.isArray(snapshot.exclusiveComponents)) {
813
- for (const id of snapshot.exclusiveComponents) {
814
- this.exclusiveComponents.add(id);
815
- }
816
- }
817
812
  if (Array.isArray(snapshot.entities)) {
818
813
  for (const entry of snapshot.entities) {
819
814
  const entityId = entry.id;
@@ -1083,8 +1078,12 @@ class World {
1083
1078
  matchingArchetypes = [...this.archetypes];
1084
1079
  }
1085
1080
  for (const wildcard of wildcardRelations) {
1086
- const componentArchetypes = this.archetypesByComponent.get(wildcard.componentId) || [];
1087
- matchingArchetypes = matchingArchetypes.filter((archetype) => componentArchetypes.includes(archetype));
1081
+ matchingArchetypes = matchingArchetypes.filter((archetype) => archetype.componentTypes.some((archetypeType) => {
1082
+ if (!isRelationId(archetypeType))
1083
+ return false;
1084
+ const decoded = decodeRelationId(archetypeType);
1085
+ return decoded.componentId === wildcard.componentId;
1086
+ }));
1088
1087
  }
1089
1088
  return matchingArchetypes;
1090
1089
  }
@@ -1331,7 +1330,6 @@ class World {
1331
1330
  return {
1332
1331
  version: 1,
1333
1332
  entityManager: this.entityIdManager.serializeState(),
1334
- exclusiveComponents: Array.from(this.exclusiveComponents),
1335
1333
  entities
1336
1334
  };
1337
1335
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codehz/ecs",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/world.d.ts CHANGED
@@ -197,7 +197,6 @@ export declare class World<UpdateParams extends any[] = []> {
197
197
  export type SerializedWorld = {
198
198
  version: number;
199
199
  entityManager: any;
200
- exclusiveComponents: EntityId[];
201
200
  entities: SerializedEntity[];
202
201
  };
203
202
  export type SerializedEntity = {