@adatechnology/game-urban 0.3.2 → 0.3.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.
@@ -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"),
@@ -19130,8 +19152,11 @@ var GameUrban = (() => {
19130
19152
  );
19131
19153
  });
19132
19154
  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);
19155
+ [-0.3, 0.2].forEach(function(z, index) {
19156
+ const spindle = new V3(wx + 0.02, wy, z + 0.02);
19157
+ const blade = c.rod(spindle, new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
19158
+ const along = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize();
19159
+ tagWiper({ context: c, parts: [blade], spindle, normal: new V3(along.y, -along.x, 0), index });
19135
19160
  });
19136
19161
  if (s.fin !== false)
19137
19162
  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, {
@@ -22207,6 +22232,8 @@ var GameUrban = (() => {
22207
22232
  fx.register(
22208
22233
  {
22209
22234
  key: "beetle",
22235
+ // glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
22236
+ headlightLens: "glass",
22210
22237
  group: "cars",
22211
22238
  name: trl("vehicles.beetle.name"),
22212
22239
  inspired: trl("vehicles.beetle.inspired"),
@@ -31408,6 +31435,7 @@ var GameUrban = (() => {
31408
31435
  shared,
31409
31436
  t,
31410
31437
  label: (key) => ({ key, label: t("labels." + key) }),
31438
+ hasSunroof: (key) => !!options.sunroofs?.includes(key),
31411
31439
  register(spec, build) {
31412
31440
  if (!groups.has(spec.group) || only && !only.has(spec.key) || skip.has(spec.key)) return;
31413
31441
  kit.register({ ...spec, seedKey: legacyVehicleSeeds[spec.key] }, build);