@adatechnology/game-urban-three 0.3.3 → 0.3.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.
@@ -163,7 +163,7 @@ var GameUrbanThree = (() => {
163
163
  }
164
164
  var EFFECT_STEP_SECONDS = 1 / 50;
165
165
 
166
- // ../game-shapes/dist/chunk-M5N2SHNL.js
166
+ // ../game-shapes/dist/chunk-FZQTELDQ.js
167
167
  function canonicalJson(value) {
168
168
  if (value === null) return "null";
169
169
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
@@ -1039,17 +1039,19 @@ var GameUrbanThree = (() => {
1039
1039
  if (p.prevZ) p.prevZ.nextZ = p.nextZ;
1040
1040
  if (p.nextZ) p.nextZ.prevZ = p.prevZ;
1041
1041
  }
1042
- function Node(i, x, y) {
1043
- this.i = i;
1044
- this.x = x;
1045
- this.y = y;
1046
- this.prev = null;
1047
- this.next = null;
1048
- this.z = 0;
1049
- this.prevZ = null;
1050
- this.nextZ = null;
1051
- this.steiner = false;
1052
- }
1042
+ var Node = class {
1043
+ constructor(i, x, y) {
1044
+ this.i = i;
1045
+ this.x = x;
1046
+ this.y = y;
1047
+ this.prev = null;
1048
+ this.next = null;
1049
+ this.z = 0;
1050
+ this.prevZ = null;
1051
+ this.nextZ = null;
1052
+ this.steiner = false;
1053
+ }
1054
+ };
1053
1055
  function signedArea(data, start, end, dim) {
1054
1056
  let sum2 = 0;
1055
1057
  for (let i = start, j = end - dim; i < end; i += dim) {
@@ -16427,6 +16429,18 @@ gl_Position = projectionMatrix * mvPosition;
16427
16429
  }
16428
16430
  );
16429
16431
  }
16432
+ var WIPER_SWEEP = 1.5;
16433
+ function tagWiper(params) {
16434
+ var _a;
16435
+ 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] };
16436
+ (_a = params.context).wipers ?? (_a.wipers = []);
16437
+ for (const part of params.parts) params.context.wipers.push({ part, tag });
16438
+ }
16439
+ function markSunroof(pane2, slide) {
16440
+ pane2.name = "sunroof";
16441
+ pane2.userData.sunroof = { slide };
16442
+ return pane2;
16443
+ }
16430
16444
  function installCarsExtra(fx) {
16431
16445
  const kit = fx.kit;
16432
16446
  const THREE = kit.THREE;
@@ -16923,7 +16937,7 @@ gl_Position = projectionMatrix * mvPosition;
16923
16937
  off: 3e-3,
16924
16938
  nv: 4
16925
16939
  });
16926
- skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
16940
+ const reflector = skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
16927
16941
  (o.proj || []).forEach(function(q) {
16928
16942
  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);
16929
16943
  const cup = onSurf(c.cylinder(rad * 1.35, rad * 1.2, 0.012, LH, 0, 0, 0), s, 8e-3);
@@ -16954,7 +16968,7 @@ gl_Position = projectionMatrix * mvPosition;
16954
16968
  lens.push(ln);
16955
16969
  if (!inner2.length) inner2.push(ln);
16956
16970
  const cs = Gd.at(0.5, (rg[0] + rg[1]) / 2).p;
16957
- regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner2, lens, cs);
16971
+ Object.assign(regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner2, lens, cs), { reflector: [reflector] });
16958
16972
  return Gd;
16959
16973
  };
16960
16974
  K.tail = function(sd, o) {
@@ -17340,12 +17354,18 @@ gl_Position = projectionMatrix * mvPosition;
17340
17354
  (s.wiper === 1 ? [[0.12, 0.66, -0.5]] : [
17341
17355
  [-0.3, 0.42, -0.36],
17342
17356
  [0.2, 0.42, -0.36]
17343
- ]).forEach(function(q) {
17357
+ ]).forEach(function(q, index) {
17344
17358
  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);
17345
17359
  p1.z += q[2];
17346
- c.rod(p0, p1, 9e-3, MT.trim);
17347
- c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
17360
+ const blade2 = c.rod(p0, p1, 9e-3, MT.trim);
17361
+ const cap = c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
17362
+ tagWiper({ context: c, parts: [blade2, cap], spindle: p0, normal: wn, index });
17348
17363
  });
17364
+ if (s.sunroof) {
17365
+ 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);
17366
+ c.roundBox(sl, 8e-3, sw, 0.01, PLASTIC, sx, sy + 4e-3, 0, { rot: [0, 0, tilt] }).castShadow = false;
17367
+ 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);
17368
+ }
17349
17369
  if (s.fin !== false)
17350
17370
  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, {
17351
17371
  tl: PI / 2
@@ -18321,6 +18341,7 @@ gl_Position = projectionMatrix * mvPosition;
18321
18341
  function(c) {
18322
18342
  const hex = "#8c2b2b";
18323
18343
  car(c, {
18344
+ sunroof: fx.hasSunroof("turbo_hatch"),
18324
18345
  W: 1.751,
18325
18346
  col: hex,
18326
18347
  shelf: 0.42,
@@ -18598,6 +18619,7 @@ gl_Position = projectionMatrix * mvPosition;
18598
18619
  function(c) {
18599
18620
  const hex = "#5a5f66";
18600
18621
  car(c, {
18622
+ sunroof: fx.hasSunroof("fastback_sedan"),
18601
18623
  W: 1.799,
18602
18624
  col: hex,
18603
18625
  bottomY: 0.2,
@@ -18892,6 +18914,8 @@ gl_Position = projectionMatrix * mvPosition;
18892
18914
  fx.register(
18893
18915
  {
18894
18916
  key: "classic_six_sedan",
18917
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
18918
+ headlightLens: "glass",
18895
18919
  group: "cars",
18896
18920
  name: trl("vehicles.classic_six_sedan.name"),
18897
18921
  inspired: trl("vehicles.classic_six_sedan.inspired"),
@@ -20829,8 +20853,10 @@ gl_Position = projectionMatrix * mvPosition;
20829
20853
  c.cylinder(0.36, 0.38, 0.1, plate, -1.3, 3.13, 0);
20830
20854
  c.cylinder(0.3, 0.3, 0.05, MT.steel, -1.3, 3.2, 0);
20831
20855
  c.roundBox(0.2, 0.08, 1.3, 0.03, MT.trim, bx0 - 0.25, 3.13, 0);
20832
- [-0.45, 0, 0.45].forEach(function(z) {
20833
- c.roundBox(0.14, 0.08, 0.3, 0.03, MT.amber, bx0 - 0.25, 3.2, z);
20856
+ [-0.45, 0, 0.45].forEach(function(z, i) {
20857
+ const lamp = c.roundBox(0.14, 0.08, 0.3, 0.03, MT.amber, bx0 - 0.25, 3.2, z);
20858
+ lamp.userData.lamp = "beacon";
20859
+ lamp.userData.beaconSide = i % 2;
20834
20860
  });
20835
20861
  c.rod(new V3(-2.5, 3.08, 0.6), new V3(-2.5, 3.6, 0.6), 8e-3, MT.trim);
20836
20862
  c.rod(new V3(-2.8, 3.08, -0.6), new V3(-2.8, 3.4, -0.6), 0.01, MT.trim);
@@ -26347,8 +26373,11 @@ gl_Position = projectionMatrix * mvPosition;
26347
26373
  );
26348
26374
  });
26349
26375
  const wy = gh.belt + 0.06, wx = gh.fb - 0.03;
26350
- [-0.3, 0.2].forEach(function(z) {
26351
- 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);
26376
+ [-0.3, 0.2].forEach(function(z, index) {
26377
+ const spindle = new V3(wx + 0.02, wy, z + 0.02);
26378
+ const blade2 = c.rod(spindle, new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
26379
+ const along = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize();
26380
+ tagWiper({ context: c, parts: [blade2], spindle, normal: new V3(along.y, -along.x, 0), index });
26352
26381
  });
26353
26382
  if (s.fin !== false)
26354
26383
  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, {
@@ -27869,6 +27898,10 @@ gl_Position = projectionMatrix * mvPosition;
27869
27898
  }
27870
27899
  }
27871
27900
  });
27901
+ beacon[1].userData.lamp = "beacon";
27902
+ beacon[1].userData.beaconSide = 0;
27903
+ beacon[2].userData.lamp = "beacon";
27904
+ beacon[2].userData.beaconSide = 1;
27872
27905
  c2.meta.top = top + 0.15;
27873
27906
  c2.meta.roof.y = Math.max(c2.meta.roof.y, top + 0.15);
27874
27907
  const fx2 = I.fxB + 0.12, push = [];
@@ -29171,7 +29204,9 @@ gl_Position = projectionMatrix * mvPosition;
29171
29204
  c.roundBox(0.5, 0.018, 6e-3, 2e-3, c.paint("#f2c21a"), -0.7, 0.825, z);
29172
29205
  c.text("PRF", 0.2, 0.08, -0.7, 0.73, z + s * 2e-3, f, { fg: "#1f3f8f", size: 0.85 });
29173
29206
  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 });
29174
- 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 });
29207
+ 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 });
29208
+ flasher.userData.lamp = "beacon";
29209
+ flasher.userData.beaconSide = s > 0 ? 1 : 0;
29175
29210
  });
29176
29211
  c.cylinder(0.04, 0.045, 0.06, MT.trim, 0.66, 0.66, 0.36, "x");
29177
29212
  }
@@ -29424,6 +29459,8 @@ gl_Position = projectionMatrix * mvPosition;
29424
29459
  fx.register(
29425
29460
  {
29426
29461
  key: "beetle",
29462
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
29463
+ headlightLens: "glass",
29427
29464
  group: "cars",
29428
29465
  name: trl("vehicles.beetle.name"),
29429
29466
  inspired: trl("vehicles.beetle.inspired"),
@@ -35700,18 +35737,19 @@ gl_Position = projectionMatrix * mvPosition;
35700
35737
  c2.roundBox(0.03, 0.12, 1.9, 0.01, rd, m.rear - 8e-3, 1.1, 0);
35701
35738
  const beaconBar = [c2.roundBox(0.3, 0.08, 1.5, 0.03, MT.trim, 0.6, m.top + 0.04, 0)];
35702
35739
  [-0.5, -0.17, 0.17, 0.5].forEach(function(z, i) {
35703
- beaconBar.push(
35704
- c2.roundBox(
35705
- 0.24,
35706
- 0.1,
35707
- 0.3,
35708
- 0.04,
35709
- i % 2 ? MT.tail : CM("#f2f2f2", { emissive: new THREE.Color("#ffffff"), emissiveIntensity: 0.6 }),
35710
- 0.6,
35711
- m.top + 0.13,
35712
- z
35713
- )
35740
+ const lamp = c2.roundBox(
35741
+ 0.24,
35742
+ 0.1,
35743
+ 0.3,
35744
+ 0.04,
35745
+ i % 2 ? MT.tail : CM("#f2f2f2", { emissive: new THREE.Color("#ffffff"), emissiveIntensity: 0.6 }),
35746
+ 0.6,
35747
+ m.top + 0.13,
35748
+ z
35714
35749
  );
35750
+ lamp.userData.lamp = "beacon";
35751
+ lamp.userData.beaconSide = z < 0 ? 0 : 1;
35752
+ beaconBar.push(lamp);
35715
35753
  });
35716
35754
  beaconBar.push(
35717
35755
  c2.roundBox(
@@ -38625,6 +38663,7 @@ gl_Position = projectionMatrix * mvPosition;
38625
38663
  shared: shared2,
38626
38664
  t,
38627
38665
  label: (key) => ({ key, label: t("labels." + key) }),
38666
+ hasSunroof: (key) => !!options.sunroofs?.includes(key),
38628
38667
  register(spec, build) {
38629
38668
  if (!groups.has(spec.group) || only && !only.has(spec.key) || skip.has(spec.key)) return;
38630
38669
  kit.register({ ...spec, seedKey: legacyVehicleSeeds[spec.key] }, build);