@idleflowgames/anotherecs 0.1.1 → 0.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+
5
+ - No source changes. Toolchain/deps only: Node 24, pnpm 11.5.0, lock-file
6
+ maintenance, demo docs. Cut so downstreams can pin a registry version instead
7
+ of a `file:` link.
8
+
3
9
  ## 0.1.1
4
10
 
5
11
  ## 0.1.0
package/README.md CHANGED
@@ -11,6 +11,8 @@ and spatial queries are opt-in.
11
11
 
12
12
  ![Swarm arena demo](./docs/screenshots/swarm-arena-hero.png)
13
13
 
14
+ *The swarm arena demo. Source: [`examples/pixi-demo`](./examples/pixi-demo).*
15
+
14
16
  ## What You Get
15
17
 
16
18
  - **Sparse-set component storage.** Components live in dense arrays for fast
package/dist/index.js CHANGED
@@ -411,7 +411,7 @@ var d = class {
411
411
  let n = e.entities;
412
412
  if (n.length === 0) return;
413
413
  let r = e.stores;
414
- if (e.yieldPlan.length === e.ids.length && e.ids.length <= 4) {
414
+ if (e.yieldPlan.length === e.ids.length && e.ids.length <= 6) {
415
415
  switch (e.ids.length) {
416
416
  case 1: {
417
417
  let e = r[0];
@@ -445,6 +445,22 @@ var d = class {
445
445
  }
446
446
  break;
447
447
  }
448
+ case 5: {
449
+ let e = r[0], i = r[1], a = r[2], o = r[3], s = r[4];
450
+ for (let r = 0; r < n.length; r++) {
451
+ let c = n[r];
452
+ t(c, e.getUnsafe(c), i.getUnsafe(c), a.getUnsafe(c), o.getUnsafe(c), s.getUnsafe(c));
453
+ }
454
+ break;
455
+ }
456
+ case 6: {
457
+ let e = r[0], i = r[1], a = r[2], o = r[3], s = r[4], c = r[5];
458
+ for (let r = 0; r < n.length; r++) {
459
+ let l = n[r];
460
+ t(l, e.getUnsafe(l), i.getUnsafe(l), a.getUnsafe(l), o.getUnsafe(l), s.getUnsafe(l), c.getUnsafe(l));
461
+ }
462
+ break;
463
+ }
448
464
  }
449
465
  return;
450
466
  }
@@ -1202,7 +1218,13 @@ var T = 65536, E = -1, D = class {
1202
1218
  for (let e = 0; e < this.count; e++) this.sparse[this.entities[e]] = E;
1203
1219
  this.entities.length = 0, this.data.length = 0, this.count = 0, this.freeList.length = 0, this._added.length = 0, this._removed.length = 0, this._changed.length = 0, this._addedFired = 0, this._removedFired = 0, this._version++;
1204
1220
  }
1205
- }, O = class {
1221
+ };
1222
+ //#endregion
1223
+ //#region src/spatial-hash.ts
1224
+ function O(e, t) {
1225
+ e.length === 0 ? this.delete(t) : e.length = 0;
1226
+ }
1227
+ var k = class {
1206
1228
  invCellSize;
1207
1229
  cells = /* @__PURE__ */ new Map();
1208
1230
  generation = 0;
@@ -1215,7 +1237,7 @@ var T = 65536, E = -1, D = class {
1215
1237
  return this.generation = this.generation + 1 | 0, this.generation === 0 && (this.generation = 1), this.generation;
1216
1238
  }
1217
1239
  clear() {
1218
- this.cells.clear();
1240
+ this.cells.forEach(O, this.cells);
1219
1241
  }
1220
1242
  insert(e, t, n, r) {
1221
1243
  if (e >= this.seen.length) throw Error(`SpatialHash.insert(): entity id ${e} exceeds maxEntities (${this.seen.length}). Construct the SpatialHash with a maxEntities that matches the consuming World's capacity.`);
@@ -1256,44 +1278,44 @@ var T = 65536, E = -1, D = class {
1256
1278
  let n = e >= 0 ? 2 * e : -2 * e - 1, r = t >= 0 ? 2 * t : -2 * t - 1;
1257
1279
  return n >= r ? n * n + n + r : r * r + n;
1258
1280
  }
1259
- }, k = 0, A = 0, j = 0, M = 0, N = 0, P = !0;
1260
- function F(e, t, n) {
1281
+ }, A = 0, j = 0, M = 0, N = 0, P = 0, F = !0;
1282
+ function I(e, t, n) {
1261
1283
  return {
1262
- id: A++,
1284
+ id: j++,
1263
1285
  name: e,
1264
1286
  create: t,
1265
1287
  reset: n
1266
1288
  };
1267
1289
  }
1268
- function I(e) {
1290
+ function L(e) {
1269
1291
  return {
1270
- id: A++,
1292
+ id: j++,
1271
1293
  name: e,
1272
1294
  tag: !0
1273
1295
  };
1274
1296
  }
1275
- function L(e) {
1297
+ function R(e) {
1276
1298
  return {
1277
- id: j++,
1299
+ id: M++,
1278
1300
  name: e
1279
1301
  };
1280
1302
  }
1281
- function R(e) {
1303
+ function z(e) {
1282
1304
  return {
1283
- id: M++,
1305
+ id: N++,
1284
1306
  name: e
1285
1307
  };
1286
1308
  }
1287
- function z(e, t) {
1309
+ function B(e, t) {
1288
1310
  return {
1289
- id: N++,
1311
+ id: P++,
1290
1312
  name: e,
1291
1313
  init: t
1292
1314
  };
1293
1315
  }
1294
1316
  //#endregion
1295
1317
  //#region src/world.ts
1296
- var B = class {
1318
+ var V = class {
1297
1319
  nextId = 1;
1298
1320
  maxEntities;
1299
1321
  alive = /* @__PURE__ */ new Set();
@@ -1505,13 +1527,13 @@ var B = class {
1505
1527
  t.isTracking() || (t.enableTracking(), this.trackedStores.push(t));
1506
1528
  }
1507
1529
  added(e) {
1508
- return this.stores[e.id]?.iterAdded() ?? H;
1530
+ return this.stores[e.id]?.iterAdded() ?? U;
1509
1531
  }
1510
1532
  removed(e) {
1511
- return this.stores[e.id]?.iterRemoved() ?? H;
1533
+ return this.stores[e.id]?.iterRemoved() ?? U;
1512
1534
  }
1513
1535
  changed(e) {
1514
- return this.stores[e.id]?.iterChanged() ?? H;
1536
+ return this.stores[e.id]?.iterChanged() ?? U;
1515
1537
  }
1516
1538
  markChanged(e, t) {
1517
1539
  this.stores[t.id]?.markChanged(e);
@@ -1627,9 +1649,9 @@ var B = class {
1627
1649
  return this.backrefsEnabled;
1628
1650
  }
1629
1651
  backrefs(e) {
1630
- if (!this.backrefsEnabled || this.backrefEdges === null) return V;
1652
+ if (!this.backrefsEnabled || this.backrefEdges === null) return H;
1631
1653
  let t = this.backrefEdges.get(e);
1632
- if (t === void 0 || t.length === 0) return V;
1654
+ if (t === void 0 || t.length === 0) return H;
1633
1655
  let n = !0;
1634
1656
  for (let e = 0; e < t.length; e++) if (!this.alive.has(t[e])) {
1635
1657
  n = !1;
@@ -1638,7 +1660,7 @@ var B = class {
1638
1660
  if (n) return t;
1639
1661
  let r = [];
1640
1662
  for (let e = 0; e < t.length; e++) this.alive.has(t[e]) && r.push(t[e]);
1641
- return r.length === 0 ? V : r;
1663
+ return r.length === 0 ? H : r;
1642
1664
  }
1643
1665
  unref(e, t) {
1644
1666
  if (!this.backrefsEnabled || this.backrefEdges === null) return;
@@ -1649,8 +1671,8 @@ var B = class {
1649
1671
  let a = this.holderToTargets?.get(t);
1650
1672
  a !== void 0 && (a.delete(n), a.size === 0 && this.holderToTargets?.delete(t));
1651
1673
  }
1652
- }, V = Object.freeze([]), H = [];
1674
+ }, H = Object.freeze([]), U = [];
1653
1675
  //#endregion
1654
- export { e as Bitmask, t as CommandBuffer, D as ComponentStore, T as DEFAULT_MAX_ENTITIES, n as EventBus, i as IncrementalQuery, a as MigrationError, o as MigrationRegistry, k as NULL_REF, d as QueryEngine, f as Schedule, x as Serializer, O as SpatialHash, P as TAG_VALUE, B as World, l as any, F as defineComponent, R as defineEvent, z as defineLocal, L as defineResource, I as defineTag, w as jsonCodec, c as maybe, s as without };
1676
+ export { e as Bitmask, t as CommandBuffer, D as ComponentStore, T as DEFAULT_MAX_ENTITIES, n as EventBus, i as IncrementalQuery, a as MigrationError, o as MigrationRegistry, A as NULL_REF, d as QueryEngine, f as Schedule, x as Serializer, k as SpatialHash, F as TAG_VALUE, V as World, l as any, I as defineComponent, z as defineEvent, B as defineLocal, R as defineResource, L as defineTag, w as jsonCodec, c as maybe, s as without };
1655
1677
 
1656
1678
  //# sourceMappingURL=index.js.map