@adatechnology/game-vehicles-fleet 5.0.0 → 6.0.1

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
@@ -4999,6 +4999,20 @@ function installBoatsExtra(fx) {
4999
4999
  );
5000
5000
  }
5001
5001
 
5002
+ // src/vehicles/moving-parts.ts
5003
+ var WIPER_SWEEP = 1.5;
5004
+ function tagWiper(params) {
5005
+ var _a;
5006
+ const tag = { arm: params.index, sweep: WIPER_SWEEP, spindle: [params.spindle.x, params.spindle.y, params.spindle.z], axis: [params.normal.x, params.normal.y, params.normal.z] };
5007
+ (_a = params.context).wipers ?? (_a.wipers = []);
5008
+ for (const part of params.parts) params.context.wipers.push({ part, tag });
5009
+ }
5010
+ function markSunroof(pane, slide) {
5011
+ pane.name = "sunroof";
5012
+ pane.userData.sunroof = { slide };
5013
+ return pane;
5014
+ }
5015
+
5002
5016
  // src/vehicles/cars-extra.ts
5003
5017
  function installCarsExtra(fx) {
5004
5018
  const kit = fx.kit;
@@ -5496,7 +5510,7 @@ function installCarsExtra(fx) {
5496
5510
  off: 3e-3,
5497
5511
  nv: 4
5498
5512
  });
5499
- skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
5513
+ const reflector = skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
5500
5514
  (o.proj || []).forEach(function(q) {
5501
5515
  const r = sh(q[0]), y = (r[0] + r[1]) / 2 + (q[1] || 0), s = Gd.at(q[0], y), rad = q[2] || Math.min(0.034, (r[1] - r[0]) * 0.4);
5502
5516
  const cup = onSurf(c.cylinder(rad * 1.35, rad * 1.2, 0.012, LH, 0, 0, 0), s, 8e-3);
@@ -5527,7 +5541,7 @@ function installCarsExtra(fx) {
5527
5541
  lens.push(ln);
5528
5542
  if (!inner.length) inner.push(ln);
5529
5543
  const cs = Gd.at(0.5, (rg[0] + rg[1]) / 2).p;
5530
- regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner, lens, cs);
5544
+ Object.assign(regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner, lens, cs), { reflector: [reflector] });
5531
5545
  return Gd;
5532
5546
  };
5533
5547
  K.tail = function(sd, o) {
@@ -5868,7 +5882,7 @@ function installCarsExtra(fx) {
5868
5882
  c.roundBox(0.02, 0.09, 0.16, 0.02, MT.chrome, mx - 0.065, my + 0.02, sd * (mz0 + 0.14));
5869
5883
  if (s.mirrorBlink !== false) c.roundBox(0.02, 0.012, 0.12, 5e-3, MT.amber, mx + 0.03, my - 0.025, sd * (mz0 + 0.17));
5870
5884
  (s.seams || []).forEach(function(q) {
5871
- const x = q.length ? q[0] : q, y0 = q.length ? q[1] : by + 0.09, y1 = q.length ? q[2] : gh.belt - 0.03;
5885
+ const r = q, x = r.length ? r[0] : q, y0 = r.length ? r[1] : by + 0.09, y1 = r.length ? r[2] : gh.belt - 0.03;
5872
5886
  c.roundBox(8e-3, y1 - y0, 6e-3, 3e-3, MT.dark, x, (y0 + y1) / 2, sd * (hw + 1e-3));
5873
5887
  });
5874
5888
  (s.handles || []).forEach(function(x) {
@@ -5913,12 +5927,18 @@ function installCarsExtra(fx) {
5913
5927
  (s.wiper === 1 ? [[0.12, 0.66, -0.5]] : [
5914
5928
  [-0.3, 0.42, -0.36],
5915
5929
  [0.2, 0.42, -0.36]
5916
- ]).forEach(function(q) {
5930
+ ]).forEach(function(q, index) {
5917
5931
  const p0 = new V3(gh.fb, gh.belt, q[0]).addScaledVector(wd, 0.07).addScaledVector(wn, 0.035), p1 = p0.clone().addScaledVector(wd, q[1] * 0.42);
5918
5932
  p1.z += q[2];
5919
- c.rod(p0, p1, 9e-3, MT.trim);
5920
- c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
5933
+ const blade = c.rod(p0, p1, 9e-3, MT.trim);
5934
+ const cap = c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
5935
+ tagWiper({ context: c, parts: [blade, cap], spindle: p0, normal: wn, index });
5921
5936
  });
5937
+ if (s.sunroof) {
5938
+ const sx = gh.rt + (gh.ft - gh.rt) * 0.62, sl = 0.62, sw = 2 * (halfAt(gh.Wg, T, gh.roof) - 0.24), sy = roofAt(gh, sx), tilt = Math.atan2(roofAt(gh, sx + 0.3) - roofAt(gh, sx - 0.3), 0.6);
5939
+ c.roundBox(sl, 8e-3, sw, 0.01, PLASTIC, sx, sy + 4e-3, 0, { rot: [0, 0, tilt] }).castShadow = false;
5940
+ markSunroof(c.roundBox(sl + 0.03, 0.012, sw + 0.03, 0.01, MT.tint, sx, sy + 0.013, 0, { rot: [0, 0, tilt] }), sl * 0.85);
5941
+ }
5922
5942
  if (s.fin !== false)
5923
5943
  c.sphere(0.1, s.roofCol ? c.paint(s.roofCol) : GLOSS, gh.rt + 0.2, roofAt(gh, gh.rt + 0.2) + 0.045, 0, 1, 0.45, 0.28, {
5924
5944
  tl: PI / 2
@@ -6050,7 +6070,9 @@ function installCarsExtra(fx) {
6050
6070
  function fogLamp(c, s, r) {
6051
6071
  onSurf(c.cylinder(r * 1.4, r * 1.4, 0.014, LH, 0, 0, 0), s, 6e-3).castShadow = false;
6052
6072
  onSurf(c.cylinder(r, r, 0.012, REFL, 0, 0, 0), s, 0.012).castShadow = false;
6053
- onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016).castShadow = false;
6073
+ const bulb = onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016);
6074
+ bulb.castShadow = false;
6075
+ (c.fogBulbs ?? (c.fogBulbs = [])).push(bulb);
6054
6076
  }
6055
6077
  function crease(c, I, sd, pts, o) {
6056
6078
  o = o || {};
@@ -6892,6 +6914,7 @@ function installCarsExtra(fx) {
6892
6914
  function(c) {
6893
6915
  const hex = "#8c2b2b";
6894
6916
  car(c, {
6917
+ sunroof: fx.hasSunroof("turbo_hatch"),
6895
6918
  W: 1.751,
6896
6919
  col: hex,
6897
6920
  shelf: 0.42,
@@ -7169,6 +7192,7 @@ function installCarsExtra(fx) {
7169
7192
  function(c) {
7170
7193
  const hex = "#5a5f66";
7171
7194
  car(c, {
7195
+ sunroof: fx.hasSunroof("fastback_sedan"),
7172
7196
  W: 1.799,
7173
7197
  col: hex,
7174
7198
  bottomY: 0.2,
@@ -7463,6 +7487,8 @@ function installCarsExtra(fx) {
7463
7487
  fx.register(
7464
7488
  {
7465
7489
  key: "classic_six_sedan",
7490
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
7491
+ headlightLens: "glass",
7466
7492
  group: "cars",
7467
7493
  name: trl("vehicles.classic_six_sedan.name"),
7468
7494
  inspired: trl("vehicles.classic_six_sedan.inspired"),
@@ -9329,6 +9355,7 @@ function installHeavy(fx) {
9329
9355
  hood: true
9330
9356
  },
9331
9357
  function(c) {
9358
+ c.meta.armor = "III";
9332
9359
  const f = 3.75, W = 2.32, len = 1.85, ax = 2.5, wr = 0.506, ww = 0.28, col = "#56616b";
9333
9360
  c.meta.bullet = true;
9334
9361
  c.meta.cabLength = len + 0.15;
@@ -9401,8 +9428,10 @@ function installHeavy(fx) {
9401
9428
  c.cylinder(0.36, 0.38, 0.1, plate, -1.3, 3.13, 0);
9402
9429
  c.cylinder(0.3, 0.3, 0.05, MT.steel, -1.3, 3.2, 0);
9403
9430
  c.roundBox(0.2, 0.08, 1.3, 0.03, MT.trim, bx0 - 0.25, 3.13, 0);
9404
- [-0.45, 0, 0.45].forEach(function(z) {
9405
- c.roundBox(0.14, 0.08, 0.3, 0.03, MT.amber, bx0 - 0.25, 3.2, z);
9431
+ [-0.45, 0, 0.45].forEach(function(z, i) {
9432
+ const lamp = c.roundBox(0.14, 0.08, 0.3, 0.03, MT.amber, bx0 - 0.25, 3.2, z);
9433
+ lamp.userData.lamp = "beacon";
9434
+ lamp.userData.beaconSide = i % 2;
9406
9435
  });
9407
9436
  c.rod(new V3(-2.5, 3.08, 0.6), new V3(-2.5, 3.6, 0.6), 8e-3, MT.trim);
9408
9437
  c.rod(new V3(-2.8, 3.08, -0.6), new V3(-2.8, 3.4, -0.6), 0.01, MT.trim);
@@ -14534,7 +14563,7 @@ function installMotorcyclesCars(fx) {
14534
14563
  off: 3e-3,
14535
14564
  nv: 4
14536
14565
  });
14537
- skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
14566
+ const reflector = skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
14538
14567
  (o.proj || []).forEach(function(q) {
14539
14568
  const r = sh(q[0]), y = (r[0] + r[1]) / 2 + (q[1] || 0), s = Gd.at(q[0], y), rad = q[2] || Math.min(0.034, (r[1] - r[0]) * 0.4);
14540
14569
  const cup = onSurf(c.cylinder(rad * 1.35, rad * 1.2, 0.012, LH, 0, 0, 0), s, 8e-3);
@@ -14565,7 +14594,7 @@ function installMotorcyclesCars(fx) {
14565
14594
  lens.push(ln);
14566
14595
  if (!inner.length) inner.push(ln);
14567
14596
  const cs = Gd.at(0.5, (rg[0] + rg[1]) / 2).p;
14568
- regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner, lens, cs);
14597
+ Object.assign(regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner, lens, cs), { reflector: [reflector] });
14569
14598
  return Gd;
14570
14599
  };
14571
14600
  K.tail = function(sd, o) {
@@ -14925,8 +14954,11 @@ function installMotorcyclesCars(fx) {
14925
14954
  );
14926
14955
  });
14927
14956
  const wy = gh.belt + 0.06, wx = gh.fb - 0.03;
14928
- [-0.3, 0.2].forEach(function(z) {
14929
- c.rod(new V3(wx + 0.02, wy, z + 0.02), new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
14957
+ [-0.3, 0.2].forEach(function(z, index) {
14958
+ const spindle = new V3(wx + 0.02, wy, z + 0.02);
14959
+ const blade = c.rod(spindle, new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
14960
+ const along = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize();
14961
+ tagWiper({ context: c, parts: [blade], spindle, normal: new V3(along.y, -along.x, 0), index });
14930
14962
  });
14931
14963
  if (s.fin !== false)
14932
14964
  c.sphere(0.1, s.roofCol ? c.paint(s.roofCol) : GLOSS, gh.rt + 0.2, roofAt(gh, gh.rt + 0.2) + 0.045, 0, 1, 0.45, 0.28, {
@@ -15059,7 +15091,9 @@ function installMotorcyclesCars(fx) {
15059
15091
  function fogLamp(c, s, r) {
15060
15092
  onSurf(c.cylinder(r * 1.4, r * 1.4, 0.014, LH, 0, 0, 0), s, 6e-3).castShadow = false;
15061
15093
  onSurf(c.cylinder(r, r, 0.012, REFL, 0, 0, 0), s, 0.012).castShadow = false;
15062
- onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016).castShadow = false;
15094
+ const bulb = onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016);
15095
+ bulb.castShadow = false;
15096
+ (c.fogBulbs ?? (c.fogBulbs = [])).push(bulb);
15063
15097
  }
15064
15098
  function crease(c, I, sd, pts, o) {
15065
15099
  o = o || {};
@@ -16407,7 +16441,7 @@ function installMotorcyclesCars(fx) {
16407
16441
  K.skin(Gs2, CM(blueP, { roughness: 0.45, metalness: 0.2 }), { yb: 0.775, yt: 0.83, off: 7e-3, nv: 1, u0: 0.01, u1: 0.99 });
16408
16442
  K.skin(Gs2, CM(yellowP, { roughness: 0.45, metalness: 0.2 }), { yb: 0.746, yt: 0.77, off: 7e-3, nv: 1, u0: 0.01, u1: 0.99 });
16409
16443
  }
16410
- const f = sd > 0 ? "+z" : "-z", pt = Gd.at(Gd.ux ? 0.5 : 0.5, 0.62).p;
16444
+ const f = sd > 0 ? "+z" : "-z", pt = Gd.at(0.5, 0.62).p;
16411
16445
  if (highwayPolice)
16412
16446
  c2.text(trl("texts.federal_highway_police"), 1.9, 0.13, -0.32, 0.6, sd * (Math.abs(pt.z) + 0.012), f, {
16413
16447
  fg: blueP,
@@ -16445,6 +16479,10 @@ function installMotorcyclesCars(fx) {
16445
16479
  }
16446
16480
  }
16447
16481
  });
16482
+ beacon[1].userData.lamp = "beacon";
16483
+ beacon[1].userData.beaconSide = 0;
16484
+ beacon[2].userData.lamp = "beacon";
16485
+ beacon[2].userData.beaconSide = 1;
16448
16486
  c2.meta.top = top + 0.15;
16449
16487
  c2.meta.roof.y = Math.max(c2.meta.roof.y, top + 0.15);
16450
16488
  const fx2 = I.fxB + 0.12, push = [];
@@ -17485,7 +17523,8 @@ function installMotorcyclesCars(fx) {
17485
17523
  const fw = kit.spokedWheel(c, 0.78, 0.325, 0.06, { spokes: 40, knobby: true, disc: true, label: trl("labels.front_tire") });
17486
17524
  const rw = kit.spokedWheel(c, -0.72, 0.318, 0.08, { spokes: 40, knobby: true, label: trl("labels.rear_tire") });
17487
17525
  [fw, rw].forEach(function(g) {
17488
- g.children.forEach(function(ch) {
17526
+ g.children.forEach(function(o) {
17527
+ const ch = o;
17489
17528
  if (ch.geometry && ch.geometry.type === "TorusGeometry" && ch.material === MT.chrome) ch.material = rimGold;
17490
17529
  });
17491
17530
  });
@@ -17747,7 +17786,9 @@ function installMotorcyclesCars(fx) {
17747
17786
  c.roundBox(0.5, 0.018, 6e-3, 2e-3, c.paint("#f2c21a"), -0.7, 0.825, z);
17748
17787
  c.text("PRF", 0.2, 0.08, -0.7, 0.73, z + s * 2e-3, f, { fg: "#1f3f8f", size: 0.85 });
17749
17788
  c.text(trl("texts.federal_highway_police"), 0.3, 0.035, 0.24, 1, s * 0.3, f, { fg: "#f4f2ea", w: 1024, h: 120, size: 0.8 });
17750
- c.roundBox(0.05, 0.05, 0.04, 0.012, s > 0 ? MT.blue : MT.tail, 0.62, 0.95, s * 0.3, { def: true });
17789
+ const flasher = c.roundBox(0.05, 0.05, 0.04, 0.012, s > 0 ? MT.blue : MT.tail, 0.62, 0.95, s * 0.3, { def: true });
17790
+ flasher.userData.lamp = "beacon";
17791
+ flasher.userData.beaconSide = s > 0 ? 1 : 0;
17751
17792
  });
17752
17793
  c.cylinder(0.04, 0.045, 0.06, MT.trim, 0.66, 0.66, 0.36, "x");
17753
17794
  }
@@ -18000,6 +18041,8 @@ function installMotorcyclesCars(fx) {
18000
18041
  fx.register(
18001
18042
  {
18002
18043
  key: "beetle",
18044
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
18045
+ headlightLens: "glass",
18003
18046
  group: "cars",
18004
18047
  name: trl("vehicles.beetle.name"),
18005
18048
  inspired: trl("vehicles.beetle.inspired"),
@@ -20006,13 +20049,9 @@ function installMotorcyclesExtra(fx) {
20006
20049
  }
20007
20050
 
20008
20051
  // src/vehicles/planes-extra.ts
20009
- function installPlanesExtra(fx) {
20010
- const kit = fx.kit;
20052
+ function createPlanesKit(kit) {
20011
20053
  const THREE = kit.THREE;
20012
- const shared = fx.shared;
20013
- const trl = fx.t;
20014
- const lbl = fx.label;
20015
- const V3 = kit.V3, PI = Math.PI, MT = kit.materials, CM = kit.makeMaterial, _G = kit.geo, _DS = THREE.DoubleSide;
20054
+ const V3 = kit.V3, PI = Math.PI, MT = kit.materials, CM = kit.makeMaterial;
20016
20055
  function pose3(Af, ra, Tf, rt) {
20017
20056
  let lo = 0, hi = 0.5, TH = 0;
20018
20057
  function f(t) {
@@ -20161,7 +20200,7 @@ function installPlanesExtra(fx) {
20161
20200
  m.rotation.y += -s * Math.atan2(a - b, w);
20162
20201
  return m;
20163
20202
  }
20164
- shared.GH = {
20203
+ return {
20165
20204
  pose3,
20166
20205
  starDecal,
20167
20206
  rrect,
@@ -20175,6 +20214,17 @@ function installPlanesExtra(fx) {
20175
20214
  liner,
20176
20215
  sideText
20177
20216
  };
20217
+ }
20218
+ function installPlanesExtra(fx) {
20219
+ const kit = fx.kit;
20220
+ const THREE = kit.THREE;
20221
+ const shared = fx.shared;
20222
+ const trl = fx.t;
20223
+ const lbl = fx.label;
20224
+ const V3 = kit.V3, PI = Math.PI, MT = kit.materials, CM = kit.makeMaterial, _G = kit.geo, _DS = THREE.DoubleSide;
20225
+ const GH = createPlanesKit(kit);
20226
+ shared.GH = GH;
20227
+ const { pose3, starDecal, rrect, polysSdf, pod, fSkin, fGlass, liner, sideText } = GH;
20178
20228
  fx.register(
20179
20229
  {
20180
20230
  key: "tandem_trainer",
@@ -22166,7 +22216,8 @@ function installSuvPickupVan(fx) {
22166
22216
  if (msh && msh.parent) warp(msh);
22167
22217
  });
22168
22218
  const bb = new THREE.Box3(), cen = new V3(), sz = new V3();
22169
- c.vehicle.children.slice().forEach(function(ob) {
22219
+ c.vehicle.children.slice().forEach(function(o3) {
22220
+ const ob = o3;
22170
22221
  if (skip.has(ob) || warpSet.has(ob)) return;
22171
22222
  if (ob.isMesh) {
22172
22223
  const g = ob.geometry;
@@ -22274,7 +22325,7 @@ function installSuvPickupVan(fx) {
22274
22325
  const x = kit.profX(s.lower, s.bottomY + 0.14, true) + 0.09;
22275
22326
  [1, -1].forEach(function(sd) {
22276
22327
  c.roundBox(0.04, r * 2.6, r * 3.2, 0.015, MT.housing, x, y, sd * z);
22277
- kit.headlight(c, {
22328
+ const lamp = kit.headlight(c, {
22278
22329
  style: "round",
22279
22330
  x: x + 0.01,
22280
22331
  y,
@@ -22286,6 +22337,7 @@ function installSuvPickupVan(fx) {
22286
22337
  label: sd > 0 ? trl("labels.right_fog_light") : trl("labels.left_fog_light"),
22287
22338
  reach: 0.5
22288
22339
  });
22340
+ lamp.fog = true;
22289
22341
  });
22290
22342
  }
22291
22343
  function roofBars(c, z, h, r) {
@@ -22380,7 +22432,8 @@ function installSuvPickupVan(fx) {
22380
22432
  }
22381
22433
  function plateOutside(c) {
22382
22434
  const m = c.meta;
22383
- c.vehicle.children.forEach(function(o) {
22435
+ c.vehicle.children.forEach(function(o3) {
22436
+ const o = o3;
22384
22437
  if (o.isMesh && o.geometry.type === "PlaneGeometry" && Math.abs(o.rotation.y + PI / 2) < 0.01 && o.position.x < m.rear + 0.2 && o.material.map && o.material.map.image && o.material.map.image.width === 400)
22385
22438
  o.position.x = Math.min(o.position.x, m.rear - BV * 0.5) - BV * 0.62;
22386
22439
  });
@@ -22550,7 +22603,8 @@ function installSuvPickupVan(fx) {
22550
22603
  }
22551
22604
  c.root.updateMatrixWorld(true);
22552
22605
  const gInv = new THREE.Matrix4().copy(c.vehicle.matrixWorld).invert(), rel = new THREE.Matrix4(), inv = new THREE.Matrix4(), v = new V3(), done = /* @__PURE__ */ new Set();
22553
- c.vehicle.traverse(function(ob) {
22606
+ c.vehicle.traverse(function(o3) {
22607
+ const ob = o3;
22554
22608
  if (!ob.isMesh || done.has(ob.geometry)) return;
22555
22609
  done.add(ob.geometry);
22556
22610
  rel.multiplyMatrices(gInv, ob.matrixWorld);
@@ -22616,7 +22670,8 @@ function installSuvPickupVan(fx) {
22616
22670
  c.lights.forEach(function(L) {
22617
22671
  if (!L.group || L.group.userData.recessed) return;
22618
22672
  L.group.userData.recessed = true;
22619
- L.group.children.slice().forEach(function(h) {
22673
+ L.group.children.slice().forEach(function(o3) {
22674
+ const h = o3;
22620
22675
  if (!h.isMesh || h.material !== MT.housing || h.geometry.type !== "BoxGeometry" || Math.abs(h.position.x) > 1e-3) return;
22621
22676
  h.geometry.computeBoundingBox();
22622
22677
  const bb = h.geometry.boundingBox, d = bb.max.x - bb.min.x;
@@ -22647,7 +22702,8 @@ function installSuvPickupVan(fx) {
22647
22702
  const cols = [m.color, m.roofCol].filter(Boolean).map(function(h) {
22648
22703
  return new THREE.Color(h).getHex();
22649
22704
  });
22650
- c.vehicle.children.forEach(function(o) {
22705
+ c.vehicle.children.forEach(function(o3) {
22706
+ const o = o3;
22651
22707
  if (!o.isMesh || gl.has(o) || o.geometry.type !== "BoxGeometry" || o.material === MT.trim || o.material === MT.chrome || o.material.transparent)
22652
22708
  return;
22653
22709
  if (o.material.color && cols.indexOf(o.material.color.getHex()) >= 0) return;
@@ -23491,7 +23547,8 @@ function installSuvPickupVan(fx) {
23491
23547
  },
23492
23548
  post: function(c2, _m) {
23493
23549
  const gfx = fX(s, 0.8) + 0.04;
23494
- c2.vehicle.children.forEach(function(o) {
23550
+ c2.vehicle.children.forEach(function(o3) {
23551
+ const o = o3;
23495
23552
  if (o.isMesh && o.geometry.type === "PlaneGeometry" && Math.abs(o.rotation.y - PI / 2) < 0.01 && o.position.x > 1.5 && o.material.map && o.material.map.image && o.material.map.image.width === 400)
23496
23553
  o.position.x = Math.max(o.position.x, gfx);
23497
23554
  });
@@ -23826,7 +23883,7 @@ function installSuvPickupVan(fx) {
23826
23883
  kit.sideWindows(c, [cab], W, T, function() {
23827
23884
  return lbl("cab_window");
23828
23885
  });
23829
- winS.forEach(function(w, _i) {
23886
+ winS.forEach(function(w) {
23830
23887
  kit.sideWindows(
23831
23888
  c,
23832
23889
  [w.p],
@@ -24019,7 +24076,8 @@ function installSuvPickupVan(fx) {
24019
24076
  fxKey: "lid",
24020
24077
  dir: "front"
24021
24078
  });
24022
- c.vehicle.children.forEach(function(o) {
24079
+ c.vehicle.children.forEach(function(o3) {
24080
+ const o = o3;
24023
24081
  if (o.isMesh && o.geometry.type === "PlaneGeometry" && o.material.map && o.material.map.image && o.material.map.image.width === 400 && o.position.x < 0)
24024
24082
  o.position.y = 0.84;
24025
24083
  });
@@ -24070,7 +24128,7 @@ function installSuvPickupVan(fx) {
24070
24128
  grille: { style: "truck", w: 0.84, h: 0.28, y: 0.86 },
24071
24129
  seams: [1.62, 0.44],
24072
24130
  handles: [0.6],
24073
- extra: function(c2, m, _A) {
24131
+ extra: function(c2, m) {
24074
24132
  const fx2 = kit.profX(m.vanLow, 0.86, true);
24075
24133
  kit.emblem(c2, fx2 + 0.1, 0.86, 0, 0.1);
24076
24134
  const bfx = kit.profX(m.vanLow, 0.56, true);
@@ -24101,7 +24159,8 @@ function installSuvPickupVan(fx) {
24101
24159
  [cx0 + 0.9, 0.82, -0.3, "#7a5c3a"],
24102
24160
  [cx0 + 0.6, 1.18, -0.3, "#8a6a44"],
24103
24161
  [cx0 + 1.6, 0.82, 0, "#6d5232"]
24104
- ].forEach(function(b) {
24162
+ ].forEach(function(q) {
24163
+ const b = q;
24105
24164
  c2.roundBox(0.5, 0.4, 0.5, 0.02, CM(b[3], { roughness: 0.9 }), b[0], b[1], b[2]);
24106
24165
  });
24107
24166
  c2.part("cargo", trl("labels.cargo_box"), null, new V3(m.rear + 1.4, 1.2, 0), 1.3);
@@ -24281,18 +24340,19 @@ function installSuvPickupVan(fx) {
24281
24340
  c2.roundBox(0.03, 0.12, 1.9, 0.01, rd, m.rear - 8e-3, 1.1, 0);
24282
24341
  const beaconBar = [c2.roundBox(0.3, 0.08, 1.5, 0.03, MT.trim, 0.6, m.top + 0.04, 0)];
24283
24342
  [-0.5, -0.17, 0.17, 0.5].forEach(function(z, i) {
24284
- beaconBar.push(
24285
- c2.roundBox(
24286
- 0.24,
24287
- 0.1,
24288
- 0.3,
24289
- 0.04,
24290
- i % 2 ? MT.tail : CM("#f2f2f2", { emissive: new THREE.Color("#ffffff"), emissiveIntensity: 0.6 }),
24291
- 0.6,
24292
- m.top + 0.13,
24293
- z
24294
- )
24343
+ const lamp = c2.roundBox(
24344
+ 0.24,
24345
+ 0.1,
24346
+ 0.3,
24347
+ 0.04,
24348
+ i % 2 ? MT.tail : CM("#f2f2f2", { emissive: new THREE.Color("#ffffff"), emissiveIntensity: 0.6 }),
24349
+ 0.6,
24350
+ m.top + 0.13,
24351
+ z
24295
24352
  );
24353
+ lamp.userData.lamp = "beacon";
24354
+ lamp.userData.beaconSide = z < 0 ? 0 : 1;
24355
+ beaconBar.push(lamp);
24296
24356
  });
24297
24357
  beaconBar.push(
24298
24358
  c2.roundBox(
@@ -24346,7 +24406,7 @@ function installSuvPickupVan(fx) {
24346
24406
  c2.cylinder(0.03, 0.04, 0.08, MT.chrome, sx + 2.35, fl + 0.99, -0.75);
24347
24407
  c2.part("fuel_tank", trl("labels.oxygen_cylinder"), null, new V3(sx + 2.35, fl + 0.5, -0.75), 0.5);
24348
24408
  c2.roundBox(0.04, 0.26, 0.34, 0.02, MT.screen, 0.1, 1.7, 0.5);
24349
- const light = c2.roundBox(
24409
+ const lightPanel = c2.roundBox(
24350
24410
  2.3,
24351
24411
  0.02,
24352
24412
  W - 0.3,
@@ -24356,7 +24416,7 @@ function installSuvPickupVan(fx) {
24356
24416
  m.top - 0.06,
24357
24417
  0
24358
24418
  );
24359
- light.castShadow = false;
24419
+ lightPanel.castShadow = false;
24360
24420
  m.roofItems = beaconBar;
24361
24421
  }
24362
24422
  });
@@ -24387,13 +24447,9 @@ function installSuvPickupVan(fx) {
24387
24447
  }
24388
24448
 
24389
24449
  // src/vehicles/water-air.ts
24390
- function installWaterAir(fx) {
24391
- const kit = fx.kit;
24450
+ function createWaterAirKit(kit) {
24392
24451
  const THREE = kit.THREE;
24393
- const shared = fx.shared;
24394
- const trl = fx.t;
24395
- const lbl = fx.label;
24396
- const V3 = kit.V3, PI = Math.PI, MT = kit.materials, CM = kit.makeMaterial, _paintCol = kit.paintColor, G = kit.geo, DS = THREE.DoubleSide, clamp = kit.clamp;
24452
+ const V3 = kit.V3, PI = Math.PI, MT = kit.materials, CM = kit.makeMaterial, G = kit.geo, clamp = kit.clamp;
24397
24453
  function colorize(geo, fn) {
24398
24454
  const p = geo.attributes.position, col = new Float32Array(p.count * 3);
24399
24455
  for (let i = 0; i < p.count; i++) {
@@ -24863,7 +24919,8 @@ function installWaterAir(fx) {
24863
24919
  function bake(c, grp) {
24864
24920
  grp.updateMatrix();
24865
24921
  const M = grp.matrix;
24866
- grp.children.slice().forEach(function(o) {
24922
+ grp.children.slice().forEach(function(o3) {
24923
+ const o = o3;
24867
24924
  o.updateMatrix();
24868
24925
  const m = new THREE.Matrix4().multiplyMatrices(M, o.matrix);
24869
24926
  grp.remove(o);
@@ -25065,7 +25122,7 @@ function installWaterAir(fx) {
25065
25122
  t.rotation.y += s > 0 ? -Math.atan(m) : Math.atan(m);
25066
25123
  return t;
25067
25124
  }
25068
- shared.EA = {
25125
+ return {
25069
25126
  colorize,
25070
25127
  tab,
25071
25128
  tabL,
@@ -25103,6 +25160,15 @@ function installWaterAir(fx) {
25103
25160
  pedals,
25104
25161
  NAV
25105
25162
  };
25163
+ }
25164
+ function installWaterAir(fx) {
25165
+ const kit = fx.kit;
25166
+ const THREE = kit.THREE;
25167
+ const shared = fx.shared;
25168
+ const trl = fx.t;
25169
+ const lbl = fx.label;
25170
+ const V3 = kit.V3, PI = Math.PI, MT = kit.materials, CM = kit.makeMaterial, _paintCol = kit.paintColor, DS = THREE.DoubleSide;
25171
+ shared.EA = createWaterAirKit(kit);
25106
25172
  fx.register(
25107
25173
  {
25108
25174
  key: "river_skiff",
@@ -27211,6 +27277,7 @@ function createContext(kit, options) {
27211
27277
  shared,
27212
27278
  t,
27213
27279
  label: (key) => ({ key, label: t("labels." + key) }),
27280
+ hasSunroof: (key) => !!options.sunroofs?.includes(key),
27214
27281
  register(spec, build) {
27215
27282
  if (!groups.has(spec.group) || only && !only.has(spec.key) || skip.has(spec.key)) return;
27216
27283
  kit.register({ ...spec, seedKey: legacyVehicleSeeds[spec.key] }, build);
@@ -29466,7 +29533,31 @@ var stats = stats_default;
29466
29533
  var cards = cards_pt_BR_default;
29467
29534
  var fleetStats = (id) => stats[id];
29468
29535
  var fleetCard = (id) => cards[id];
29536
+
29537
+ // src/proving.ts
29538
+ var FLEET_FOUR_WHEEL_DRIVE = ["light_4x4", "troop_truck", "apc_6x6", "armored_car_6x6", "battle_tank", "monster_truck", "midsize_pickup", "large_suv", "tractor", "quad_bike"];
29539
+ var fleetGroupOf = (id) => Object.entries(fleetGroups).find(([, ids]) => ids.includes(id))?.[0];
29540
+ function fleetProvingSubject(id, options = {}) {
29541
+ const stats2 = fleetStats(id);
29542
+ const dims = fleetDims(id);
29543
+ if (!stats2 || !dims) return null;
29544
+ const group = fleetGroupOf(id) ?? "cars";
29545
+ const density = { motorcycles: 90, cars: 88, suvs: 90, pickups: 95, vans: 80, heavy: 120, agricultural: 150, military: 260, water: 60, air: 40 };
29546
+ return {
29547
+ id,
29548
+ domain: group === "water" ? "water" : group === "air" ? "air" : "land",
29549
+ category: group,
29550
+ stats: { acceleration: stats2.acceleration, handling: stats2.handling, maxSpeedKmh: stats2.maxSpeedKmh },
29551
+ body: {
29552
+ mass: options.mass ?? Math.round((density[group] ?? 90) * dims.length * dims.width * dims.height),
29553
+ wheelbase: options.wheelbase ?? Math.round(dims.length * 0.6 * 100) / 100,
29554
+ track: options.track ?? Math.round(dims.width * 0.82 * 100) / 100,
29555
+ fourWheelDrive: options.fourWheelDrive ?? FLEET_FOUR_WHEEL_DRIVE.includes(id)
29556
+ }
29557
+ };
29558
+ }
29469
29559
  export {
29560
+ FLEET_FOUR_WHEEL_DRIVE,
29470
29561
  agricultural,
29471
29562
  air,
29472
29563
  allFleetDims,
@@ -29478,8 +29569,10 @@ export {
29478
29569
  fleetCard,
29479
29570
  fleetDims,
29480
29571
  fleetGroupIds,
29572
+ fleetGroupOf,
29481
29573
  fleetGroups,
29482
29574
  fleetPack,
29575
+ fleetProvingSubject,
29483
29576
  fleetStats,
29484
29577
  fleetVehicleIds,
29485
29578
  heavy,