@minicode-dev/chat 0.1.12 → 0.1.13

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.
@@ -1,4 +1,5 @@
1
- import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h, v as g } from "./fx-BHsl4S_J.js";
1
+ import { a as e, b as t, c as n, f as r, g as i, h as a, i as o, l as s, o as c, s as l, u } from "./tank-DIn6Jyt8.js";
2
+ import { a as d, i as f, n as p, o as m, r as h, t as g } from "./fx-BNJvJYOu.js";
2
3
  import { ACESFilmicToneMapping as _, Clock as v, DirectionalLight as y, DynamicDrawUsage as b, Fog as ee, Group as te, HemisphereLight as ne, InstancedMesh as re, Matrix4 as ie, Mesh as ae, MeshBasicMaterial as oe, MeshLambertMaterial as se, MeshStandardMaterial as ce, PCFSoftShadowMap as le, PerspectiveCamera as ue, PlaneGeometry as de, Scene as fe, Vector3 as x, WebGLRenderer as pe, sRGBEncoding as me } from "three";
3
4
  // src/games/tanks/scene/createTankScene.js
4
5
  var he = 1 / 15, ge = 4, _e = .04, S = {
@@ -30,30 +31,30 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
30
31
  stencil: !1,
31
32
  powerPreference: "high-performance"
32
33
  });
33
- D.outputEncoding = me, D.toneMapping = _, D.toneMappingExposure = 1.05, D.shadowMap.enabled = !0, D.shadowMap.type = le, D.shadowMap.autoUpdate = !1, D.setPixelRatio(xe(T)), D.setClearColor(p.horizon, 1);
34
+ D.outputEncoding = me, D.toneMapping = _, D.toneMappingExposure = 1.05, D.shadowMap.enabled = !0, D.shadowMap.type = le, D.shadowMap.autoUpdate = !1, D.setPixelRatio(xe(T)), D.setClearColor(h.horizon, 1);
34
35
  let O = D.domElement;
35
36
  O.style.display = "block", O.style.width = "100%", O.style.height = "100%", O.style.outline = "none", S.appendChild(O);
36
37
  let Ee = Math.max(1, S.clientWidth), De = Math.max(1, S.clientHeight);
37
38
  D.setSize(Ee, De, !1);
38
39
  let k = new fe();
39
- k.fog = new ee(p.fog.clone(), 200, 700);
40
+ k.fog = new ee(h.fog.clone(), 200, 700);
40
41
  let A = new ue(45, Ee / De, .5, 1400), j = new te();
41
42
  k.add(j);
42
43
  let Oe = new ne(a("#ffd2b0"), a("#33402f"), .6), M = new y(a("#ffbe7a"), 1.9);
43
44
  M.shadow.mapSize.set(ve, ve), M.shadow.bias = -6e-4, M.shadow.normalBias = .04;
44
45
  let ke = M.shadow.camera;
45
46
  ke.left = -120, ke.right = 120, ke.top = 120, ke.bottom = -120, ke.near = 20, ke.far = 520, ke.updateProjectionMatrix(), k.add(Oe, M, M.target);
46
- let Ae = s(ye);
47
+ let Ae = d(ye);
47
48
  k.add(Ae.mesh);
48
- let je = t(new x(80, 0, 80), ye);
49
+ let je = f(new x(80, 0, 80), ye);
49
50
  k.add(je.mesh);
50
- let N = h();
51
+ let N = m();
51
52
  j.add(N.mesh);
52
- let P = u(), F = m(k, {
53
+ let P = p(), F = g(k, {
53
54
  quality: T,
54
55
  reducedMotion: C,
55
56
  heightAt: N.heightAt
56
- }), Me = o(), I = e(), L = /* @__PURE__ */ new Map(), Ne = [], R = null;
57
+ }), Me = c(), I = l(), L = /* @__PURE__ */ new Map(), Ne = [], R = null;
57
58
  function Pe() {
58
59
  return T === "low" ? new se({ vertexColors: !0 }) : new ce({
59
60
  vertexColors: !0,
@@ -62,10 +63,10 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
62
63
  });
63
64
  }
64
65
  function Fe() {
65
- I.wheelMat = Pe(), R = new re(Me.wheel, I.wheelMat, ge * l.length), R.instanceMatrix.setUsage(b), R.frustumCulled = !1, R.count = 0, j.add(R);
66
+ I.wheelMat = Pe(), R = new re(Me.wheel, I.wheelMat, ge * o.length), R.instanceMatrix.setUsage(b), R.frustumCulled = !1, R.count = 0, j.add(R);
66
67
  }
67
68
  Fe();
68
- let Ie = r(64), Le = new de(1, 1);
69
+ let Ie = s(64), Le = new de(1, 1);
69
70
  Le.rotateX(-Math.PI / 2);
70
71
  let Re = new oe({
71
72
  map: Ie,
@@ -129,21 +130,21 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
129
130
  e === 0 ? (K.copy(Xe), K.y = N.ready ? N.heightAt(Xe.x, Xe.z) : 0, i = t + 1, a = r) : K.multiplyScalar(1 / e), e < 2 && (i = t + 1, a = r);
130
131
  let o = i - t, s = a - r, c = e >= 2 ? Math.hypot(o, s) : 30, l = A.fov * n / 2;
131
132
  if (Y && e >= 2) {
132
- let e = o / c, n = s / c, l = t, u = 0, f = r, p = V == null ? null : L.get(V);
133
- p && p.state.x === i && p.state.z === a && (e = -e, n = -n, l = i, f = a), u = N.ready ? N.heightAt(l, f) : K.y;
134
- let m = -n, h = e, g = d(c * .3, 16, 70), _ = c * .3 + 8, v = c * .1;
135
- J.dPos.set(l - e * g + m * v, u + _, f - n * g + h * v), J.dTarget.set(l + e * c * .42, u + 1, f + n * c * .42), J.rate = 2.2;
133
+ let e = o / c, n = s / c, l = t, d = 0, f = r, p = V == null ? null : L.get(V);
134
+ p && p.state.x === i && p.state.z === a && (e = -e, n = -n, l = i, f = a), d = N.ready ? N.heightAt(l, f) : K.y;
135
+ let m = -n, h = e, g = u(c * .3, 16, 70), _ = c * .3 + 8, v = c * .1;
136
+ J.dPos.set(l - e * g + m * v, d + _, f - n * g + h * v), J.dTarget.set(l + e * c * .42, d + 1, f + n * c * .42), J.rate = 2.2;
136
137
  return;
137
138
  }
138
- let u = -s, f = o, p = Math.hypot(u, f) || 1;
139
- u /= p, f /= p, f < 0 && (u = -u, f = -f);
139
+ let d = -s, f = o, p = Math.hypot(d, f) || 1;
140
+ d /= p, f /= p, f < 0 && (d = -d, f = -f);
140
141
  let m = Y ? .78 : .52, h = Math.atan(Math.tan(l) * A.aspect), g = (c / 2 + 14) / Math.tan(h);
141
- g = Math.max(g, 26 / Math.tan(l)), g = d(g * 1.05, 38, 260), J.dTarget.set(K.x, K.y + 2, K.z), J.dPos.set(K.x + u * Math.cos(m) * g, K.y + Math.sin(m) * g, K.z + f * Math.cos(m) * g), J.rate = 2.2;
142
+ g = Math.max(g, 26 / Math.tan(l)), g = u(g * 1.05, 38, 260), J.dTarget.set(K.x, K.y + 2, K.z), J.dPos.set(K.x + d * Math.cos(m) * g, K.y + Math.sin(m) * g, K.z + f * Math.cos(m) * g), J.rate = 2.2;
142
143
  }
143
144
  function nt(e, t) {
144
- let r = e.state, i = (t ? r.hullYaw : r.yaw) * n, a = Math.cos(i), o = Math.sin(i), s = -o, c = a, l = Y ? 24 : 20, u = Y ? 2 : 4.5;
145
- J.dPos.set(r.x - a * l + s * u, r.y + (Y ? 10 : 8.5), r.z - o * l + c * u);
146
- let f = d(Math.tan(d(r.pitch, 0, 70) * n) * 4, 0, 10);
145
+ let r = e.state, i = (t ? r.hullYaw : r.yaw) * n, a = Math.cos(i), o = Math.sin(i), s = -o, c = a, l = Y ? 24 : 20, d = Y ? 2 : 4.5;
146
+ J.dPos.set(r.x - a * l + s * d, r.y + (Y ? 10 : 8.5), r.z - o * l + c * d);
147
+ let f = u(Math.tan(u(r.pitch, 0, 70) * n) * 4, 0, 10);
147
148
  J.dTarget.set(r.x + a * 40, r.y + 1 + f, r.z + o * 40), J.rate = t ? 3 : 4.5;
148
149
  }
149
150
  function rt() {
@@ -183,7 +184,7 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
183
184
  let n;
184
185
  if (J.snap) J.pos.copy(J.dPos), J.target.copy(J.dTarget), J.snap = !1, n = !0;
185
186
  else {
186
- let t = c(J.rate, e);
187
+ let t = r(J.rate, e);
187
188
  J.pos.lerp(J.dPos, t), J.target.lerp(J.dTarget, t), n = J.pos.distanceToSquared(J.dPos) > .0025 || J.target.distanceToSquared(J.dTarget) > .0025;
188
189
  }
189
190
  if (N.ready) {
@@ -195,19 +196,19 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
195
196
  A.position.x += (Math.random() - .5) * t, A.position.y += (Math.random() - .5) * t, A.position.z += (Math.random() - .5) * t, J.shake *= Math.exp(-6 * e), n = !0;
196
197
  } else J.shake = 0;
197
198
  A.lookAt(J.target);
198
- let r = J.pos.distanceTo(J.target);
199
- return k.fog.near = r * 1.1 + 20, k.fog.far = r * 3.2 + 260, J.moving = n || J.mode === "impact" || J.mode === "killcam" || J.mode === "celebrate" && !!G, J.moving;
199
+ let i = J.pos.distanceTo(J.target);
200
+ return k.fog.near = i * 1.1 + 20, k.fog.far = i * 3.2 + 260, J.moving = n || J.mode === "impact" || J.mode === "killcam" || J.mode === "celebrate" && !!G, J.moving;
200
201
  }
201
202
  function ot(e, t) {
202
203
  return e.color === "red" || e.color === "green" ? e.color : t === 0 ? "green" : "red";
203
204
  }
204
- function st(e, t) {
205
- let n = L.get(e.id);
206
- return n || (n = f(Me, I, {
207
- id: e.id,
208
- color: ot(e, t),
205
+ function st(t, n) {
206
+ let r = L.get(t.id);
207
+ return r || (r = e(Me, I, {
208
+ id: t.id,
209
+ color: ot(t, n),
209
210
  quality: T
210
- }), n.setShadows(T === "high"), j.add(n.root), L.set(e.id, n), Ne.push(e.id), n);
211
+ }), r.setShadows(T === "high"), j.add(r.root), L.set(t.id, r), Ne.push(t.id), r);
211
212
  }
212
213
  function ct(e) {
213
214
  let t = L.get(e);
@@ -254,7 +255,7 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
254
255
  let e = 0, t = 0;
255
256
  for (let n of Ne) {
256
257
  let r = L.get(n);
257
- r.writeWheels(R, e), e += l.length;
258
+ r.writeWheels(R, e), e += o.length;
258
259
  let i = r.state;
259
260
  K.set(i.x, i.y + .08, i.z), $e.set(7.2, 1, 5.2), Qe.compose(K, r.body.quaternion, $e), z.setMatrixAt(t++, Qe);
260
261
  }
@@ -305,126 +306,126 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
305
306
  return n.set(e[o] + (e[o + 3] - e[o]) * a, e[o + 1] + (e[o + 4] - e[o + 1]) * a, e[o + 2] + (e[o + 5] - e[o + 2]) * a);
306
307
  }
307
308
  function* yt(e) {
308
- let t = L.get(e.tankId), r = C ? 2 : 1;
309
- t && (t.state.targetYaw = null, t.state.targetPitch = null), B.visible = !1, F.setPreview(null);
310
- let i = Array.isArray(e.movePath) ? e.movePath.filter((e) => e && Number.isFinite(e.x) && Number.isFinite(e.z)) : [], a = 0, o = [];
311
- for (let e = 1; e < i.length; e++) {
312
- let t = Math.hypot(i[e].x - i[e - 1].x, i[e].z - i[e - 1].z);
313
- o.push(t), a += t;
309
+ let i = L.get(e.tankId), a = C ? 2 : 1;
310
+ i && (i.state.targetYaw = null, i.state.targetPitch = null), B.visible = !1, F.setPreview(null);
311
+ let o = Array.isArray(e.movePath) ? e.movePath.filter((e) => e && Number.isFinite(e.x) && Number.isFinite(e.z)) : [], s = 0, c = [];
312
+ for (let e = 1; e < o.length; e++) {
313
+ let t = Math.hypot(o[e].x - o[e - 1].x, o[e].z - o[e - 1].z);
314
+ c.push(t), s += t;
314
315
  }
315
- if (t && t.state.alive && a > .05) {
316
- let e = t.state;
317
- X("drive", { tankId: t.id }), w({
316
+ if (i && i.state.alive && s > .05) {
317
+ let e = i.state;
318
+ X("drive", { tankId: i.id }), w({
318
319
  type: "engine_start",
319
- tankId: t.id
320
+ tankId: i.id
320
321
  }), yield* gt(C ? .05 : .35), w({
321
322
  type: "move_start",
322
- tankId: t.id
323
+ tankId: i.id
323
324
  });
324
- let s = 5 * r, l = 0, u = 0, d = Math.cos(e.hullYaw * n), f = Math.sin(e.hullYaw * n);
325
- for (; l < a;) {
326
- let r = yield, p = e.x, m = e.z;
327
- l = Math.min(a, l + s * r);
328
- let h = 0, _ = 0;
329
- for (; _ < o.length - 1 && h + o[_] < l;) h += o[_++];
330
- let v = o[_] > 0 ? (l - h) / o[_] : 1, y = i[_], b = i[_ + 1];
325
+ let l = 5 * a, u = 0, d = 0, f = Math.cos(e.hullYaw * n), p = Math.sin(e.hullYaw * n);
326
+ for (; u < s;) {
327
+ let a = yield, m = e.x, h = e.z;
328
+ u = Math.min(s, u + l * a);
329
+ let g = 0, _ = 0;
330
+ for (; _ < c.length - 1 && g + c[_] < u;) g += c[_++];
331
+ let v = c[_] > 0 ? (u - g) / c[_] : 1, y = o[_], b = o[_ + 1];
331
332
  e.x = y.x + (b.x - y.x) * v, e.z = y.z + (b.z - y.z) * v;
332
333
  let ee = Number.isFinite(y.y) ? y.y : N.heightAt(y.x, y.z);
333
334
  e.y = ee + ((Number.isFinite(b.y) ? b.y : N.heightAt(b.x, b.z)) - ee) * v;
334
- let te = e.x - p, ne = e.z - m, re = Math.hypot(te, ne);
335
+ let te = e.x - m, ne = e.z - h, re = Math.hypot(te, ne);
335
336
  if (re > 1e-5) {
336
- let i = (te * d + ne * f) / re;
337
- if (Math.abs(i) < .9) {
338
- let t = Math.atan2(ne, te) / n, a = i >= 0 ? t : t + 180, o = g((a - e.hullYaw) * n) / n * c(6, r);
339
- e.hullYaw += o, e.yaw += o;
337
+ let o = (te * f + ne * p) / re;
338
+ if (Math.abs(o) < .9) {
339
+ let i = Math.atan2(ne, te) / n, s = o >= 0 ? i : i + 180, c = t((s - e.hullYaw) * n) / n * r(6, a);
340
+ e.hullYaw += c, e.yaw += c;
340
341
  }
341
- t.scrollTracks(i >= 0 ? re : -re), u += re;
342
+ i.scrollTracks(o >= 0 ? re : -re), d += re;
342
343
  }
343
- for (t.place(N, r); u > .7;) u -= .7, t.localToWorld(q, -2.6, .2, 1.4), F.dust(q.x, q.y, q.z), t.localToWorld(q, -2.6, .2, -1.4), F.dust(q.x, q.y, q.z), t.localToWorld(q, -3.3, 1.3, .9), F.exhaust(q.x, q.y, q.z);
344
+ for (i.place(N, a); d > .7;) d -= .7, i.localToWorld(q, -2.6, .2, 1.4), F.dust(q.x, q.y, q.z), i.localToWorld(q, -2.6, .2, -1.4), F.dust(q.x, q.y, q.z), i.localToWorld(q, -3.3, 1.3, .9), F.exhaust(q.x, q.y, q.z);
344
345
  We = !0, H = !0;
345
346
  }
346
347
  w({
347
348
  type: "move_end",
348
- tankId: t.id
349
+ tankId: i.id
349
350
  });
350
351
  }
351
- if (t && t.state.alive) {
352
- let i = t.state, a = Number.isFinite(e.yaw) ? e.yaw : i.yaw, o = Number.isFinite(e.pitch) ? e.pitch : i.pitch, s = g((a - i.yaw) * n) / n, c = o - i.pitch;
353
- if ((J.mode !== "drive" && !C || J.mode === "drive") && X("aim", { tankId: t.id }), Math.abs(s) > .5 || Math.abs(c) > .5) {
352
+ if (i && i.state.alive) {
353
+ let r = i.state, o = Number.isFinite(e.yaw) ? e.yaw : r.yaw, s = Number.isFinite(e.pitch) ? e.pitch : r.pitch, c = t((o - r.yaw) * n) / n, l = s - r.pitch;
354
+ if ((J.mode !== "drive" && !C || J.mode === "drive") && X("aim", { tankId: i.id }), Math.abs(c) > .5 || Math.abs(l) > .5) {
354
355
  w({
355
356
  type: "turret_start",
356
- tankId: t.id
357
+ tankId: i.id
357
358
  });
358
- let e = 90 * r, n = Math.max(.25, Math.max(Math.abs(s), Math.abs(c)) / e), a = i.yaw, o = i.pitch, l = 0;
359
- for (; l < n;) {
360
- l += yield;
361
- let e = Math.min(1, l / n), r = e * e * (3 - 2 * e);
362
- i.yaw = a + s * r, i.pitch = o + c * r, t.place(N), H = !0;
359
+ let e = 90 * a, t = Math.max(.25, Math.max(Math.abs(c), Math.abs(l)) / e), n = r.yaw, o = r.pitch, s = 0;
360
+ for (; s < t;) {
361
+ s += yield;
362
+ let e = Math.min(1, s / t), a = e * e * (3 - 2 * e);
363
+ r.yaw = n + c * a, r.pitch = o + l * a, i.place(N), H = !0;
363
364
  }
364
365
  w({
365
366
  type: "turret_end",
366
- tankId: t.id
367
+ tankId: i.id
367
368
  });
368
369
  }
369
- i.yaw = a, i.pitch = o, t.place(N), yield* gt(C ? .05 : .2);
370
+ r.yaw = o, r.pitch = s, i.place(N), yield* gt(C ? .05 : .2);
370
371
  }
371
- let s = Array.isArray(e.shots) ? e.shots.slice(0, 8) : [], l = Array.isArray(e.craters) ? e.craters.map((e) => ({
372
+ let l = Array.isArray(e.shots) ? e.shots.slice(0, 8) : [], u = Array.isArray(e.craters) ? e.craters.map((e) => ({
372
373
  ...e,
373
374
  used: !1
374
- })) : [], u = e.damage || {}, d = /* @__PURE__ */ new Set(), f = s.map((e, t) => {
375
- let n = e && e.samples && e.samples.length >= 3 ? e.samples : null, i = n ? n.length / 3 | 0 : 0;
375
+ })) : [], d = e.damage || {}, f = /* @__PURE__ */ new Set(), p = l.map((e, t) => {
376
+ let n = e && e.samples && e.samples.length >= 3 ? e.samples : null, r = n ? n.length / 3 | 0 : 0;
376
377
  return {
377
378
  shot: e,
378
379
  samples: n,
379
- n: i,
380
- start: (Number.isFinite(e && e.startMs) ? e.startMs / 1e3 : 0) / r,
381
- dur: Math.max(1, i - 1) * _e / r,
380
+ n: r,
381
+ start: (Number.isFinite(e && e.startMs) ? e.startMs / 1e3 : 0) / a,
382
+ dur: Math.max(1, r - 1) * _e / a,
382
383
  role: e && e.role || "main",
383
384
  slot: t,
384
385
  started: !1,
385
386
  done: !n,
386
387
  offset: new x()
387
388
  };
388
- }), p = !1, m = null, h = f.find((e) => e.role === "carrier" && !e.done) || null;
389
- if (f.length) {
390
- let n = 0, i = f.filter((e) => !e.done).length, a = Math.min(...f.map((e) => e.start));
391
- for (; i > 0 && n < 30;) {
392
- !p && t && (p = !0, t.muzzleWorld(q), t.gunDirWorld(Ze), F.muzzle(q, Ze), t.state.recoil = 1, J.shake = .6, w({
389
+ }), m = !1, h = null, g = p.find((e) => e.role === "carrier" && !e.done) || null;
390
+ if (p.length) {
391
+ let t = 0, n = p.filter((e) => !e.done).length, r = Math.min(...p.map((e) => e.start));
392
+ for (; n > 0 && t < 30;) {
393
+ !m && i && (m = !0, i.muzzleWorld(q), i.gunDirWorld(Ze), F.muzzle(q, Ze), i.state.recoil = 1, J.shake = .6, w({
393
394
  type: "fire",
394
- tankId: t.id
395
+ tankId: i.id
395
396
  }));
396
- let o = 0, s = 0, c = 0, g = 0, _ = 0, v = 0, y = 0;
397
- for (let p of f) {
398
- if (p.done) continue;
399
- let f = n - p.start;
400
- if (f < 0 || !p.started && p.role === "bomblet" && h && !h.done) continue;
401
- p.started || (p.started = !0, vt(p.samples, 0, K), t && (p.role === "main" || p.role === "carrier") && p.start <= a + 1e-6 && (t.muzzleWorld(q), p.offset.copy(q).sub(K)), F.projShow(p.slot, K.x + p.offset.x, K.y + p.offset.y, K.z + p.offset.z, (p.shot.radius || 0) >= 7), w({
397
+ let o = 0, s = 0, c = 0, l = 0, _ = 0, v = 0, y = 0;
398
+ for (let m of p) {
399
+ if (m.done) continue;
400
+ let p = t - m.start;
401
+ if (p < 0 || !m.started && m.role === "bomblet" && g && !g.done) continue;
402
+ m.started || (m.started = !0, vt(m.samples, 0, K), i && (m.role === "main" || m.role === "carrier") && m.start <= r + 1e-6 && (i.muzzleWorld(q), m.offset.copy(q).sub(K)), F.projShow(m.slot, K.x + m.offset.x, K.y + m.offset.y, K.z + m.offset.z, (m.shot.radius || 0) >= 7), w({
402
403
  type: "projectile_start",
403
404
  tankId: e.tankId,
404
- role: p.role
405
+ role: m.role
405
406
  }));
406
- let b = f / _e * r;
407
- if (f >= p.dur) {
408
- p.done = !0, i--, F.projHide(p.slot), m = bt(p, l, u, d) || m;
407
+ let b = p / _e * a;
408
+ if (p >= m.dur) {
409
+ m.done = !0, n--, F.projHide(m.slot), h = bt(m, u, d, f) || h;
409
410
  continue;
410
411
  }
411
- vt(p.samples, b, K);
412
+ vt(m.samples, b, K);
412
413
  let ee = Math.max(0, 1 - b / 5);
413
- K.addScaledVector(p.offset, ee), F.projMove(p.slot, K.x, K.y, K.z), vt(p.samples, b + 1, Ze), o += K.x, s += K.y, c += K.z, g += (Ze.x - K.x) / _e, _ += (Ze.y - K.y) / _e, v += (Ze.z - K.z) / _e, y++;
414
+ K.addScaledVector(m.offset, ee), F.projMove(m.slot, K.x, K.y, K.z), vt(m.samples, b + 1, Ze), o += K.x, s += K.y, c += K.z, l += (Ze.x - K.x) / _e, _ += (Ze.y - K.y) / _e, v += (Ze.z - K.z) / _e, y++;
414
415
  }
415
- y > 0 ? (J.focus.set(o / y, s / y, c / y), Math.hypot(g, v) > .1 && J.vel.set(g / y, _ / y, v / y), J.mode !== "follow" && !C && X("follow"), C && J.mode !== "overview" && X("overview", { cut: !0 })) : m && J.mode === "follow" && X("impact", {
416
- focus: m,
416
+ y > 0 ? (J.focus.set(o / y, s / y, c / y), Math.hypot(l, v) > .1 && J.vel.set(l / y, _ / y, v / y), J.mode !== "follow" && !C && X("follow"), C && J.mode !== "overview" && X("overview", { cut: !0 })) : h && J.mode === "follow" && X("impact", {
417
+ focus: h,
417
418
  orbitFromCurrent: !0
418
- }), n += yield;
419
+ }), t += yield;
419
420
  }
420
421
  }
421
- for (let e of l) e.used || (N.crater(e.x, e.z, e.radius || 4, e.depth || 1), P.blast(N, e.x, e.z, e.radius || 4), H = !0);
422
- for (let e of Object.keys(u)) if (u[e] > 0 && !d.has(e)) {
422
+ for (let e of u) e.used || (N.crater(e.x, e.z, e.radius || 4, e.depth || 1), P.blast(N, e.x, e.z, e.radius || 4), H = !0);
423
+ for (let e of Object.keys(d)) if (d[e] > 0 && !f.has(e)) {
423
424
  let t = L.get(e);
424
425
  t && (t.state.hitFlash = 1);
425
426
  }
426
- m ? (!C && J.mode !== "impact" && X("impact", {
427
- focus: m,
427
+ h ? (!C && J.mode !== "impact" && X("impact", {
428
+ focus: h,
428
429
  orbitFromCurrent: !0
429
430
  }), C && X("overview", { cut: !0 }), yield* gt(C ? .5 : 1.3)) : yield* gt(.4);
430
431
  let _ = Array.isArray(e.destroyed) ? e.destroyed : [];
@@ -535,50 +536,50 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
535
536
  if (Z = 0, E || !Ot) return;
536
537
  let e = Nt.getDelta();
537
538
  U = Math.min(e, he);
538
- let t = U * Je;
539
+ let i = U * Je;
539
540
  qe += U;
540
- let r = qe < Ke;
541
+ let o = qe < Ke;
541
542
  if (W) {
542
- r = !0, W.realT += U;
543
+ o = !0, W.realT += U;
543
544
  let e;
544
545
  try {
545
- e = W.gen.next(t);
546
+ e = W.gen.next(i);
546
547
  } catch (t) {
547
548
  typeof console < "u" && console.error(t), e = { done: !0 };
548
549
  }
549
550
  (e.done || W.realT > W.deadline) && St(W), W || xt();
550
551
  }
551
552
  for (let e of Ne) {
552
- let i = L.get(e), a = i.state, o = !1;
553
- if (a.targetYaw != null && !W) {
554
- let e = g((a.targetYaw - a.yaw) * n) / n, t = a.targetPitch - a.pitch;
555
- if (Math.abs(e) > .02 || Math.abs(t) > .02) {
556
- let n = C ? 1 : c(14, U);
557
- a.yaw += e * n, a.pitch += t * n, o = !0, r = !0;
558
- } else Ge && (a.yaw = a.targetYaw, a.pitch = a.targetPitch, o = !0);
553
+ let a = L.get(e), s = a.state, c = !1;
554
+ if (s.targetYaw != null && !W) {
555
+ let e = t((s.targetYaw - s.yaw) * n) / n, i = s.targetPitch - s.pitch;
556
+ if (Math.abs(e) > .02 || Math.abs(i) > .02) {
557
+ let t = C ? 1 : r(14, U);
558
+ s.yaw += e * t, s.pitch += i * t, c = !0, o = !0;
559
+ } else Ge && (s.yaw = s.targetYaw, s.pitch = s.targetPitch, c = !0);
559
560
  }
560
- a.recoil > 0 && (a.recoil = Math.max(0, a.recoil - t * 2.2), o = !0, r = !0), a.hitFlash > 0 && (a.hitFlash = Math.max(0, a.hitFlash - t * 2.5), i.setFlash(a.hitFlash * a.hitFlash * 1.5), r = !0), ft(i, t) && (r = !0), o && (i.place(N), H = !0);
561
- let s = mt(i);
562
- s > 0 && (a.blown && s >= 2 ? K.set(a.x, a.y + 1.4, a.z) : i.localToWorld(K, s >= 2 ? -.5 : -1.8, 1.8, 0), F.emitDamage(K.x, K.y, K.z, t, s, a));
561
+ s.recoil > 0 && (s.recoil = Math.max(0, s.recoil - i * 2.2), c = !0, o = !0), s.hitFlash > 0 && (s.hitFlash = Math.max(0, s.hitFlash - i * 2.5), a.setFlash(s.hitFlash * s.hitFlash * 1.5), o = !0), ft(a, i) && (o = !0), c && (a.place(N), H = !0);
562
+ let l = mt(a);
563
+ l > 0 && (s.blown && l >= 2 ? K.set(s.x, s.y + 1.4, s.z) : a.localToWorld(K, l >= 2 ? -.5 : -1.8, 1.8, 0), F.emitDamage(K.x, K.y, K.z, i, l, s));
563
564
  }
564
565
  if (Ge = !1, G) {
565
566
  let e = G;
566
- if (e.t += U, e.next -= U, r = !0, e.next <= 0 && e.t < 5.5) {
567
+ if (e.t += U, e.next -= U, o = !0, e.next <= 0 && e.t < 5.5) {
567
568
  e.next = .55;
568
569
  let t = e.id == null ? null : L.get(e.id), n = t ? t.state.x : Xe.x, r = t ? t.state.z : Xe.z, i = t ? t.state.y : N.heightAt(n, r), o = t ? t.team.accent : a("#ffd36b");
569
570
  F.firework(n + (Math.random() - .5) * 10, i + 9 + Math.random() * 3, r + (Math.random() - .5) * 10, o);
570
571
  }
571
572
  e.t > 9 && (G = null);
572
573
  }
573
- We && pt(), F.update(t, A, D, r || !!W) && (r = !0), at(U) && (r = !0), F.hasPreview && J.mode === "aim" && (r = r || qe < Ke), H && T === "high" && (D.shadowMap.needsUpdate = !0), H = !1, D.render(k, A);
574
- let i = D.info.render;
574
+ We && pt(), F.update(i, A, D, o || !!W) && (o = !0), at(U) && (o = !0), F.hasPreview && J.mode === "aim" && (o = o || qe < Ke), H && T === "high" && (D.shadowMap.needsUpdate = !0), H = !1, D.render(k, A);
575
+ let s = D.info.render;
575
576
  It = {
576
- calls: i.calls,
577
- triangles: i.triangles,
577
+ calls: s.calls,
578
+ triangles: s.triangles,
578
579
  particles: F.particleCount,
579
580
  quality: T,
580
581
  fps: e > 0 ? Math.round(1 / e) : 0
581
- }, Te && r && T !== "low" && qe > 2 && (Pt += Math.min(e, .25), Ft++, Ft >= 90 && (Pt / Ft > 1 / 38 && Vt(T === "high" ? "medium" : "low"), Pt = 0, Ft = 0)), r ? Lt() : zt() ? Q = setTimeout(() => {
582
+ }, Te && o && T !== "low" && qe > 2 && (Pt += Math.min(e, .25), Ft++, Ft >= 90 && (Pt / Ft > 1 / 38 && Vt(T === "high" ? "medium" : "low"), Pt = 0, Ft = 0)), o ? Lt() : zt() ? Q = setTimeout(() => {
582
583
  Q = 0, Lt();
583
584
  }, 40) : Nt.stop();
584
585
  }
@@ -682,4 +683,4 @@ function Ce(S, { quality: Ce = "auto", reducedMotion: C = !1, onEvent: we } = {}
682
683
  }
683
684
  export { Ce as createTankScene, Ce as default };
684
685
 
685
- //# sourceMappingURL=createTankScene-CV7Brxmt.js.map
686
+ //# sourceMappingURL=createTankScene-6asWHKFf.js.map