gaesup-world 1.0.13 → 1.0.14

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,5 +1,5 @@
1
- import { jsx as H, Fragment as qt, jsxs as _e } from "react/jsx-runtime";
2
- import { useRef as T, useEffect as W, useCallback as R, createContext as Jt, useContext as pt, useSyncExternalStore as qe, useMemo as L, useState as Yt, forwardRef as mt, useImperativeHandle as Xt, createElement as Qt } from "react";
1
+ import { jsx as j, Fragment as qt, jsxs as _e } from "react/jsx-runtime";
2
+ import { useRef as T, useEffect as W, useCallback as R, createContext as Jt, useContext as mt, useSyncExternalStore as qe, useMemo as L, useState as Yt, forwardRef as pt, useImperativeHandle as Xt, createElement as Qt } from "react";
3
3
  import { useGLTF as Pe, useAnimations as en } from "@react-three/drei";
4
4
  import { useFrame as tn, useGraph as yt } from "@react-three/fiber";
5
5
  import { RigidBody as nn, euler as rn, CapsuleCollider as on } from "@react-three/rapier";
@@ -11,7 +11,7 @@ import { I as dn } from "./EventBus-Ck0Dwee2.js";
11
11
  import { enableMapSet as hn } from "immer";
12
12
  import { create as fn } from "zustand";
13
13
  import { immer as gn } from "zustand/middleware/immer";
14
- class pn {
14
+ class mn {
15
15
  engines;
16
16
  snapshots;
17
17
  eventListeners;
@@ -98,7 +98,7 @@ class pn {
98
98
  this.engines.forEach((n) => n.dispose()), this.engines.clear(), this.snapshots.clear(), this.eventListeners.clear(), this.eventHandlers.clear(), this.middlewares = [];
99
99
  }
100
100
  }
101
- class Ct extends pn {
101
+ class Ct extends mn {
102
102
  constructor() {
103
103
  super(), this.processMetrics(), this.processEventLog();
104
104
  }
@@ -111,7 +111,7 @@ class Ct extends pn {
111
111
  Reflect.getMetadata("enableEventLog", n);
112
112
  }
113
113
  }
114
- function mn() {
114
+ function pn() {
115
115
  return function(...t) {
116
116
  if (t.length === 1) {
117
117
  const r = t[0];
@@ -747,16 +747,16 @@ class ce {
747
747
  const { activeState: i } = n, s = this.getKeyboard(o), { forward: a, backward: c, leftward: l, rightward: h, shift: u, space: d } = s, {
748
748
  angleDelta: f = { x: 0.02, y: 0.02, z: 0.02 },
749
749
  maxAngle: g = { x: Math.PI / 6, y: Math.PI, z: Math.PI / 6 },
750
- accelRatio: m = 1.5
750
+ accelRatio: p = 1.5
751
751
  } = this.config || {};
752
752
  if (!e?.current) return;
753
- let p = 1;
754
- u && (p *= m), d && (p *= 1.5);
753
+ let m = 1;
754
+ u && (m *= p), d && (m *= 1.5);
755
755
  const S = Number(c) - Number(a), v = Number(l) - Number(h);
756
756
  r === "chase" ? i.euler.y += v * f.y * 0.5 : i.euler.y += v * f.y, this.applyAirplaneRotation(e.current, S, v, g, i), i.direction.set(
757
- Math.sin(i.euler.y) * p,
758
- -S * p,
759
- Math.cos(i.euler.y) * p
757
+ Math.sin(i.euler.y) * m,
758
+ -S * m,
759
+ Math.cos(i.euler.y) * m
760
760
  ), i.dir.copy(i.direction).normalize(), this.emitRotationUpdate(i, "airplane");
761
761
  }
762
762
  getKeyboard(n) {
@@ -1021,8 +1021,8 @@ class J {
1021
1021
  if (!this.isGridCell(f, d)) continue;
1022
1022
  const g = this.cellIndex(f, d);
1023
1023
  if (this.grid[g] !== 0) continue;
1024
- const m = this.getCellBounds(f, d), p = a > m.minX + oe && s < m.maxX - oe, S = l > m.minZ + oe && c < m.maxZ - oe;
1025
- if (p && S) return !0;
1024
+ const p = this.getCellBounds(f, d), m = a > p.minX + oe && s < p.maxX - oe, S = l > p.minZ + oe && c < p.maxZ - oe;
1025
+ if (m && S) return !0;
1026
1026
  }
1027
1027
  return !1;
1028
1028
  }
@@ -1060,9 +1060,9 @@ class J {
1060
1060
  }
1061
1061
  setRegion(n, e, r, o, i) {
1062
1062
  const { cellSize: s, worldMinX: a, worldMinZ: c } = this.config, l = r / 2, h = o / 2, u = Math.floor((n - l - a) / s), d = Math.floor((e - h - c) / s), f = Math.ceil((n + l - a) / s), g = Math.ceil((e + h - c) / s);
1063
- for (let m = d; m < g; m++)
1064
- for (let p = u; p < f; p++)
1065
- this.setCell(p, m, i);
1063
+ for (let p = d; p < g; p++)
1064
+ for (let m = u; m < f; m++)
1065
+ this.setCell(m, p, i);
1066
1066
  }
1067
1067
  setCost(n, e, r) {
1068
1068
  const [o, i] = this.worldToGrid(n, e), s = this.cellIndex(o, i), a = Math.max(0, Math.min(255, Math.round(r)));
@@ -1077,11 +1077,11 @@ class J {
1077
1077
  }
1078
1078
  setHeightSampler(n, e, r, o, i) {
1079
1079
  const { cellSize: s, worldMinX: a, worldMinZ: c } = this.config, l = r / 2, h = o / 2, u = Math.floor((n - l - a) / s), d = Math.floor((e - h - c) / s), f = Math.ceil((n + l - a) / s), g = Math.ceil((e + h - c) / s);
1080
- for (let m = d; m < g; m++)
1081
- for (let p = u; p < f; p++) {
1082
- if (!this.isGridCell(p, m)) continue;
1083
- const [S, , v] = this.gridToWorld(p, m, 0), z = i(S, v);
1084
- this.heightGrid[this.cellIndex(p, m)] = z, z !== 0 && (this.hasHeightData = !0);
1080
+ for (let p = d; p < g; p++)
1081
+ for (let m = u; m < f; m++) {
1082
+ if (!this.isGridCell(m, p)) continue;
1083
+ const [S, , v] = this.gridToWorld(m, p, 0), z = i(S, v);
1084
+ this.heightGrid[this.cellIndex(m, p)] = z, z !== 0 && (this.hasHeightData = !0);
1085
1085
  }
1086
1086
  }
1087
1087
  sampleHeight(n, e) {
@@ -1100,8 +1100,8 @@ class J {
1100
1100
  const a = typeof i == "object" && i !== null ? i : {
1101
1101
  ...i !== void 0 ? { y: i } : {},
1102
1102
  weighted: s
1103
- }, c = this.resolveAgentFootprint(a), l = a.y, h = a.weighted ?? s, [u, d] = this.worldToGrid(n, e), [f, g] = this.worldToGrid(r, o), m = this.createTraversalGrid(c), p = h ? this.createTraversalCostGrid(m) : this.costGrid;
1104
- return this.wasm && !this.hasHeightData ? this.findPathWasm(u, d, f, g, l, h, m, p) : this.findPathJS(u, d, f, g, l, h, m, p);
1103
+ }, c = this.resolveAgentFootprint(a), l = a.y, h = a.weighted ?? s, [u, d] = this.worldToGrid(n, e), [f, g] = this.worldToGrid(r, o), p = this.createTraversalGrid(c), m = h ? this.createTraversalCostGrid(p) : this.costGrid;
1104
+ return this.wasm && !this.hasHeightData ? this.findPathWasm(u, d, f, g, l, h, p, m) : this.findPathJS(u, d, f, g, l, h, p, m);
1105
1105
  }
1106
1106
  findPathWasm(n, e, r, o, i, s, a, c) {
1107
1107
  const l = this.wasm;
@@ -1122,8 +1122,8 @@ class J {
1122
1122
  if (u === 0) return [];
1123
1123
  const d = new Uint32Array(l.memory.buffer, this.outPathPtr, u * 2), f = [];
1124
1124
  for (let g = 0; g < u; g++) {
1125
- const m = d[g * 2], p = d[g * 2 + 1];
1126
- m === void 0 || p === void 0 || f.push(this.gridToWorld(m, p, i));
1125
+ const p = d[g * 2], m = d[g * 2 + 1];
1126
+ p === void 0 || m === void 0 || f.push(this.gridToWorld(p, m, i));
1127
1127
  }
1128
1128
  return f;
1129
1129
  }
@@ -1131,8 +1131,8 @@ class J {
1131
1131
  const l = this.gridWidth, h = this.gridHeight, u = a, d = l * h, f = this.cellIndex(n, e), g = this.cellIndex(r, o);
1132
1132
  if (u[f] === 0 || u[g] === 0) return [];
1133
1133
  if (f === g) return [this.gridToWorld(r, o, i)];
1134
- const m = new Uint32Array(d).fill(4294967295), p = new Uint32Array(d).fill(4294967295), S = new Uint8Array(d);
1135
- m[f] = 0;
1134
+ const p = new Uint32Array(d).fill(4294967295), m = new Uint32Array(d).fill(4294967295), S = new Uint8Array(d);
1135
+ p[f] = 0;
1136
1136
  const v = [
1137
1137
  { f: this.octileH(n, e, r, o), idx: f }
1138
1138
  ];
@@ -1149,7 +1149,7 @@ class J {
1149
1149
  if (y === g) break;
1150
1150
  if (S[y]) continue;
1151
1151
  S[y] = 1;
1152
- const I = y % l, G = y / l | 0, x = m[y];
1152
+ const I = y % l, G = y / l | 0, x = p[y];
1153
1153
  if (x !== void 0)
1154
1154
  for (const [M, Y, O] of Vn) {
1155
1155
  const V = I + M, Z = G + Y;
@@ -1157,16 +1157,16 @@ class J {
1157
1157
  const F = this.cellIndex(V, Z);
1158
1158
  if (S[F] || u[F] === 0 || !this.canStepBetween(y, F) || M !== 0 && Y !== 0 && (u[G * l + V] === 0 || u[Z * l + I] === 0 || !this.canStepBetween(y, this.cellIndex(V, G)) || !this.canStepBetween(y, this.cellIndex(I, Z))))
1159
1159
  continue;
1160
- const Zt = s ? Math.max(1, c[F] ?? 1) : 1, xe = x + O * Zt, Ze = m[F];
1161
- Ze !== void 0 && xe < Ze && (m[F] = xe, p[F] = y, v.push({ f: xe + this.octileH(V, Z, r, o), idx: F }));
1160
+ const Zt = s ? Math.max(1, c[F] ?? 1) : 1, xe = x + O * Zt, Ze = p[F];
1161
+ Ze !== void 0 && xe < Ze && (p[F] = xe, m[F] = y, v.push({ f: xe + this.octileH(V, Z, r, o), idx: F }));
1162
1162
  }
1163
1163
  }
1164
- if (m[g] === 4294967295) return [];
1164
+ if (p[g] === 4294967295) return [];
1165
1165
  const z = [];
1166
1166
  let D = g;
1167
1167
  for (; D !== f; ) {
1168
1168
  z.push(this.gridToWorld(D % l, D / l | 0, i));
1169
- const A = p[D];
1169
+ const A = m[D];
1170
1170
  if (A === void 0) return [];
1171
1171
  if (D = A, D === 4294967295) return [];
1172
1172
  }
@@ -1186,12 +1186,12 @@ class J {
1186
1186
  const s = r - n, a = o - e, c = Math.sqrt(s * s + a * a), l = Math.max(1, Math.ceil(c / (this.config.cellSize * 0.5))), h = this.resolveAgentFootprint(i);
1187
1187
  let u = -1, d = -1;
1188
1188
  for (let f = 0; f <= l; f++) {
1189
- const g = f / l, [m, p] = this.worldToGrid(n + s * g, e + a * g);
1190
- if (m === u && p === d) continue;
1191
- const S = this.cellIndex(m, p);
1192
- if (!(i.ignoreStart && f === 0) && !this.canOccupyCell(m, p, h) || u !== -1 && d !== -1 && !this.canStepBetween(this.cellIndex(u, d), S))
1189
+ const g = f / l, [p, m] = this.worldToGrid(n + s * g, e + a * g);
1190
+ if (p === u && m === d) continue;
1191
+ const S = this.cellIndex(p, m);
1192
+ if (!(i.ignoreStart && f === 0) && !this.canOccupyCell(p, m, h) || u !== -1 && d !== -1 && !this.canStepBetween(this.cellIndex(u, d), S))
1193
1193
  return !1;
1194
- u = m, d = p;
1194
+ u = p, d = m;
1195
1195
  }
1196
1196
  return !0;
1197
1197
  }
@@ -1366,13 +1366,13 @@ class He {
1366
1366
  });
1367
1367
  }
1368
1368
  if (o) {
1369
- const d = i ? h : l, f = c.dir, g = c.velocity, m = n.current.mass(), p = -f.x * d, S = -f.z * d;
1370
- if (!this.canMoveForward(n.current, p, S, r)) {
1369
+ const d = i ? h : l, f = c.dir, g = c.velocity, p = n.current.mass(), m = -f.x * d, S = -f.z * d;
1370
+ if (!this.canMoveForward(n.current, m, S, r)) {
1371
1371
  this.scratchLinvel.x = 0, this.scratchLinvel.y = n.current.linvel().y, this.scratchLinvel.z = 0, n.current.setLinvel(this.scratchLinvel, !0);
1372
1372
  return;
1373
1373
  }
1374
- const v = p - g.x, z = S - g.z;
1375
- this.scratchImpulse.x = v * m, this.scratchImpulse.y = 0, this.scratchImpulse.z = z * m, n.current.applyImpulse(this.scratchImpulse, !0);
1374
+ const v = m - g.x, z = S - g.z;
1375
+ this.scratchImpulse.x = v * p, this.scratchImpulse.y = 0, this.scratchImpulse.z = z * p, n.current.applyImpulse(this.scratchImpulse, !0);
1376
1376
  }
1377
1377
  }
1378
1378
  canMoveForward(n, e, r, o) {
@@ -1507,8 +1507,8 @@ let _ = class extends wt {
1507
1507
  }
1508
1508
  const i = e.current.linvel(), s = e.current.translation(), a = Math.abs(i.y), c = Math.abs(s.y - this.lastPositionY), l = i.y > 0.02, h = s.y <= nt, u = this.lastGroundedY !== null && Math.abs(s.y - this.lastGroundedY) <= nt, d = h || u, f = r.isJumping || n.keyboard.space, g = u && !f && a < ir && c < sr;
1509
1509
  !l && d && a < rt && c < rr ? this.groundStableCount = Math.min(this.groundStableCount + 1, 5) : this.groundStableCount = 0, this.lastPositionY = s.y;
1510
- const p = d && !l && a < rt || g || this.groundStableCount >= or, S = !p && i.y < ar;
1511
- p && (this.lastGroundedY = s.y, this.resetJumpState(n)), r.isOnTheGround = p, r.isFalling = S, this.copyVector3(o.position, s), this.copyVector3(o.velocity, i);
1510
+ const m = d && !l && a < rt || g || this.groundStableCount >= or, S = !m && i.y < ar;
1511
+ m && (this.lastGroundedY = s.y, this.resetJumpState(n)), r.isOnTheGround = m, r.isFalling = S, this.copyVector3(o.position, s), this.copyVector3(o.velocity, i);
1512
1512
  }
1513
1513
  checkMoving(t) {
1514
1514
  const n = t.gameStates, e = t.keyboard, r = t.mouse, { shift: o, space: i, forward: s, backward: a, leftward: c, rightward: l } = e, h = s || a || c || l, u = h || r.isActive, d = h && o && !r.isLookAround || r.isActive && r.shouldRun;
@@ -1709,7 +1709,7 @@ Ue([
1709
1709
  ], ne.prototype, "createSnapshot", 1);
1710
1710
  ne = Ue([
1711
1711
  xt("physics"),
1712
- mn()
1712
+ pn()
1713
1713
  ], ne);
1714
1714
  const $e = Jt({
1715
1715
  runtime: null,
@@ -1720,13 +1720,13 @@ function To({
1720
1720
  revision: n = 0,
1721
1721
  children: e
1722
1722
  }) {
1723
- return /* @__PURE__ */ H($e.Provider, { value: { runtime: t, revision: n }, children: e });
1723
+ return /* @__PURE__ */ j($e.Provider, { value: { runtime: t, revision: n }, children: e });
1724
1724
  }
1725
1725
  function Gt() {
1726
- return pt($e).runtime;
1726
+ return mt($e).runtime;
1727
1727
  }
1728
1728
  function Rt() {
1729
- return pt($e).revision;
1729
+ return mt($e).revision;
1730
1730
  }
1731
1731
  let Ge = null;
1732
1732
  const Ne = /* @__PURE__ */ new Set();
@@ -1735,7 +1735,7 @@ function zt() {
1735
1735
  }
1736
1736
  const ot = (t) => (Ne.add(t), () => {
1737
1737
  Ne.delete(t);
1738
- }), pe = () => {
1738
+ }), me = () => {
1739
1739
  Ne.forEach((t) => t());
1740
1740
  };
1741
1741
  function kt() {
@@ -1750,13 +1750,13 @@ function kt() {
1750
1750
  () => t.current.getGameStates(),
1751
1751
  () => t.current.getGameStates()
1752
1752
  ), r = R((a) => {
1753
- t.current?.updateActiveState(a), pe();
1753
+ t.current?.updateActiveState(a), me();
1754
1754
  }, []), o = R((a) => {
1755
- t.current?.updateGameStates(a), pe();
1755
+ t.current?.updateGameStates(a), me();
1756
1756
  }, []), i = R(() => {
1757
- t.current?.resetActiveState(), pe();
1757
+ t.current?.resetActiveState(), me();
1758
1758
  }, []), s = R(() => {
1759
- t.current?.resetGameStates(), pe();
1759
+ t.current?.resetGameStates(), me();
1760
1760
  }, []);
1761
1761
  return W(() => () => {
1762
1762
  t.current = null;
@@ -1889,11 +1889,11 @@ function gr(t, n, e, r) {
1889
1889
  o.current && r && i.current && i.current.execute(t, c);
1890
1890
  }, getMotionSnapshot: () => o.current && r && i.current ? i.current.snapshot(t) : null };
1891
1891
  }
1892
- const pr = (t, n) => {
1892
+ const mr = (t, n) => {
1893
1893
  ["forward", "backward", "leftward", "rightward", "shift", "space", "keyE", "keyR"].forEach((r) => {
1894
1894
  t.keyboard[r] !== n.keyboard[r] && (t.keyboard[r] = n.keyboard[r]);
1895
1895
  }), t.mouse.target.equals(n.mouse.target) || t.mouse.target.copy(n.mouse.target), t.mouse.angle !== n.mouse.angle && (t.mouse.angle = n.mouse.angle), t.mouse.isActive !== n.mouse.isActive && (t.mouse.isActive = n.mouse.isActive), t.mouse.shouldRun !== n.mouse.shouldRun && (t.mouse.shouldRun = n.mouse.shouldRun);
1896
- }, mr = "gaesup.motions", _t = "physics.bridge", Dt = Mt, Wt = "motions.runtime", Nt = "motions:teleport";
1896
+ }, pr = "gaesup.motions", _t = "physics.bridge", Dt = Mt, Wt = "motions.runtime", Nt = "motions:teleport";
1897
1897
  function yr(t, n = {}) {
1898
1898
  const e = n.physicsExtensionId ?? _t, r = n.inputExtensionId ?? Dt, o = t.systems.require(e), i = t.input.require(r);
1899
1899
  return {
@@ -1910,7 +1910,7 @@ function Do(t, n) {
1910
1910
  t.events.emit(Nt, n);
1911
1911
  }
1912
1912
  function br(t = {}) {
1913
- const n = t.id ?? mr, e = t.physicsExtensionId ?? _t, r = t.inputExtensionId ?? Dt, o = t.runtimeServiceId ?? Wt, i = t.createPhysicsBridge ?? (() => new ne()), s = t.createInputAdapter ?? le;
1913
+ const n = t.id ?? pr, e = t.physicsExtensionId ?? _t, r = t.inputExtensionId ?? Dt, o = t.runtimeServiceId ?? Wt, i = t.createPhysicsBridge ?? (() => new ne()), s = t.createInputAdapter ?? le;
1914
1914
  return {
1915
1915
  id: n,
1916
1916
  name: "GaeSup Motions",
@@ -1998,13 +1998,13 @@ function Ir() {
1998
1998
  return at ??= Cr(), at;
1999
1999
  }
2000
2000
  function xr(t) {
2001
- const { enabled: n = !0, allowLegacyFallback: e = !0 } = t, r = Gt(), o = Rt(), i = L(() => t.motionsRuntime || !r ? null : r.getService(Wt)?.create() ?? null, [r, o, t.motionsRuntime]), s = L(() => t.motionsRuntime || i || !e ? null : Ir(), [e, i, t.motionsRuntime]), a = t.motionsRuntime ?? i ?? s, c = T(null), l = T(new w.Vector3()), h = T(null), u = T(null), d = T(!1), f = B((y) => y.physics), g = T(f), m = T(null);
2002
- m.current ??= le();
2003
- const p = a?.inputAdapter ?? m.current, S = T(p);
2004
- S.current = p;
2001
+ const { enabled: n = !0, allowLegacyFallback: e = !0 } = t, r = Gt(), o = Rt(), i = L(() => t.motionsRuntime || !r ? null : r.getService(Wt)?.create() ?? null, [r, o, t.motionsRuntime]), s = L(() => t.motionsRuntime || i || !e ? null : Ir(), [e, i, t.motionsRuntime]), a = t.motionsRuntime ?? i ?? s, c = T(null), l = T(new w.Vector3()), h = T(null), u = T(null), d = T(!1), f = B((y) => y.physics), g = T(f), p = T(null);
2002
+ p.current ??= le();
2003
+ const m = a?.inputAdapter ?? p.current, S = T(m);
2004
+ S.current = m;
2005
2005
  const v = n && !!a, z = T({
2006
- keyboard: p.getKeyboard(),
2007
- mouse: p.getMouse()
2006
+ keyboard: m.getKeyboard(),
2007
+ mouse: m.getMouse()
2008
2008
  }), D = T(null), A = T((y) => {
2009
2009
  S.current.updateKeyboard(y);
2010
2010
  }), K = T((y) => {
@@ -2053,10 +2053,10 @@ function xr(t) {
2053
2053
  const b = R((y, I) => {
2054
2054
  if (!n || !u.current || !h.current) return;
2055
2055
  const G = z.current;
2056
- G.keyboard = p.getKeyboard(), G.mouse = p.getMouse();
2056
+ G.keyboard = m.getKeyboard(), G.mouse = m.getMouse();
2057
2057
  let x = c.current;
2058
2058
  if (x)
2059
- pr(x, G), x.activeState = h.current.getActiveState(), x.gameStates = h.current.getGameStates(), x.delta = I;
2059
+ mr(x, G), x.activeState = h.current.getActiveState(), x.gameStates = h.current.getGameStates(), x.delta = I;
2060
2060
  else {
2061
2061
  const Y = B.getState();
2062
2062
  if (x = wr(
@@ -2095,7 +2095,7 @@ function xr(t) {
2095
2095
  calcProp: M,
2096
2096
  physicsState: x
2097
2097
  });
2098
- }, [n, p, t]);
2098
+ }, [n, m, t]);
2099
2099
  return tn((y, I) => {
2100
2100
  v && b(y, I);
2101
2101
  }), {
@@ -2225,12 +2225,12 @@ function Rr(t) {
2225
2225
  n || `entity-${Date.now()}-${Math.random()}`
2226
2226
  ).current, u = B((v) => v.mode), d = u?.type ?? "character", f = r === !0;
2227
2227
  fr(o, d, f), Pt(f && d === "character");
2228
- const { executeMotionCommand: g, getMotionSnapshot: m } = gr(
2228
+ const { executeMotionCommand: g, getMotionSnapshot: p } = gr(
2229
2229
  h,
2230
2230
  e,
2231
2231
  d,
2232
2232
  f
2233
- ), p = {
2233
+ ), m = {
2234
2234
  rigidBodyRef: e,
2235
2235
  enabled: f,
2236
2236
  ...i ? { outerGroupRef: i } : {},
@@ -2239,11 +2239,11 @@ function Rr(t) {
2239
2239
  ...c ? { groundRay: c } : {},
2240
2240
  ...l ? { colliderSize: l } : {}
2241
2241
  };
2242
- xr(p);
2242
+ xr(m);
2243
2243
  const S = Ar(t);
2244
2244
  return Gr(t), {
2245
2245
  executeMotionCommand: g,
2246
- getMotionSnapshot: m,
2246
+ getMotionSnapshot: p,
2247
2247
  mode: u,
2248
2248
  ...S
2249
2249
  };
@@ -2277,7 +2277,7 @@ function Ft({ nodes: t, color: n, skeleton: e, url: r, excludeNodeNames: o }) {
2277
2277
  return W(() => () => {
2278
2278
  for (const a of s)
2279
2279
  a.dispose();
2280
- }, [s]), /* @__PURE__ */ H(qt, { children: i.map((a) => a ? a.type === "skinnedMesh" ? /* @__PURE__ */ H(
2280
+ }, [s]), /* @__PURE__ */ j(qt, { children: i.map((a) => a ? a.type === "skinnedMesh" ? /* @__PURE__ */ j(
2281
2281
  "skinnedMesh",
2282
2282
  {
2283
2283
  castShadow: !0,
@@ -2289,7 +2289,7 @@ function Ft({ nodes: t, color: n, skeleton: e, url: r, excludeNodeNames: o }) {
2289
2289
  dispose: null
2290
2290
  },
2291
2291
  a.key
2292
- ) : /* @__PURE__ */ H(
2292
+ ) : /* @__PURE__ */ j(
2293
2293
  "mesh",
2294
2294
  {
2295
2295
  castShadow: !0,
@@ -2303,7 +2303,7 @@ function Ft({ nodes: t, color: n, skeleton: e, url: r, excludeNodeNames: o }) {
2303
2303
  }
2304
2304
  function zr({ url: t, isActive: n, color: e, skeleton: r }) {
2305
2305
  const { scene: o } = Pe(t), i = L(() => bt.clone(o), [o]), { nodes: s } = yt(i);
2306
- return Pt(n), /* @__PURE__ */ H("group", { children: /* @__PURE__ */ H(
2306
+ return Pt(n), /* @__PURE__ */ j("group", { children: /* @__PURE__ */ j(
2307
2307
  Ft,
2308
2308
  {
2309
2309
  nodes: s,
@@ -2313,11 +2313,20 @@ function zr({ url: t, isActive: n, color: e, skeleton: r }) {
2313
2313
  }
2314
2314
  ) });
2315
2315
  }
2316
- const Lt = mt((t, n) => {
2317
- const e = typeof t.modelYawOffset == "number" ? t.modelYawOffset : t.componentType === "character" ? Math.PI : 0, r = t.baseColor ?? t.parts?.[0]?.color;
2318
- return /* @__PURE__ */ H("group", { receiveShadow: !0, castShadow: !0, ref: n, userData: { intangible: !0 }, children: /* @__PURE__ */ _e("group", { "rotation-y": e, children: [
2316
+ const Lt = pt((t, n) => {
2317
+ const e = typeof t.modelYawOffset == "number" ? t.modelYawOffset : t.componentType === "character" ? Math.PI : 0, r = t.baseColor ?? t.parts?.[0]?.color, o = t.animatedObject;
2318
+ return /* @__PURE__ */ j("group", { receiveShadow: !0, castShadow: !0, ref: n, userData: { intangible: !0 }, children: /* @__PURE__ */ _e("group", { "rotation-y": e, children: [
2319
2319
  t.children,
2320
- t.objectNode && t.animationRef && /* @__PURE__ */ H(
2320
+ o && t.animationRef && /* @__PURE__ */ j(
2321
+ "primitive",
2322
+ {
2323
+ object: o,
2324
+ receiveShadow: !0,
2325
+ castShadow: !0,
2326
+ ref: t.animationRef
2327
+ }
2328
+ ),
2329
+ !o && t.objectNode && t.animationRef && /* @__PURE__ */ j(
2321
2330
  "primitive",
2322
2331
  {
2323
2332
  object: t.objectNode,
@@ -2327,7 +2336,7 @@ const Lt = mt((t, n) => {
2327
2336
  ref: t.animationRef
2328
2337
  }
2329
2338
  ),
2330
- /* @__PURE__ */ H(
2339
+ !o && /* @__PURE__ */ j(
2331
2340
  Ft,
2332
2341
  {
2333
2342
  nodes: t.nodes,
@@ -2476,7 +2485,7 @@ function Lr(t, n) {
2476
2485
  const e = Object.keys(t), r = n.toLowerCase();
2477
2486
  return e.find((o) => o.toLowerCase() === r) ?? e.find((o) => o.toLowerCase().includes(r)) ?? (e.length === 1 ? e[0] : void 0);
2478
2487
  }
2479
- const Br = mt(
2488
+ const Br = pt(
2480
2489
  (t, n) => {
2481
2490
  const e = T(null);
2482
2491
  Xt(n, () => e.current);
@@ -2507,7 +2516,7 @@ const Br = mt(
2507
2516
  return f.traverse((y) => {
2508
2517
  y instanceof w.SkinnedMesh && (b = y.skeleton);
2509
2518
  }), b;
2510
- }, [f]), m = L(() => !t.parts || t.parts.length === 0 ? null : t.parts.map(({ url: b, color: y }, I) => b ? /* @__PURE__ */ Qt(
2519
+ }, [f]), p = L(() => !t.parts || t.parts.length === 0 ? null : t.parts.map(({ url: b, color: y }, I) => b ? /* @__PURE__ */ Qt(
2511
2520
  zr,
2512
2521
  {
2513
2522
  url: b,
@@ -2518,7 +2527,7 @@ const Br = mt(
2518
2527
  key: `${t.componentType}-${b}-${y || "default"}-${I}`,
2519
2528
  ...g ? { skeleton: g } : {}
2520
2529
  }
2521
- ) : null).filter(Boolean), [t.parts, t.componentType, t.currentAnimation, g]), { nodes: p } = yt(f), S = Object.values(p).find((b) => b.type === "Object3D"), v = t.rotation instanceof w.Euler ? t.rotation.y : 0, z = t.outerGroupRef ? { ref: t.outerGroupRef } : {}, D = t.innerGroupRef ? { ref: t.innerGroupRef } : {}, A = t.isActive ? { canSleep: !1, ccd: !0 } : { canSleep: !0, ccd: !1 }, K = L(() => {
2530
+ ) : null).filter(Boolean), [t.parts, t.componentType, t.currentAnimation, g]), { nodes: m } = yt(f), S = Object.values(m).find((b) => b.type === "Object3D"), v = t.rotation instanceof w.Euler ? t.rotation.y : 0, z = t.outerGroupRef ? { ref: t.outerGroupRef } : {}, D = t.innerGroupRef ? { ref: t.innerGroupRef } : {}, A = t.isActive ? { canSleep: !1, ccd: !0 } : { canSleep: !0, ccd: !1 }, K = L(() => {
2522
2531
  if (t.colliderSize) {
2523
2532
  const x = Math.max(0.05, t.colliderSize.radius), M = Math.max(0.05, t.colliderSize.height * 0.5 - x);
2524
2533
  return {
@@ -2540,7 +2549,7 @@ const Br = mt(
2540
2549
  if (!b || l.current === b) return;
2541
2550
  const y = l.current ? a[l.current] : void 0, I = a[b];
2542
2551
  y?.fadeOut(0.2), I?.reset().fadeIn(0.2).play(), l.current = b;
2543
- }, [a, t.currentAnimation]), /* @__PURE__ */ H("group", { ...z, userData: { intangible: !0 }, children: /* @__PURE__ */ _e(
2552
+ }, [a, t.currentAnimation]), /* @__PURE__ */ j("group", { ...z, userData: { intangible: !0 }, children: /* @__PURE__ */ _e(
2544
2553
  nn,
2545
2554
  {
2546
2555
  ...A,
@@ -2557,7 +2566,7 @@ const Br = mt(
2557
2566
  onCollisionEnter: d,
2558
2567
  ...t.rigidBodyProps,
2559
2568
  children: [
2560
- !t.isNotColliding && /* @__PURE__ */ H(
2569
+ !t.isNotColliding && /* @__PURE__ */ j(
2561
2570
  on,
2562
2571
  {
2563
2572
  ref: t.colliderRef,
@@ -2569,8 +2578,9 @@ const Br = mt(
2569
2578
  Lt,
2570
2579
  {
2571
2580
  animationRef: c,
2572
- nodes: p,
2581
+ nodes: m,
2573
2582
  ...D,
2583
+ ...s.length > 0 ? { animatedObject: f } : {},
2574
2584
  isActive: t.isActive,
2575
2585
  componentType: t.componentType,
2576
2586
  ...S ? { objectNode: S } : {},
@@ -2584,7 +2594,7 @@ const Br = mt(
2584
2594
  ...t.parts ? { parts: t.parts } : {},
2585
2595
  children: [
2586
2596
  t.children,
2587
- m
2597
+ p
2588
2598
  ]
2589
2599
  }
2590
2600
  )
@@ -2834,7 +2844,7 @@ const E = Object.freeze({
2834
2844
  GRID_DIVISIONS: 25,
2835
2845
  // 100m / 4m = 25 divisions
2836
2846
  DEFAULT_GRID_SIZE: 100
2837
- }), j = new jr({
2847
+ }), H = new jr({
2838
2848
  id: "building-square",
2839
2849
  spec: {
2840
2850
  cellSize: E.GRID_CELL_SIZE,
@@ -2848,7 +2858,7 @@ const E = Object.freeze({
2848
2858
  ...t,
2849
2859
  x: Math.round(t.x / E.SNAP_GRID_SIZE) * E.SNAP_GRID_SIZE,
2850
2860
  z: Math.round(t.z / E.SNAP_GRID_SIZE) * E.SNAP_GRID_SIZE
2851
- }), qr = (t) => j.fromWorld(t), Jr = (t) => j.toWorld(t), Yr = (t) => {
2861
+ }), qr = (t) => H.fromWorld(t), Jr = (t) => H.toWorld(t), Yr = (t) => {
2852
2862
  const n = Math.PI / 2;
2853
2863
  return (Math.round(t / n) % 4 + 4) % 4 * n;
2854
2864
  }, Xr = (t) => {
@@ -2861,7 +2871,7 @@ const E = Object.freeze({
2861
2871
  return 0;
2862
2872
  }
2863
2873
  }, Lo = (t) => {
2864
- const n = j.edgeToWorld(t), e = Xr(t.side), r = E.WALL_SIZES.WIDTH / 2, o = {
2874
+ const n = H.edgeToWorld(t), e = Xr(t.side), r = E.WALL_SIZES.WIDTH / 2, o = {
2865
2875
  x: Math.sin(e),
2866
2876
  z: Math.cos(e)
2867
2877
  };
@@ -2894,7 +2904,7 @@ const E = Object.freeze({
2894
2904
  level: X(Math.round(i.y / E.HEIGHT_STEP)),
2895
2905
  side: i.z - Math.trunc(i.z / o) * o >= 0 ? "south" : "north"
2896
2906
  };
2897
- }, Bo = (t) => j.edgeKey(t), X = (t) => Object.is(t, -0) || Math.abs(t) < 1e-10 ? 0 : Number(t.toFixed(10)), U = (t) => qr(t), Ko = (t) => Jr(t), se = (t, n = 1) => {
2907
+ }, Bo = (t) => H.edgeKey(t), X = (t) => Object.is(t, -0) || Math.abs(t) < 1e-10 ? 0 : Number(t.toFixed(10)), U = (t) => qr(t), Ko = (t) => Jr(t), se = (t, n = 1) => {
2898
2908
  const e = Math.max(1, Math.round(n)), r = -Math.floor(e / 2), o = [];
2899
2909
  for (let i = 0; i < e; i++)
2900
2910
  for (let s = 0; s < e; s++)
@@ -2904,7 +2914,7 @@ const E = Object.freeze({
2904
2914
  level: t.level
2905
2915
  });
2906
2916
  return o;
2907
- }, jo = (t) => t.map((n) => j.key(n)), Qr = (t, n = {}) => {
2917
+ }, jo = (t) => t.map((n) => H.key(n)), Qr = (t, n = {}) => {
2908
2918
  const e = Math.max(1, Math.round(n.x ?? 1)), r = Math.max(1, Math.round(n.y ?? 1)), o = Math.max(1, Math.round(n.z ?? 1)), i = [];
2909
2919
  for (let s = 0; s < e; s++)
2910
2920
  for (let a = 0; a < r; a++)
@@ -2918,22 +2928,22 @@ const E = Object.freeze({
2918
2928
  }, eo = {
2919
2929
  id: "building-placement",
2920
2930
  toWorld(t) {
2921
- return t.kind === "cell" ? j.toWorld(t.cell) : j.edgeToWorld(t.edge);
2931
+ return t.kind === "cell" ? H.toWorld(t.cell) : H.edgeToWorld(t.edge);
2922
2932
  },
2923
2933
  fromWorld(t) {
2924
2934
  return {
2925
2935
  kind: "cell",
2926
- cell: j.fromWorld(t)
2936
+ cell: H.fromWorld(t)
2927
2937
  };
2928
2938
  },
2929
2939
  getNeighbors(t) {
2930
- return t.kind === "edge" ? [t] : j.getNeighbors(t.cell).map((n) => ({ kind: "cell", cell: n }));
2940
+ return t.kind === "edge" ? [t] : H.getNeighbors(t.cell).map((n) => ({ kind: "cell", cell: n }));
2931
2941
  },
2932
2942
  equals(t, n) {
2933
2943
  return this.key(t) === this.key(n);
2934
2944
  },
2935
2945
  key(t) {
2936
- return t.kind === "cell" ? `cell:${j.key(t.cell)}` : `edge:${j.edgeKey(t.edge)}`;
2946
+ return t.kind === "cell" ? `cell:${H.key(t.cell)}` : `edge:${H.edgeKey(t.edge)}`;
2937
2947
  }
2938
2948
  }, Ut = (t) => {
2939
2949
  const n = t.cell ?? U(t.position), e = t.footprint ?? se(n, t.size || 1), r = {
@@ -3027,9 +3037,9 @@ const E = Object.freeze({
3027
3037
  const c = Math.floor(r / a), l = Math.floor(o / a), h = Math.floor(i / a), u = Math.floor(s / a), d = [];
3028
3038
  for (let f = c; f <= l; f++)
3029
3039
  for (let g = h; g <= u; g++) {
3030
- const m = Ht(f, g);
3031
- let p = t.get(m);
3032
- p || (p = /* @__PURE__ */ new Set(), t.set(m, p)), p.add(e), d.push(m);
3040
+ const p = Ht(f, g);
3041
+ let m = t.get(p);
3042
+ m || (m = /* @__PURE__ */ new Set(), t.set(p, m)), m.add(e), d.push(p);
3033
3043
  }
3034
3044
  n.set(e, d);
3035
3045
  }, Ve = (t, n, e, r, o, i) => {
@@ -3475,14 +3485,14 @@ const Uo = fn()(
3475
3485
  if (r && o) {
3476
3486
  for (let l = -3; l <= 3; l++)
3477
3487
  for (let h = -3; h <= 3; h++) {
3478
- const u = l * a, d = h * a, f = Math.abs(l) <= 1 && Math.abs(h) <= 1, g = l >= 2 && h === -2, m = l >= 2 && h === -3, p = l <= -2 && h >= 2, S = l === 3 && h === 2, v = l === -3 && h === 2, z = l === -2 && h === 2, D = l === 2 && h === -3, A = (p ? i : void 0) ?? (m ? s : void 0) ?? (f ? o : void 0) ?? r, K = m ? 2 : g || p || S ? 1 : f ? l === 0 && h === 0 ? 2 : 1 : 0, b = {
3488
+ const u = l * a, d = h * a, f = Math.abs(l) <= 1 && Math.abs(h) <= 1, g = l >= 2 && h === -2, p = l >= 2 && h === -3, m = l <= -2 && h >= 2, S = l === 3 && h === 2, v = l === -3 && h === 2, z = l === -2 && h === 2, D = l === 2 && h === -3, A = (m ? i : void 0) ?? (p ? s : void 0) ?? (f ? o : void 0) ?? r, K = p ? 2 : g || m || S ? 1 : f ? l === 0 && h === 0 ? 2 : 1 : 0, b = {
3479
3489
  id: `demo-${l + 3}-${h + 3}`,
3480
3490
  position: { x: u, y: K * E.HEIGHT_STEP, z: d },
3481
3491
  tileGroupId: A.id,
3482
3492
  size: 1,
3483
3493
  shape: v ? "round" : z ? "ramp" : D ? "stairs" : "box"
3484
3494
  };
3485
- g ? c(A, { ...b, objectType: "grass", objectConfig: { grassDensity: 90 } }) : m ? c(A, { ...b, objectType: "snowfield" }) : p ? c(A, { ...b, objectType: "sand" }) : c(A, b);
3495
+ g ? c(A, { ...b, objectType: "grass", objectConfig: { grassDensity: 90 } }) : p ? c(A, { ...b, objectType: "snowfield" }) : m ? c(A, { ...b, objectType: "sand" }) : c(A, b);
3486
3496
  }
3487
3497
  e.objects.push(
3488
3498
  {
@@ -4032,7 +4042,7 @@ const Uo = fn()(
4032
4042
  })
4033
4043
  }))
4034
4044
  );
4035
- function me(t, n, e, r) {
4045
+ function pe(t, n, e, r) {
4036
4046
  const o = Math.atan2(
4037
4047
  n.z - e.z,
4038
4048
  n.x - e.x
@@ -4071,7 +4081,7 @@ function $o(t = {}) {
4071
4081
  ...h !== void 0 ? { clearance: h } : {}
4072
4082
  };
4073
4083
  if (b.y = Math.max(G.sampleHeight(b.x, b.z) + e, n), G.hasLineOfSight(y.x, y.z, b.x, b.z, x)) {
4074
- Ee([b], i, v), me(d, b, y, v);
4084
+ Ee([b], i, v), pe(d, b, y, v);
4075
4085
  return;
4076
4086
  }
4077
4087
  const M = G.findPath(
@@ -4085,7 +4095,7 @@ function $o(t = {}) {
4085
4095
  }
4086
4096
  );
4087
4097
  if (M.length === 0) {
4088
- Ae(), s && !G.hasNavigationConstraints() && G.isWalkable(b.x, b.z, x) && (Ee([b], i, v), me(d, b, y, v));
4098
+ Ae(), s && !G.hasNavigationConstraints() && G.isWalkable(b.x, b.z, x) && (Ee([b], i, v), pe(d, b, y, v));
4089
4099
  return;
4090
4100
  }
4091
4101
  const O = (o ? G.smoothPath(
@@ -4096,8 +4106,8 @@ function $o(t = {}) {
4096
4106
  ) : M).map((F) => new w.Vector3(F[0], F[1], F[2])).filter((F) => F.distanceTo(y) > i), V = O[O.length - 1];
4097
4107
  (!V || V.distanceTo(b) > i) && O.push(b);
4098
4108
  const Z = O.length > 0 ? O : [b];
4099
- Ee(Z, i, v), me(d, Z[0] ?? b, y, v);
4100
- }), !0) : (Ae(), me(d, b, y, v), !0);
4109
+ Ee(Z, i, v), pe(d, Z[0] ?? b, y, v);
4110
+ }), !0) : (Ae(), pe(d, b, y, v), !0);
4101
4111
  } catch (D) {
4102
4112
  return console.error("moveClicker error:", D), !1;
4103
4113
  }
@@ -4151,7 +4161,7 @@ export {
4151
4161
  Fe as a1,
4152
4162
  Le as a2,
4153
4163
  xt as a3,
4154
- mn as a4,
4164
+ pn as a4,
4155
4165
  Fo as a5,
4156
4166
  Gt as a6,
4157
4167
  Rt as a7,
@@ -4178,7 +4188,7 @@ export {
4178
4188
  Jr as b,
4179
4189
  ht as c,
4180
4190
  oo as d,
4181
- j as e,
4191
+ H as e,
4182
4192
  eo as f,
4183
4193
  Bo as g,
4184
4194
  Xr as h,
@@ -2,11 +2,11 @@ import { jsx as h, jsxs as E, Fragment as K } from "react/jsx-runtime";
2
2
  import { useRef as P, useState as C, useEffect as G, useMemo as x, useCallback as B, memo as U } from "react";
3
3
  import * as S from "three";
4
4
  import { Line as L } from "@react-three/drei";
5
- import { V as T, G as z, W as N, X as F, Y as I, Z as V, U as q, _ as W } from "./index-gVEtTVSD.js";
5
+ import { V as T, G as z, W as N, X as F, Y as I, Z as V, U as q, _ as W } from "./index-DKEZe9SJ.js";
6
6
  import { useFrame as Z } from "@react-three/fiber";
7
7
  import { B as j, u as k } from "./gaesupStore-DTu0tYBp.js";
8
8
  import { vec3 as Y } from "@react-three/rapier";
9
- import { u as _ } from "./index-B7q_lGzN.js";
9
+ import { u as _ } from "./index-DnZ3X7L7.js";
10
10
  const H = () => ({
11
11
  position: new S.Vector3(0, 0, 0),
12
12
  velocity: new S.Vector3(0, 0, 0),
@@ -2,8 +2,8 @@ import { jsx as s, jsxs as u } from "react/jsx-runtime";
2
2
  import { useRef as d, useMemo as f, useEffect as v, useLayoutEffect as h, Suspense as g } from "react";
3
3
  import { useThree as U, useFrame as D } from "@react-three/fiber";
4
4
  import { u as l } from "./gaesupStore-DTu0tYBp.js";
5
- import { T as x } from "./index-gVEtTVSD.js";
6
- import { C as y } from "./index-B7q_lGzN.js";
5
+ import { T as x } from "./index-DKEZe9SJ.js";
6
+ import { C as y } from "./index-DnZ3X7L7.js";
7
7
  function C() {
8
8
  const r = U((o) => o.gl), t = l((o) => o.setPerformance), n = d(0);
9
9
  return D(() => {