@adatechnology/game-urban 0.3.2 → 0.3.4

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.
@@ -9210,6 +9210,18 @@ var GameUrban = (() => {
9210
9210
  }
9211
9211
  );
9212
9212
  }
9213
+ var WIPER_SWEEP = 1.5;
9214
+ function tagWiper(params) {
9215
+ var _a;
9216
+ 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] };
9217
+ (_a = params.context).wipers ?? (_a.wipers = []);
9218
+ for (const part of params.parts) params.context.wipers.push({ part, tag });
9219
+ }
9220
+ function markSunroof(pane2, slide) {
9221
+ pane2.name = "sunroof";
9222
+ pane2.userData.sunroof = { slide };
9223
+ return pane2;
9224
+ }
9213
9225
  function installCarsExtra(fx) {
9214
9226
  const kit = fx.kit;
9215
9227
  const THREE = kit.THREE;
@@ -9706,7 +9718,7 @@ var GameUrban = (() => {
9706
9718
  off: 3e-3,
9707
9719
  nv: 4
9708
9720
  });
9709
- skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
9721
+ const reflector = skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
9710
9722
  (o.proj || []).forEach(function(q) {
9711
9723
  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);
9712
9724
  const cup = onSurf(c.cylinder(rad * 1.35, rad * 1.2, 0.012, LH, 0, 0, 0), s, 8e-3);
@@ -9737,7 +9749,7 @@ var GameUrban = (() => {
9737
9749
  lens.push(ln);
9738
9750
  if (!inner2.length) inner2.push(ln);
9739
9751
  const cs = Gd.at(0.5, (rg[0] + rg[1]) / 2).p;
9740
- regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner2, lens, cs);
9752
+ Object.assign(regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner2, lens, cs), { reflector: [reflector] });
9741
9753
  return Gd;
9742
9754
  };
9743
9755
  K.tail = function(sd, o) {
@@ -10123,12 +10135,18 @@ var GameUrban = (() => {
10123
10135
  (s.wiper === 1 ? [[0.12, 0.66, -0.5]] : [
10124
10136
  [-0.3, 0.42, -0.36],
10125
10137
  [0.2, 0.42, -0.36]
10126
- ]).forEach(function(q) {
10138
+ ]).forEach(function(q, index) {
10127
10139
  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);
10128
10140
  p1.z += q[2];
10129
- c.rod(p0, p1, 9e-3, MT.trim);
10130
- c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
10141
+ const blade = c.rod(p0, p1, 9e-3, MT.trim);
10142
+ const cap = c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
10143
+ tagWiper({ context: c, parts: [blade, cap], spindle: p0, normal: wn, index });
10131
10144
  });
10145
+ if (s.sunroof) {
10146
+ 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);
10147
+ c.roundBox(sl, 8e-3, sw, 0.01, PLASTIC, sx, sy + 4e-3, 0, { rot: [0, 0, tilt] }).castShadow = false;
10148
+ 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);
10149
+ }
10132
10150
  if (s.fin !== false)
10133
10151
  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, {
10134
10152
  tl: PI / 2
@@ -11104,6 +11122,7 @@ var GameUrban = (() => {
11104
11122
  function(c) {
11105
11123
  const hex = "#8c2b2b";
11106
11124
  car(c, {
11125
+ sunroof: fx.hasSunroof("turbo_hatch"),
11107
11126
  W: 1.751,
11108
11127
  col: hex,
11109
11128
  shelf: 0.42,
@@ -11381,6 +11400,7 @@ var GameUrban = (() => {
11381
11400
  function(c) {
11382
11401
  const hex = "#5a5f66";
11383
11402
  car(c, {
11403
+ sunroof: fx.hasSunroof("fastback_sedan"),
11384
11404
  W: 1.799,
11385
11405
  col: hex,
11386
11406
  bottomY: 0.2,
@@ -11675,6 +11695,8 @@ var GameUrban = (() => {
11675
11695
  fx.register(
11676
11696
  {
11677
11697
  key: "classic_six_sedan",
11698
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
11699
+ headlightLens: "glass",
11678
11700
  group: "cars",
11679
11701
  name: trl("vehicles.classic_six_sedan.name"),
11680
11702
  inspired: trl("vehicles.classic_six_sedan.inspired"),
@@ -13612,8 +13634,10 @@ var GameUrban = (() => {
13612
13634
  c.cylinder(0.36, 0.38, 0.1, plate, -1.3, 3.13, 0);
13613
13635
  c.cylinder(0.3, 0.3, 0.05, MT.steel, -1.3, 3.2, 0);
13614
13636
  c.roundBox(0.2, 0.08, 1.3, 0.03, MT.trim, bx0 - 0.25, 3.13, 0);
13615
- [-0.45, 0, 0.45].forEach(function(z) {
13616
- c.roundBox(0.14, 0.08, 0.3, 0.03, MT.amber, bx0 - 0.25, 3.2, z);
13637
+ [-0.45, 0, 0.45].forEach(function(z, i) {
13638
+ const lamp = c.roundBox(0.14, 0.08, 0.3, 0.03, MT.amber, bx0 - 0.25, 3.2, z);
13639
+ lamp.userData.lamp = "beacon";
13640
+ lamp.userData.beaconSide = i % 2;
13617
13641
  });
13618
13642
  c.rod(new V3(-2.5, 3.08, 0.6), new V3(-2.5, 3.6, 0.6), 8e-3, MT.trim);
13619
13643
  c.rod(new V3(-2.8, 3.08, -0.6), new V3(-2.8, 3.4, -0.6), 0.01, MT.trim);
@@ -19130,8 +19154,11 @@ var GameUrban = (() => {
19130
19154
  );
19131
19155
  });
19132
19156
  const wy = gh.belt + 0.06, wx = gh.fb - 0.03;
19133
- [-0.3, 0.2].forEach(function(z) {
19134
- 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);
19157
+ [-0.3, 0.2].forEach(function(z, index) {
19158
+ const spindle = new V3(wx + 0.02, wy, z + 0.02);
19159
+ const blade = c.rod(spindle, new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
19160
+ const along = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize();
19161
+ tagWiper({ context: c, parts: [blade], spindle, normal: new V3(along.y, -along.x, 0), index });
19135
19162
  });
19136
19163
  if (s.fin !== false)
19137
19164
  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, {
@@ -20652,6 +20679,10 @@ var GameUrban = (() => {
20652
20679
  }
20653
20680
  }
20654
20681
  });
20682
+ beacon[1].userData.lamp = "beacon";
20683
+ beacon[1].userData.beaconSide = 0;
20684
+ beacon[2].userData.lamp = "beacon";
20685
+ beacon[2].userData.beaconSide = 1;
20655
20686
  c2.meta.top = top + 0.15;
20656
20687
  c2.meta.roof.y = Math.max(c2.meta.roof.y, top + 0.15);
20657
20688
  const fx2 = I.fxB + 0.12, push = [];
@@ -21954,7 +21985,9 @@ var GameUrban = (() => {
21954
21985
  c.roundBox(0.5, 0.018, 6e-3, 2e-3, c.paint("#f2c21a"), -0.7, 0.825, z);
21955
21986
  c.text("PRF", 0.2, 0.08, -0.7, 0.73, z + s * 2e-3, f, { fg: "#1f3f8f", size: 0.85 });
21956
21987
  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 });
21957
- 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 });
21988
+ 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 });
21989
+ flasher.userData.lamp = "beacon";
21990
+ flasher.userData.beaconSide = s > 0 ? 1 : 0;
21958
21991
  });
21959
21992
  c.cylinder(0.04, 0.045, 0.06, MT.trim, 0.66, 0.66, 0.36, "x");
21960
21993
  }
@@ -22207,6 +22240,8 @@ var GameUrban = (() => {
22207
22240
  fx.register(
22208
22241
  {
22209
22242
  key: "beetle",
22243
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
22244
+ headlightLens: "glass",
22210
22245
  group: "cars",
22211
22246
  name: trl("vehicles.beetle.name"),
22212
22247
  inspired: trl("vehicles.beetle.inspired"),
@@ -28483,18 +28518,19 @@ var GameUrban = (() => {
28483
28518
  c2.roundBox(0.03, 0.12, 1.9, 0.01, rd, m.rear - 8e-3, 1.1, 0);
28484
28519
  const beaconBar = [c2.roundBox(0.3, 0.08, 1.5, 0.03, MT.trim, 0.6, m.top + 0.04, 0)];
28485
28520
  [-0.5, -0.17, 0.17, 0.5].forEach(function(z, i) {
28486
- beaconBar.push(
28487
- c2.roundBox(
28488
- 0.24,
28489
- 0.1,
28490
- 0.3,
28491
- 0.04,
28492
- i % 2 ? MT.tail : CM("#f2f2f2", { emissive: new THREE.Color("#ffffff"), emissiveIntensity: 0.6 }),
28493
- 0.6,
28494
- m.top + 0.13,
28495
- z
28496
- )
28521
+ const lamp = c2.roundBox(
28522
+ 0.24,
28523
+ 0.1,
28524
+ 0.3,
28525
+ 0.04,
28526
+ i % 2 ? MT.tail : CM("#f2f2f2", { emissive: new THREE.Color("#ffffff"), emissiveIntensity: 0.6 }),
28527
+ 0.6,
28528
+ m.top + 0.13,
28529
+ z
28497
28530
  );
28531
+ lamp.userData.lamp = "beacon";
28532
+ lamp.userData.beaconSide = z < 0 ? 0 : 1;
28533
+ beaconBar.push(lamp);
28498
28534
  });
28499
28535
  beaconBar.push(
28500
28536
  c2.roundBox(
@@ -31408,6 +31444,7 @@ var GameUrban = (() => {
31408
31444
  shared,
31409
31445
  t,
31410
31446
  label: (key) => ({ key, label: t("labels." + key) }),
31447
+ hasSunroof: (key) => !!options.sunroofs?.includes(key),
31411
31448
  register(spec, build) {
31412
31449
  if (!groups.has(spec.group) || only && !only.has(spec.key) || skip.has(spec.key)) return;
31413
31450
  kit.register({ ...spec, seedKey: legacyVehicleSeeds[spec.key] }, build);