@adatechnology/game-vehicles 0.6.3 → 0.6.5

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/dist/index.js CHANGED
@@ -445,10 +445,11 @@ function merge(base, extra) {
445
445
  return out;
446
446
  }
447
447
  function assignDeep(target, source) {
448
+ const t = target;
448
449
  Object.keys(source || {}).forEach(function(k) {
449
450
  const v = source[k];
450
- if (v && typeof v === "object" && !Array.isArray(v)) target[k] = assignDeep(target[k] && typeof target[k] === "object" ? target[k] : {}, v);
451
- else if (v !== void 0) target[k] = v;
451
+ if (v && typeof v === "object" && !Array.isArray(v)) t[k] = assignDeep(t[k] && typeof t[k] === "object" ? t[k] : {}, v);
452
+ else if (v !== void 0) t[k] = v;
452
453
  });
453
454
  return target;
454
455
  }
@@ -831,7 +832,9 @@ function installMaterials(kit) {
831
832
  return t;
832
833
  }
833
834
  kit.textTexture = textTexture;
834
- Object.assign(I, { RUST, cache: cache2, studioEnvironment, makeMaterial, makeFlatMaterial, DOUBLE_SIDE, toColor, MATERIALS, paintColor, texCache, textTexture });
835
+ const shared = { RUST, cache: cache2, studioEnvironment, makeMaterial, makeFlatMaterial, DOUBLE_SIDE, toColor, MATERIALS, paintColor, texCache, textTexture };
836
+ Object.assign(I, shared);
837
+ return shared;
835
838
  }
836
839
 
837
840
  // src/tri-index.ts
@@ -986,7 +989,8 @@ function scratchOf(THREE) {
986
989
  }
987
990
  return s;
988
991
  }
989
- function indexable(THREE, mesh) {
992
+ function indexable(THREE, object) {
993
+ const mesh = object;
990
994
  const geo = mesh.geometry;
991
995
  if (mesh.raycast !== THREE.Mesh.prototype.raycast) return false;
992
996
  if (!mesh.isMesh || mesh.isSkinnedMesh || mesh.isInstancedMesh || mesh.isBatchedMesh || !geo || !geo.isBufferGeometry) return false;
@@ -1585,21 +1589,23 @@ function installGeometry(kit) {
1585
1589
  let wb = 0;
1586
1590
  segs.forEach(function(seg) {
1587
1591
  if (typeof seg[0] === "number") {
1592
+ const run = seg;
1588
1593
  for (let a = 0; a < names.length; a++) {
1589
1594
  const size = sizes[a];
1590
1595
  if (!idx) {
1591
- dst[a].set(arrs[a].subarray(seg[0] * 3 * size, seg[1] * 3 * size), w[a]);
1592
- w[a] += (seg[1] - seg[0]) * 3 * size;
1596
+ dst[a].set(arrs[a].subarray(run[0] * 3 * size, run[1] * 3 * size), w[a]);
1597
+ w[a] += (run[1] - run[0]) * 3 * size;
1593
1598
  continue;
1594
1599
  }
1595
- for (let f = seg[0] * 3; f < seg[1] * 3; f++) for (let q = 0; q < size; q++) dst[a][w[a]++] = arrs[a][idx[f] * size + q];
1600
+ for (let f = run[0] * 3; f < run[1] * 3; f++) for (let q = 0; q < size; q++) dst[a][w[a]++] = arrs[a][idx[f] * size + q];
1596
1601
  }
1597
1602
  if (boxesOut2 && ti) {
1598
- boxesOut2.set(ti.boxes.subarray(seg[0] * 6, seg[1] * 6), wb);
1599
- wb += (seg[1] - seg[0]) * 6;
1603
+ boxesOut2.set(ti.boxes.subarray(run[0] * 6, run[1] * 6), wb);
1604
+ wb += (run[1] - run[0]) * 6;
1600
1605
  }
1601
1606
  return;
1602
1607
  }
1608
+ ;
1603
1609
  seg.forEach(function(t) {
1604
1610
  if (boxesOut2) {
1605
1611
  for (let k = 0; k < 3; k++) {
@@ -1793,7 +1799,9 @@ function installGeometry(kit) {
1793
1799
  }
1794
1800
  };
1795
1801
  };
1796
- Object.assign(I, { roundedBoxGeometry, taper, subdivide, crease, creaseTask, refreshBounds, pathShape, tumble, loftGeometry, hullGeometry, cutGeometry, mergeGeometries, uvProject });
1802
+ const shared = { roundedBoxGeometry, taper, subdivide, crease, creaseTask, refreshBounds, pathShape, tumble, loftGeometry, hullGeometry, cutGeometry, mergeGeometries, uvProject };
1803
+ Object.assign(I, shared);
1804
+ return shared;
1797
1805
  }
1798
1806
 
1799
1807
  // src/context.ts
@@ -2048,6 +2056,7 @@ function installContext(kit) {
2048
2056
  }
2049
2057
  kit.BuildContext = BuildContext;
2050
2058
  I.BuildContext = BuildContext;
2059
+ return { resolveLabel, BuildContext };
2051
2060
  }
2052
2061
 
2053
2062
  // src/warp.ts
@@ -2243,7 +2252,9 @@ function installWarp(kit) {
2243
2252
  kit.applyWarp = applyWarp;
2244
2253
  kit.geo.resample = resample;
2245
2254
  kit.geo.smoothLoft = smoothLoft;
2246
- Object.assign(I, { makeWarp, applyWarp, resample, smoothLoft });
2255
+ const shared = { makeWarp, applyWarp, resample, smoothLoft };
2256
+ Object.assign(I, shared);
2257
+ return shared;
2247
2258
  }
2248
2259
 
2249
2260
  // src/body.ts
@@ -2309,23 +2320,24 @@ function installBody(kit) {
2309
2320
  o.arches.forEach(function(a) {
2310
2321
  const a0 = Math.asin(clamp((o.bottomY - a[1]) / a[2], -1, 1));
2311
2322
  const rr = a[2] - 0.01;
2323
+ const archInner = o.archInner;
2312
2324
  if (o.archInner == null) {
2313
2325
  const wl = c.add(new THREE.CylinderGeometry(rr, rr, o.W - 0.12, 20, 1, true, a0 + PI / 2, PI - 2 * a0), MATERIALS.dark, a[0], a[1], 0);
2314
2326
  wl.rotation.x = PI / 2;
2315
2327
  wl.castShadow = false;
2316
2328
  } else
2317
2329
  [1, -1].forEach(function(s) {
2318
- const len = o.W / 2 - 0.06 - o.archInner;
2330
+ const len = o.W / 2 - 0.06 - archInner;
2319
2331
  const w2 = c.add(
2320
2332
  new THREE.CylinderGeometry(rr, rr, len, 20, 1, true, a0 + PI / 2, PI - 2 * a0),
2321
2333
  MATERIALS.dark,
2322
2334
  a[0],
2323
2335
  a[1],
2324
- s * (o.archInner + len / 2)
2336
+ s * (archInner + len / 2)
2325
2337
  );
2326
2338
  w2.rotation.x = PI / 2;
2327
2339
  w2.castShadow = false;
2328
- const cap = c.add(new THREE.CircleGeometry(rr, 20, a0, PI - 2 * a0), MATERIALS.dark, a[0], a[1], s * o.archInner);
2340
+ const cap = c.add(new THREE.CircleGeometry(rr, 20, a0, PI - 2 * a0), MATERIALS.dark, a[0], a[1], s * archInner);
2329
2341
  cap.castShadow = false;
2330
2342
  });
2331
2343
  });
@@ -2402,8 +2414,12 @@ function installBody(kit) {
2402
2414
  if (!q.isMesh || !q.visible || q.userData.glass || q.userData.decal || q.isSprite) return;
2403
2415
  if (o.all || dset.has(q) || c.paints && c.paints.has(q.material)) cands.push(q);
2404
2416
  });
2405
- const d = (dir.isVector3 ? dir.clone() : new V3(dir[0], dir[1], dir[2])).normalize();
2406
- const p0 = org.isVector3 ? org.clone() : new V3(org[0], org[1], org[2]);
2417
+ const dv = dir;
2418
+ const da = dir;
2419
+ const d = (dv.isVector3 ? dv.clone() : new V3(da[0], da[1], da[2])).normalize();
2420
+ const ov = org;
2421
+ const oa = org;
2422
+ const p0 = ov.isVector3 ? ov.clone() : new V3(oa[0], oa[1], oa[2]);
2407
2423
  _sr.set(p0.clone().applyMatrix4(Mw), d.clone().transformDirection(Mw));
2408
2424
  _sr.near = 0;
2409
2425
  _sr.far = o.max || 20;
@@ -2420,7 +2436,9 @@ function installBody(kit) {
2420
2436
  const h = kit.surfaceAt(c, new V3(x0, y, z || 0), new V3(-sg, 0, 0));
2421
2437
  return h ? h.p.x : items ? profX(items, y, front !== false) : null;
2422
2438
  };
2423
- Object.assign(I, { halfAt, shell, autoWindows, profX, _sr });
2439
+ const shared = { halfAt, shell, autoWindows, profX, _sr };
2440
+ Object.assign(I, shared);
2441
+ return shared;
2424
2442
  }
2425
2443
 
2426
2444
  // src/glass.ts
@@ -2429,7 +2447,8 @@ function installGlass(kit) {
2429
2447
  const V3 = THREE.Vector3;
2430
2448
  const I = kit._;
2431
2449
  const { MATERIALS, crease, cutGeometry, pathShape, subdivide, tumble, uvProject } = I;
2432
- I.paneSeals = /* @__PURE__ */ new WeakMap();
2450
+ const paneSeals = /* @__PURE__ */ new WeakMap();
2451
+ I.paneSeals = paneSeals;
2433
2452
  kit.addGlass = function(c, geo, label, type, o) {
2434
2453
  o = o || {};
2435
2454
  if (!geo.attributes.uv || o.reuv) o.aspect = uvProject(geo, o.uvAxes);
@@ -2526,7 +2545,7 @@ function installGlass(kit) {
2526
2545
  };
2527
2546
  kit.quadDef = function(pb, pt, Wg, T, which, bev, o) {
2528
2547
  o = o || {};
2529
- bev = bev == null ? 0.05 : bev;
2548
+ const bv = bev == null ? 0.05 : bev;
2530
2549
  const dx = pt[0] - pb[0];
2531
2550
  const dy = pt[1] - pb[1];
2532
2551
  const L = Math.hypot(dx, dy);
@@ -2535,13 +2554,13 @@ function installGlass(kit) {
2535
2554
  const nx = which === "front" ? uy : -uy;
2536
2555
  const ny = which === "front" ? -ux : ux;
2537
2556
  const ins = o.inset || 0.09;
2538
- const off = bev + 6e-3;
2557
+ const off = bv + 6e-3;
2539
2558
  const sd = o.side || 0.1;
2540
2559
  const b = [pb[0] + ux * ins + nx * off, pb[1] + uy * ins + ny * off];
2541
2560
  const t = [pt[0] - ux * ins * 1.3 + nx * off, pt[1] - uy * ins * 1.3 + ny * off];
2542
2561
  const hb = I.halfAt(Wg, T, b[1]) - sd;
2543
2562
  const ht = I.halfAt(Wg, T, t[1]) - sd;
2544
- return { pb, pt, L, u: [ux, uy], n: [nx, ny], ins, b, t, hb, ht, which, bev, Wg, T };
2563
+ return { pb, pt, L, u: [ux, uy], n: [nx, ny], ins, b, t, hb, ht, which, bev: bv, Wg, T };
2545
2564
  };
2546
2565
  kit.glassQuad = function(c, q, label, o) {
2547
2566
  o = o || {};
@@ -2595,7 +2614,9 @@ function installGlass(kit) {
2595
2614
  c.quads.push(q);
2596
2615
  return m;
2597
2616
  };
2598
- Object.assign(I, {});
2617
+ const shared = { paneSeals };
2618
+ Object.assign(I, shared);
2619
+ return shared;
2599
2620
  }
2600
2621
 
2601
2622
  // src/lights.ts
@@ -2932,7 +2953,9 @@ function installLights(kit) {
2932
2953
  if (o.emblem !== false) kit.emblem(c, 0.05, st === "closed" ? h * 0.12 : 0, 0, Math.min(0.05, h * 0.3), g);
2933
2954
  return g;
2934
2955
  };
2935
- Object.assign(I, { lampGroup, gm, wedgeY, haloTex, glowTexture, haloMats, halo, lampKit });
2956
+ const shared = { lampGroup, gm, wedgeY, haloTex, glowTexture, haloMats, halo, lampKit };
2957
+ Object.assign(I, shared);
2958
+ return shared;
2936
2959
  }
2937
2960
 
2938
2961
  // src/interior.ts
@@ -3184,7 +3207,9 @@ function installInterior(kit) {
3184
3207
  c.roundBox(o.x0 - o.x1 + 1, 0.03, zi * 2, 0.01, MATERIALS.carpet, (o.x0 + o.x1) / 2, o.floor, 0);
3185
3208
  return n;
3186
3209
  };
3187
- Object.assign(I, { consoleBox });
3210
+ const shared = { consoleBox };
3211
+ Object.assign(I, shared);
3212
+ return shared;
3188
3213
  }
3189
3214
 
3190
3215
  // src/hood.ts
@@ -3579,7 +3604,9 @@ function installHood(kit) {
3579
3604
  };
3580
3605
  return out;
3581
3606
  };
3582
- Object.assign(I, {});
3607
+ const shared = {};
3608
+ Object.assign(I, shared);
3609
+ return shared;
3583
3610
  }
3584
3611
 
3585
3612
  // src/car.ts
@@ -3937,7 +3964,9 @@ function installCar(kit) {
3937
3964
  });
3938
3965
  return out;
3939
3966
  };
3940
- Object.assign(I, {});
3967
+ const shared = {};
3968
+ Object.assign(I, shared);
3969
+ return shared;
3941
3970
  }
3942
3971
 
3943
3972
  // src/trucks.ts
@@ -4082,7 +4111,9 @@ function installTrucks(kit) {
4082
4111
  m.rear = rear;
4083
4112
  m.length = L;
4084
4113
  };
4085
- Object.assign(I, {});
4114
+ const shared = {};
4115
+ Object.assign(I, shared);
4116
+ return shared;
4086
4117
  }
4087
4118
 
4088
4119
  // src/wheels.ts
@@ -4221,7 +4252,9 @@ function installWheels(kit) {
4221
4252
  c.part("track", kit.t("parts.track", { s: z > 0 ? 1 : -1 }), tm, new V3((x0 + x1) / 2, 0.3, z), 1.4);
4222
4253
  return { mesh: tm, wheels: gs, sprocket: spr, idler: idl };
4223
4254
  };
4224
- Object.assign(I, {});
4255
+ const shared = {};
4256
+ Object.assign(I, shared);
4257
+ return shared;
4225
4258
  }
4226
4259
 
4227
4260
  // src/particles.ts
@@ -4653,7 +4686,7 @@ function installParticles(kit) {
4653
4686
  }
4654
4687
  });
4655
4688
  }
4656
- Object.assign(I, {
4689
+ const shared = {
4657
4690
  PARTICLE_LIMIT,
4658
4691
  PARTICLE_GEOMETRIES,
4659
4692
  PARTICLE_MATERIALS,
@@ -4673,7 +4706,9 @@ function installParticles(kit) {
4673
4706
  burst,
4674
4707
  exhaustLook,
4675
4708
  tickEmit
4676
- });
4709
+ };
4710
+ Object.assign(I, shared);
4711
+ return shared;
4677
4712
  }
4678
4713
 
4679
4714
  // src/fluids.ts
@@ -5147,7 +5182,9 @@ function installFluids(kit) {
5147
5182
  }
5148
5183
  return n;
5149
5184
  };
5150
- Object.assign(I, { _fr, buildDrip, DOWNHILL, PN, puddleGeometry, rimGeometry, puddle, shapePuddle, updateFluids });
5185
+ const shared = { _fr, buildDrip, DOWNHILL, PN, puddleGeometry, rimGeometry, puddle, shapePuddle, updateFluids };
5186
+ Object.assign(I, shared);
5187
+ return shared;
5151
5188
  }
5152
5189
 
5153
5190
  // src/glass-damage.ts
@@ -5523,7 +5560,9 @@ function installGlassDamage(kit) {
5523
5560
  for (const h of L.halo ?? []) h.visible = false;
5524
5561
  }
5525
5562
  kit.crackLight = crackLight;
5526
- Object.assign(I, { glassUV, drawWeb, crackGlass, glassRim, shatterGlass, hitGlass, breakLight, crackLight });
5563
+ const shared = { glassUV, drawWeb, crackGlass, glassRim, shatterGlass, hitGlass, breakLight, crackLight };
5564
+ Object.assign(I, shared);
5565
+ return shared;
5527
5566
  }
5528
5567
 
5529
5568
  // src/impact.ts
@@ -5997,7 +6036,7 @@ function installImpact(kit) {
5997
6036
  return hit;
5998
6037
  }
5999
6038
  kit.zoneImpact = zoneImpact;
6000
- Object.assign(I, {
6039
+ const shared = {
6001
6040
  dentField,
6002
6041
  hangBumper,
6003
6042
  tankFuel,
@@ -6013,7 +6052,9 @@ function installImpact(kit) {
6013
6052
  _pr,
6014
6053
  probe,
6015
6054
  zoneImpact
6016
- });
6055
+ };
6056
+ Object.assign(I, shared);
6057
+ return shared;
6017
6058
  }
6018
6059
 
6019
6060
  // src/explosion.ts
@@ -6398,7 +6439,9 @@ function installExplosion(kit) {
6398
6439
  }
6399
6440
  }
6400
6441
  }
6401
- Object.assign(I, { BURNT, BURNT_RUB, boomMat, enginePos, fling, burnAll, bigBoomFx, detonate, tickBoom, tickFlying });
6442
+ const shared = { BURNT, BURNT_RUB, boomMat, enginePos, fling, burnAll, bigBoomFx, detonate, tickBoom, tickFlying };
6443
+ Object.assign(I, shared);
6444
+ return shared;
6402
6445
  }
6403
6446
 
6404
6447
  // src/rollover.ts
@@ -6600,7 +6643,8 @@ function installRollover(kit) {
6600
6643
  c.parts.forEach(function(p) {
6601
6644
  if (p.kind !== "rotor" && p.kind !== "tail_rotor" || !p.obj) return;
6602
6645
  const main = p.kind === "rotor";
6603
- p.obj.traverse(function(o) {
6646
+ p.obj.traverse(function(node) {
6647
+ const o = node;
6604
6648
  if (!o.isMesh || !o.visible) return;
6605
6649
  const bb = new THREE.Box3().setFromObject(o).applyMatrix4(inv);
6606
6650
  if (!main && bb.min.y >= -0.01) return;
@@ -6672,7 +6716,9 @@ function installRollover(kit) {
6672
6716
  if (p >= 1) finishRoll(c);
6673
6717
  }
6674
6718
  kit.rollContact = rollContact;
6675
- Object.assign(I, { rollMeshes, convexHull, rollContact, exactMinY, finishRoll, tickRoll });
6719
+ const shared = { rollMeshes, convexHull, rollContact, exactMinY, finishRoll, tickRoll };
6720
+ Object.assign(I, shared);
6721
+ return shared;
6676
6722
  }
6677
6723
 
6678
6724
  // src/tick.ts
@@ -6710,7 +6756,9 @@ function installTick(kit) {
6710
6756
  c.hood.target = open ? c.hood.open : 0;
6711
6757
  return true;
6712
6758
  };
6713
- Object.assign(I, {});
6759
+ const shared = {};
6760
+ Object.assign(I, shared);
6761
+ return shared;
6714
6762
  }
6715
6763
 
6716
6764
  // src/armor.ts
@@ -6962,7 +7010,9 @@ function installArmor(kit) {
6962
7010
  }
6963
7011
  }
6964
7012
  kit.applyArmor = applyArmor;
6965
- Object.assign(I, { STEEL_MATERIAL, PLATE_MATERIALS, jerryCan, applyArmor });
7013
+ const shared = { STEEL_MATERIAL, PLATE_MATERIALS, jerryCan, applyArmor };
7014
+ Object.assign(I, shared);
7015
+ return shared;
6966
7016
  }
6967
7017
 
6968
7018
  // src/zone-core.ts
@@ -6981,8 +7031,8 @@ function installZoneCore(kit) {
6981
7031
  return { id: b.id, name: kit.t("bands." + b.id), min: b.min, health: b.health, color: b.color };
6982
7032
  });
6983
7033
  function bandOf(h) {
6984
- h = Math.round(clamp(h == null ? 100 : h, 0, 100));
6985
- for (let i = 0; i < BANDS.length; i++) if (h >= BANDS[i].min) return i;
7034
+ const v = Math.round(clamp(h == null ? 100 : h, 0, 100));
7035
+ for (let i = 0; i < BANDS.length; i++) if (v >= BANDS[i].min) return i;
6986
7036
  return 4;
6987
7037
  }
6988
7038
  kit.bands = BANDS;
@@ -7008,8 +7058,12 @@ function installZoneCore(kit) {
7008
7058
  z0: Math.min(b[4], b[5]),
7009
7059
  z1: Math.max(b[4], b[5])
7010
7060
  };
7011
- if (b.isBox3) return { x0: b.min.x, x1: b.max.x, y0: b.min.y, y1: b.max.y, z0: b.min.z, z1: b.max.z };
7012
- return { x0: b.x0, x1: b.x1, y0: b.y0, y1: b.y1, z0: b.z0, z1: b.z1 };
7061
+ if (b.isBox3) {
7062
+ const box = b;
7063
+ return { x0: box.min.x, x1: box.max.x, y0: box.min.y, y1: box.max.y, z0: box.min.z, z1: box.max.z };
7064
+ }
7065
+ const r = b;
7066
+ return { x0: r.x0, x1: r.x1, y0: r.y0, y1: r.y1, z0: r.z0, z1: r.z1 };
7013
7067
  }
7014
7068
  kit.normalizeBox = normalizeBox;
7015
7069
  function boxLo(B, a) {
@@ -7046,7 +7100,8 @@ function installZoneCore(kit) {
7046
7100
  const bb = new THREE.Box3();
7047
7101
  const tmp = new THREE.Box3();
7048
7102
  const M = new THREE.Matrix4();
7049
- o.traverse(function(x) {
7103
+ o.traverse(function(node) {
7104
+ const x = node;
7050
7105
  if (!x.isMesh || !x.geometry || !x.geometry.attributes.position || x.userData.decal) return;
7051
7106
  if (!x.geometry.boundingBox) x.geometry.computeBoundingBox();
7052
7107
  tmp.copy(x.geometry.boundingBox).applyMatrix4(M.multiplyMatrices(inv, x.matrixWorld));
@@ -7112,7 +7167,7 @@ function installZoneCore(kit) {
7112
7167
  for (let q = o; q && q !== c.vehicle; q = q.parent) if (q.visible === false) return false;
7113
7168
  return !!o;
7114
7169
  }
7115
- Object.assign(I, {
7170
+ const shared = {
7116
7171
  BANDS,
7117
7172
  bandOf,
7118
7173
  ZONE_WEIGHTS,
@@ -7135,7 +7190,9 @@ function installZoneCore(kit) {
7135
7190
  lightBoxOf,
7136
7191
  hideObj,
7137
7192
  shown
7138
- });
7193
+ };
7194
+ Object.assign(I, shared);
7195
+ return shared;
7139
7196
  }
7140
7197
 
7141
7198
  // src/zone-decals.ts
@@ -7420,7 +7477,10 @@ function installZoneDecals(kit) {
7420
7477
  narrowTo(rc, q);
7421
7478
  }
7422
7479
  const hits = rc.intersectObjects(cands, false);
7423
- for (let i = 0; i < hits.length; i++) if (hits[i].object.proxyOf) hits[i].object = hits[i].object.proxyOf;
7480
+ for (let i = 0; i < hits.length; i++) {
7481
+ const proxyOf = hits[i].object.proxyOf;
7482
+ if (proxyOf) hits[i].object = proxyOf;
7483
+ }
7424
7484
  return hits;
7425
7485
  }
7426
7486
  function zoneCands(c, z, inv, glassToo) {
@@ -7621,7 +7681,7 @@ function installZoneDecals(kit) {
7621
7681
  for (i = 0; i < (spec.tear || 0); i++) if (s = nx()) tears.push(tearDecal(c, s.p, s.n, 0.07 + R() * 0.06, R, s.obj));
7622
7682
  return S;
7623
7683
  }
7624
- Object.assign(I, {
7684
+ const shared = {
7625
7685
  dmat,
7626
7686
  DAMAGE_MATERIALS,
7627
7687
  _zq,
@@ -7642,7 +7702,9 @@ function installZoneDecals(kit) {
7642
7702
  ribbonGeo,
7643
7703
  scratchDecal,
7644
7704
  zoneDecals
7645
- });
7705
+ };
7706
+ Object.assign(I, shared);
7707
+ return shared;
7646
7708
  }
7647
7709
 
7648
7710
  // src/zone-dent.ts
@@ -8000,7 +8062,9 @@ function installZoneDent(kit) {
8000
8062
  });
8001
8063
  return piv;
8002
8064
  }
8003
- Object.assign(I, { sm, subdivIn, dentTargets, zoneDent, cutPanel, pivotOf });
8065
+ const shared = { sm, subdivIn, dentTargets, zoneDent, cutPanel, pivotOf };
8066
+ Object.assign(I, shared);
8067
+ return shared;
8004
8068
  }
8005
8069
 
8006
8070
  // src/damage-panels.ts
@@ -8353,7 +8417,9 @@ function installDamagePanels(kit) {
8353
8417
  const sgn = new V3().crossVectors(axisV, tangent).dot(outv) > 0 ? 1 : -1;
8354
8418
  piv.quaternion.setFromAxisAngle(axisV, sgn * (0.6 + R() * 0.3));
8355
8419
  }
8356
- Object.assign(I, { panelBand, roofOff, tailOff, followersIn, windowsOver, doorGap, mirrorHang, doorHang, lidHang, flapHang });
8420
+ const shared = { panelBand, roofOff, tailOff, followersIn, windowsOver, doorGap, mirrorHang, doorHang, lidHang, flapHang };
8421
+ Object.assign(I, shared);
8422
+ return shared;
8357
8423
  }
8358
8424
 
8359
8425
  // src/damage-parts.ts
@@ -8469,7 +8535,8 @@ function installDamageParts(kit) {
8469
8535
  }
8470
8536
  function tireMeshes(w) {
8471
8537
  const out = [];
8472
- w.traverse(function(o) {
8538
+ w.traverse(function(node) {
8539
+ const o = node;
8473
8540
  if (o.isMesh && o.material === MATERIALS.rubber) out.push(o);
8474
8541
  });
8475
8542
  return out;
@@ -8528,7 +8595,8 @@ function installDamageParts(kit) {
8528
8595
  c.zoneDrops.push({ x: w.position.x, z: w.position.z, d: r * 0.24 });
8529
8596
  } else if (b === 4) {
8530
8597
  let rr = 0;
8531
- w.traverse(function(o) {
8598
+ w.traverse(function(node) {
8599
+ const o = node;
8532
8600
  if (!o.isMesh || o.material === MATERIALS.rubber) return;
8533
8601
  if (!o.geometry.boundingSphere) o.geometry.computeBoundingSphere();
8534
8602
  const cc = o.geometry.boundingSphere.center.clone().applyMatrix4(o.matrix);
@@ -8736,7 +8804,8 @@ function installDamageParts(kit) {
8736
8804
  const xf = H.x0 + (H.x1 - H.x0) * (0.5 + R() * 0.1);
8737
8805
  const k = 0.55 + R() * 0.2;
8738
8806
  const v = new V3();
8739
- H.piv.children.forEach(function(msh) {
8807
+ H.piv.children.forEach(function(node) {
8808
+ const msh = node;
8740
8809
  if (!msh.isMesh) return;
8741
8810
  msh.updateMatrix();
8742
8811
  const M = msh.matrix;
@@ -8929,7 +8998,7 @@ function installDamageParts(kit) {
8929
8998
  });
8930
8999
  void K;
8931
9000
  }
8932
- Object.assign(I, {
9001
+ const shared = {
8933
9002
  glassPt,
8934
9003
  glassIn,
8935
9004
  glassBand,
@@ -8947,7 +9016,9 @@ function installDamageParts(kit) {
8947
9016
  bumperBand,
8948
9017
  partBand,
8949
9018
  bendAft
8950
- });
9019
+ };
9020
+ Object.assign(I, shared);
9021
+ return shared;
8951
9022
  }
8952
9023
 
8953
9024
  // src/zone-derive.ts
@@ -8970,7 +9041,8 @@ function installZoneDerive(kit) {
8970
9041
  }
8971
9042
  function resolveObjs(c, list, z) {
8972
9043
  const out = [];
8973
- (list || []).forEach(function(o) {
9044
+ (list || []).forEach(function(item) {
9045
+ const o = item;
8974
9046
  if (!o) return;
8975
9047
  if (typeof o === "string") {
8976
9048
  c.parts.forEach(function(p) {
@@ -9219,7 +9291,9 @@ function installZoneDerive(kit) {
9219
9291
  return null;
9220
9292
  }
9221
9293
  kit.zoneOwner = ownerOf;
9222
- Object.assign(I, { parseDir, resolveObjs, deriveZones, carMap, zonesOf, ownerOf });
9294
+ const shared = { parseDir, resolveObjs, deriveZones, carMap, zonesOf, ownerOf };
9295
+ Object.assign(I, shared);
9296
+ return shared;
9223
9297
  }
9224
9298
 
9225
9299
  // src/zone-auto.ts
@@ -10014,7 +10088,9 @@ function installZoneAuto(kit) {
10014
10088
  if (!wheelsDone) wheelZones(false);
10015
10089
  return Z;
10016
10090
  }
10017
- Object.assign(I, { autoZones });
10091
+ const shared = { autoZones };
10092
+ Object.assign(I, shared);
10093
+ return shared;
10018
10094
  }
10019
10095
 
10020
10096
  // src/zone-apply.ts
@@ -10225,7 +10301,9 @@ function installZoneApply(kit) {
10225
10301
  c.rand = R0;
10226
10302
  return c.zoneState;
10227
10303
  };
10228
- Object.assign(I, { fadePaint, abandonFx, burntFx, settleDrops });
10304
+ const shared = { fadePaint, abandonFx, burntFx, settleDrops };
10305
+ Object.assign(I, shared);
10306
+ return shared;
10229
10307
  }
10230
10308
 
10231
10309
  // src/scenarios.ts
@@ -10382,7 +10460,9 @@ function installScenarios(kit) {
10382
10460
  }
10383
10461
  return { p, dir };
10384
10462
  };
10385
- Object.assign(I, { BODY_TYPES });
10463
+ const shared = { BODY_TYPES };
10464
+ Object.assign(I, shared);
10465
+ return shared;
10386
10466
  }
10387
10467
 
10388
10468
  // src/ui.ts
@@ -10539,7 +10619,8 @@ function installUi(kit) {
10539
10619
  }
10540
10620
  g.addEventListener("click", pick);
10541
10621
  g.addEventListener("keydown", function(e) {
10542
- if (e.key === "Enter" || e.key === " ") {
10622
+ const key = e.key;
10623
+ if (key === "Enter" || key === " ") {
10543
10624
  e.preventDefault();
10544
10625
  pick();
10545
10626
  }
@@ -10552,7 +10633,7 @@ function installUi(kit) {
10552
10633
  return kit.bands.map(function(B, i) {
10553
10634
  const b = el("button", null, B.name);
10554
10635
  b.type = "button";
10555
- b.dataset.b = i;
10636
+ b.dataset.b = String(i);
10556
10637
  b.style.setProperty("--band", B.color);
10557
10638
  b.addEventListener("click", function() {
10558
10639
  if (onPick) onPick(B.health, i);
@@ -10780,6 +10861,7 @@ function createVehicleKit(options) {
10780
10861
  hash,
10781
10862
  clamp,
10782
10863
  smooth,
10864
+ // filled by the modules below, each with the helpers it shares
10783
10865
  _: {}
10784
10866
  };
10785
10867
  kit.fuels = {};
@@ -10857,8 +10939,8 @@ function createVehicleKit(options) {
10857
10939
  fn.apply(kit, args);
10858
10940
  });
10859
10941
  };
10860
- kit.configure = function(o) {
10861
- o = o || {};
10942
+ kit.configure = function(cfg) {
10943
+ const o = cfg || {};
10862
10944
  if (o.bands)
10863
10945
  o.bands.forEach(function(b, i) {
10864
10946
  if (kit.bands[i] && b) Object.assign(kit.bands[i], b);
@@ -10894,7 +10976,8 @@ function createVehicleKit(options) {
10894
10976
  }
10895
10977
  ;
10896
10978
  ["impactStain", "defaultSplat", "defaultGroup", "damagedScenario"].forEach(function(k) {
10897
- if (o[k] !== void 0) kit.config[k] = o[k];
10979
+ const v = o[k];
10980
+ if (v !== void 0) kit.config[k] = v;
10898
10981
  });
10899
10982
  return kit;
10900
10983
  };