gaesup-world 1.0.21 → 1.0.22

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.
@@ -12,13 +12,14 @@ import { A as gu, c as aa, b as jp } from "./index-C-ViQFGa.js";
12
12
  import { create as yi } from "zustand";
13
13
  import { useShallow as Ns } from "zustand/react/shallow";
14
14
  import { r as Vp, o as Zp, G as Yp, S as bu, h as Xp, k as Kp, f as qp, j as Qp, e as Jp, i as eh, m as th, n as nh, c as ih, v as oh } from "./loader-C3ZwumCe.js";
15
- import { g as Ui, M as rh, W as ah } from "./index-BUQXtHf3.js";
15
+ import { g as Ui, M as rh, W as ah } from "./index-DGifA0e6.js";
16
16
  import { useGLTF as Is, useAnimations as sh, useTexture as Ts, shaderMaterial as Es, OrbitControls as lh } from "@react-three/drei";
17
17
  import * as B from "three";
18
18
  import { w as Ao } from "./sfe-CRsG1dTW.js";
19
19
  import { enableMapSet as ch } from "immer";
20
20
  import { immer as uh } from "zustand/middleware/immer";
21
21
  import { SkeletonUtils as yu, Water as dh } from "three-stdlib";
22
+ import "reflect-metadata";
22
23
  import { u as As } from "./weatherStore-CzG5N441.js";
23
24
  import { createNoise2D as ks } from "simplex-noise";
24
25
  function Xe({ label: e, min: t, max: n, step: i, value: o, suffix: r, onChange: a }) {
@@ -9807,7 +9808,7 @@ function _1(e, t) {
9807
9808
  e.position[2] + Math.sin(i) * o
9808
9809
  ];
9809
9810
  }
9810
- function gM(e, t, n) {
9811
+ function bM(e, t, n) {
9811
9812
  const i = ds(e, t);
9812
9813
  return kr.set(i, n), () => {
9813
9814
  kr.delete(i);
@@ -12062,13 +12063,13 @@ const Si = {
12062
12063
  face: "표정",
12063
12064
  weapon: "무기",
12064
12065
  accessory: "액세서리"
12065
- }, bM = {
12066
+ }, yM = {
12066
12067
  short: "단발",
12067
12068
  long: "긴머리",
12068
12069
  cap: "모자머리",
12069
12070
  bun: "쪽머리",
12070
12071
  spiky: "뻗친머리"
12071
- }, yM = {
12072
+ }, vM = {
12072
12073
  default: "기본",
12073
12074
  smile: "미소",
12074
12075
  wink: "윙크",
@@ -13264,7 +13265,7 @@ const Ax = ({
13264
13265
  ...e.smoothing ? { smoothing: { ...e.smoothing } } : {},
13265
13266
  ...e.bounds ? { bounds: { ...e.bounds } } : {},
13266
13267
  ...e.modeSettings ? { modeSettings: { ...e.modeSettings } } : {}
13267
- }), vM = ({
13268
+ }), wM = ({
13268
13269
  children: e,
13269
13270
  className: t = "",
13270
13271
  style: n = {},
@@ -13310,7 +13311,7 @@ const Ax = ({
13310
13311
  }, Px = () => /* @__PURE__ */ s("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ s("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) }), Bx = () => /* @__PURE__ */ x("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
13311
13312
  /* @__PURE__ */ s("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
13312
13313
  /* @__PURE__ */ s("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
13313
- ] }), wM = ({
13314
+ ] }), xM = ({
13314
13315
  children: e,
13315
13316
  title: t,
13316
13317
  initialWidth: n = 280,
@@ -13408,7 +13409,7 @@ const Ax = ({
13408
13409
  setActiveNodeGraph: (t) => e({ activeNodeGraph: t }),
13409
13410
  clipboard: null,
13410
13411
  setClipboard: (t) => e({ clipboard: t })
13411
- }), xM = ff, Rx = yi(ff), _M = () => {
13412
+ }), _M = ff, Rx = yi(ff), SM = () => {
13412
13413
  const e = Rx();
13413
13414
  return {
13414
13415
  ...e,
@@ -13417,7 +13418,7 @@ const Ax = ({
13417
13418
  clearSelection: () => e.setSelectedObjectIds([])
13418
13419
  };
13419
13420
  };
13420
- function SM(e = {}) {
13421
+ function MM(e = {}) {
13421
13422
  const t = {
13422
13423
  panels: e.panels ?? [],
13423
13424
  actions: (e.commands ?? []).map((n) => ({
@@ -13428,7 +13429,7 @@ function SM(e = {}) {
13428
13429
  };
13429
13430
  return e.defaultActivePanels && (t.defaultActivePanels = e.defaultActivePanels), typeof e.defaultPanelOpen == "boolean" && (t.defaultPanelOpen = e.defaultPanelOpen), typeof e.defaultModalOpen == "boolean" && (t.defaultModalOpen = e.defaultModalOpen), e.hiddenBuiltInPanels && (t.hiddenBuiltInPanels = e.hiddenBuiltInPanels), e.panelOrder && (t.panelOrder = e.panelOrder), e.panelDefaults && (t.panelDefaults = e.panelDefaults), e.validate && (t.validate = e.validate), t;
13430
13431
  }
13431
- function MM() {
13432
+ function CM() {
13432
13433
  const e = [], t = [];
13433
13434
  return {
13434
13435
  execute: async (n) => {
@@ -14652,7 +14653,7 @@ const E_ = ge.memo(function({ billboards: t }) {
14652
14653
  const r = o[0];
14653
14654
  return r ? r.imageUrl ? /* @__PURE__ */ s(I_, { entries: o }, i) : /* @__PURE__ */ s(T_, { entries: o }, i) : null;
14654
14655
  }) });
14655
- }), CM = ge.memo(N_);
14656
+ }), NM = ge.memo(N_);
14656
14657
  var A_ = `varying vec2 vUv;\r
14657
14658
  uniform float time;\r
14658
14659
  uniform float intensity;\r
@@ -14945,7 +14946,7 @@ const R_ = ({ intensity: e = 1.5, width: t = 1, height: n = 1.5, color: i = "#ff
14945
14946
  })()),
14946
14947
  /* @__PURE__ */ s("points", { geometry: f, material: a.ember })
14947
14948
  ] });
14948
- }, NM = ge.memo(R_), D_ = (
14949
+ }, IM = ge.memo(R_), D_ = (
14949
14950
  /* glsl */
14950
14951
  `
14951
14952
  attribute float aSeed;
@@ -15923,7 +15924,7 @@ function c2({ trees: e, toon: t }) {
15923
15924
  /* @__PURE__ */ s("points", { geometry: _, children: /* @__PURE__ */ s("pointsMaterial", { size: 0.085 * h, sizeAttenuation: !0, vertexColors: !0, transparent: !0, opacity: 0.7, depthWrite: !1 }) })
15924
15925
  ] });
15925
15926
  }
15926
- function IM({ size: e = 4, toon: t }) {
15927
+ function TM({ size: e = 4, toon: t }) {
15927
15928
  const n = ee(null), i = ee(null), o = ee(null), r = ee(null), a = ee(null), l = ee(null), c = X(() => B.MathUtils.clamp(e / 4, 0.95, 1.85), [e]), u = 3.8 * c, d = 1.65 * c + Math.min(e * 0.08, 0.55), f = 2.15 * c + Math.min(e * 0.04, 0.35), p = t ?? We(), h = Of(), w = Hf(p), g = X(() => Gf(c, u, "round"), [c, u]), _ = X(() => Wf(c), [c]), b = X(() => Uf(c, u, d, f, "round"), [c, u, d, f]), S = g.length, m = _.length + g.length, y = b.length, v = Math.max(180, Math.min(420, Math.round(210 + c * 95))), C = Math.max(44, Math.min(120, Math.round(54 + c * 26))), T = Math.max(52, Math.min(132, Math.round(62 + c * 30))), P = X(() => {
15928
15929
  const E = new Float32Array(v * 3), G = new Float32Array(v * 3);
15929
15930
  return jf(E, G, 0, v, u, d, f, 0, 0, 0), Fr(E, G, !0);
@@ -16438,7 +16439,7 @@ function x2({ entries: e, toon: t }) {
16438
16439
  ) })
16439
16440
  ] });
16440
16441
  }
16441
- function TM({ size: e = 4, toon: t, color: n, accentColor: i }) {
16442
+ function EM({ size: e = 4, toon: t, color: n, accentColor: i }) {
16442
16443
  const o = t ?? We(), r = Kf(o), [a, l] = X(() => {
16443
16444
  const c = Math.max(20, Math.round(e * 6)), u = new B.PlaneGeometry(e, e, c, c);
16444
16445
  u.rotateX(-Math.PI / 2);
@@ -16563,7 +16564,7 @@ function S2({ entries: e, toon: t }) {
16563
16564
  ) })
16564
16565
  ] });
16565
16566
  }
16566
- function EM({ size: e = 4, toon: t, color: n, accentColor: i }) {
16567
+ function AM({ size: e = 4, toon: t, color: n, accentColor: i }) {
16567
16568
  const o = t ?? We(), r = qf(o), [a, l] = X(() => {
16568
16569
  const c = Math.max(22, Math.round(e * 7)), u = new B.PlaneGeometry(e, e, c, c);
16569
16570
  u.rotateX(-Math.PI / 2);
@@ -19190,7 +19191,7 @@ function $S() {
19190
19191
  }), null;
19191
19192
  }
19192
19193
  const OS = 9, HS = 150;
19193
- function AM() {
19194
+ function kM() {
19194
19195
  const { gl: e } = Li(), {
19195
19196
  updateMousePosition: t,
19196
19197
  placeWall: n,
@@ -19291,7 +19292,7 @@ function AM() {
19291
19292
  ] });
19292
19293
  }
19293
19294
  const su = rf;
19294
- function kM({
19295
+ function PM({
19295
19296
  onClose: e,
19296
19297
  canEdit: t = !0,
19297
19298
  npcPanel: n = !1,
@@ -20792,7 +20793,7 @@ function ZS(e = {}) {
20792
20793
  }
20793
20794
  };
20794
20795
  }
20795
- const PM = ZS();
20796
+ const BM = ZS();
20796
20797
  export {
20797
20798
  US as $,
20798
20799
  kh as A,
@@ -20812,21 +20813,21 @@ export {
20812
20813
  Qf as O,
20813
20814
  Fh as P,
20814
20815
  su as Q,
20815
- wM as R,
20816
+ xM as R,
20816
20817
  Nx as S,
20817
20818
  sS as T,
20818
- kM as U,
20819
+ PM as U,
20819
20820
  Lh as V,
20820
20821
  gS as W,
20821
20822
  _o as X,
20822
20823
  Ks as Y,
20823
20824
  rf as Z,
20824
20825
  WS as _,
20825
- vM as a,
20826
+ wM as a,
20826
20827
  jS as a0,
20827
20828
  VS as a1,
20828
20829
  ZS as a2,
20829
- PM as a3,
20830
+ BM as a3,
20830
20831
  hx as a4,
20831
20832
  Ue as a5,
20832
20833
  Rt as a6,
@@ -20843,13 +20844,13 @@ export {
20843
20844
  Bh as aH,
20844
20845
  Dh as aI,
20845
20846
  _a as aJ,
20846
- bM as aK,
20847
- yM as aL,
20847
+ yM as aK,
20848
+ vM as aL,
20848
20849
  Z1 as aM,
20849
20850
  uf as aN,
20850
20851
  w1 as aO,
20851
20852
  S1 as aP,
20852
- gM as aQ,
20853
+ bM as aQ,
20853
20854
  Jo as aR,
20854
20855
  N1 as aS,
20855
20856
  wh as aT,
@@ -20887,27 +20888,27 @@ export {
20887
20888
  dl as ay,
20888
20889
  f_ as az,
20889
20890
  Ax as b,
20890
- MM as c,
20891
- SM as d,
20892
- xM as e,
20891
+ CM as c,
20892
+ MM as d,
20893
+ _M as e,
20893
20894
  Rx as f,
20894
20895
  Zc as g,
20895
20896
  ff as h,
20896
20897
  Tx as i,
20897
- IM as j,
20898
+ TM as j,
20898
20899
  c2 as k,
20899
- TM as l,
20900
+ EM as l,
20900
20901
  x2 as m,
20901
- EM as n,
20902
+ AM as n,
20902
20903
  S2 as o,
20903
20904
  Xf as p,
20904
20905
  ip as q,
20905
20906
  Ex as r,
20906
- CM as s,
20907
- NM as t,
20908
- _M as u,
20907
+ NM as s,
20908
+ IM as t,
20909
+ SM as u,
20909
20910
  xS as v,
20910
- AM as w,
20911
+ kM as w,
20911
20912
  LS as x,
20912
20913
  y_ as y,
20913
20914
  RS as z
package/dist/runtime.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import "reflect-metadata";
2
- import { c as le, n as de, a as ue, p as fe, D as pe } from "./index-DShLht0Q.js";
3
- import { B as Et, d as Ot, F as It, R as jt, T as Dt, g as xt, b as Bt, e as Tt, f as Ut, h as Ct, u as Mt, i as At } from "./index-DShLht0Q.js";
2
+ import { c as le, n as de, a as ue, p as fe, D as pe } from "./index-B0oz8u47.js";
3
+ import { B as Et, d as Ot, F as It, R as jt, T as Dt, g as xt, b as Bt, e as Tt, f as Ut, h as Ct, u as Mt, i as At } from "./index-B0oz8u47.js";
4
4
  import { s as Gt } from "./runtimeFilter-CS35UPHd.js";
5
5
  import { $ as ye, a0 as ge, a1 as me, a2 as he, a3 as ve, a4 as be, V as Y, a5 as Se, _ as D } from "./index-C5agFfBe.js";
6
6
  import { T as zt, a6 as Lt, a7 as Nt } from "./index-C5agFfBe.js";
7
7
  import * as V from "three";
8
8
  import { H as E, P as O, R as Re, u as I, B as we, T as ee, a as Ee } from "./gaesupStore-DTu0tYBp.js";
9
- import { G as kt, W as Wt, a as $t, W as Vt } from "./index-Drmv86ws.js";
9
+ import { G as kt, W as Wt, a as $t, W as Vt } from "./index-3WAK67Ha.js";
10
10
  import { jsx as f, jsxs as j, Fragment as Oe } from "react/jsx-runtime";
11
- import { u as x } from "./index-D0Rz5_-J.js";
11
+ import { u as x } from "./index-DRLvJF_k.js";
12
12
  import { useCallback as S, useEffect as N, memo as te, useState as Ie, useRef as je, useMemo as De } from "react";
13
13
  import { useFrame as xe } from "@react-three/fiber";
14
14
  import { vec3 as J, euler as Be, RigidBody as Te, CapsuleCollider as Ue } from "@react-three/rapier";
15
- import { D as Kt, I as Ht, L as Zt, S as qt, W as Xt, c as Qt, g as Yt } from "./index-BUQXtHf3.js";
15
+ import { D as Kt, I as Ht, L as Zt, S as qt, W as Xt, c as Qt, g as Yt } from "./index-DGifA0e6.js";
16
16
  class M {
17
17
  cellSize;
18
18
  cells = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "description": "Web 3D Character Controller and World Platform Library",
6
6
  "exports": {
@@ -1 +0,0 @@
1
- "use strict";const s=require("react/jsx-runtime"),p=require("react"),A=require("three"),O=require("@react-three/drei"),w=require("./index-CJj-Z7Jr.cjs"),z=require("@react-three/fiber"),E=require("./gaesupStore-2zKBYTYo.cjs"),T=require("@react-three/rapier"),D=require("./index-D1hpjfAw.cjs");function U(e){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const c=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(d,a,c.get?c:{enumerable:!0,get:()=>e[a]})}}return d.default=e,Object.freeze(d)}const P=U(A),q=()=>({position:new P.Vector3(0,0,0),velocity:new P.Vector3(0,0,0),rotation:new P.Euler(0,0,0),isMoving:!1,isGrounded:!1,speed:0,height:2});function G(e={}){const{updateInterval:d=0,entityId:a}=e,c=p.useRef(null);c.current||(c.current=q());const[,f]=p.useState(0),n=p.useRef(0),R=p.useRef(0),m=p.useRef({x:0,y:0,z:0}),h=p.useRef(void 0),S=p.useRef(null),{activeState:v,gameStates:b}=w.useStateSystem(),u=y=>{if(a)return a;if(h.current)return h.current;const r=y.getActiveEntities();return h.current=r[0],h.current};return p.useEffect(()=>{h.current=void 0,S.current=E.BridgeFactory.getOrCreate("motion");const y=S.current;if(!y)return;const r=y.subscribe((o,g)=>{const l=u(y);if(!l||g!==l)return;const t=performance.now();if(R.current=t,d>0&&t-n.current<d)return;n.current=t;const i=c.current;i.position.copy(o.position),i.velocity.copy(o.velocity),i.rotation.copy(o.rotation),i.isMoving=o.isMoving,i.isGrounded=o.isGrounded,i.speed=o.speed,i.height=2,f(x=>x+1)});return()=>{r()}},[a,d]),z.useFrame(()=>{const y=performance.now();if(d>0&&y-n.current<d)return;const r=c.current,o=S.current,g=l=>{const t=m.current,i=l.x-t.x,x=l.y-t.y,k=l.z-t.z;return i*i+x*x+k*k>1e-6?(t.x=l.x,t.y=l.y,t.z=l.z,!0):!1};if(o){const l=u(o);if(!(y-R.current<16)&&l){const i=o.snapshot(l);if(i){r.position.copy(i.position),r.velocity.copy(i.velocity),r.rotation.copy(i.rotation),r.isMoving=i.isMoving,r.isGrounded=i.isGrounded,r.speed=i.speed,r.height=2,n.current=y,g(r.position)&&f(x=>x+1);return}}}v?.position&&(r.position.copy(v.position),v.velocity?r.velocity.copy(v.velocity):r.velocity.set(0,0,0),v.euler?r.rotation.copy(v.euler):r.rotation.set(0,0,0),r.isMoving=b?.isMoving||!1,r.isGrounded=b?.isOnTheGround||!1,r.speed=v.velocity?v.velocity.length():0,r.height=2,n.current=y,g(r.position)&&f(l=>l+1))}),c.current}const N={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},M=(e=!0,d=!0,a)=>{const c=E.useGaesupStore(u=>u.automation?.queue.isRunning),f=E.useGaesupStore(u=>u.stopAutomation),n=E.useGaesupStore(u=>u.interaction?.isActive??!0),R=w.useBuildingStore(u=>u.isInEditMode()),m=w.useInputBackend(),h=p.useRef(new Set),S=p.useMemo(()=>({...N}),[]),v=p.useCallback((u,y)=>{if(!n)return!1;try{return m.updateKeyboard({[u]:y}),y?h.current.add(u):h.current.delete(u),!0}catch(r){return console.error("Error updating keyboard state:",r),!1}},[m,n]),b=p.useCallback(()=>{h.current.clear(),m.updateKeyboard({forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1})},[m]);return p.useEffect(()=>{(!n||R)&&b()},[b,n,R]),p.useEffect(()=>{const u=(g,l)=>{const t=S[g.code];if(!t)return;if(!n||R){l&&g.preventDefault(),b();return}const i=h.current.has(g.code);l&&!i?(h.current.add(g.code),g.code==="Space"&&g.preventDefault(),d&&c&&(t==="forward"||t==="backward"||t==="leftward"||t==="rightward")&&(f(),m.updateMouse({isActive:!1,shouldRun:!1})),m.updateKeyboard({[t]:!0})):!l&&i&&(h.current.delete(g.code),m.updateKeyboard({[t]:!1}))},y=g=>u(g,!0),r=g=>u(g,!1),o=()=>document.hidden&&b();return window.addEventListener("keydown",y),window.addEventListener("keyup",r),document.addEventListener("visibilitychange",o),()=>{window.removeEventListener("keydown",y),window.removeEventListener("keyup",r),document.removeEventListener("visibilitychange",o)}},[S,d,f,c,b,n,R,m]),{pressedKeys:Array.from(h.current),pushKey:v,isKeyPressed:u=>h.current.has(u),clearAllKeys:b}},C=p.memo(({points:e,color:d})=>e.length<2?null:s.jsx(O.Line,{points:e,color:d,lineWidth:2,dashed:!1}));C.displayName="PathLine";const K=p.memo(()=>s.jsxs("group",{children:[s.jsxs("mesh",{children:[s.jsx("sphereGeometry",{args:[.2,16,16]}),s.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),s.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[s.jsx("ringGeometry",{args:[.3,.5,8]}),s.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:P.DoubleSide})]})]}));K.displayName="TargetMarker";function B({lineStartHeight:e}={}){const d=E.useGaesupStore(t=>t.automation),{position:a}=G(),{mouse:c}=w.useInteractionSystem(),[f,n]=p.useState(()=>[...w.getClickNavigationRoute()]);p.useEffect(()=>w.subscribeClickNavigationRoute(()=>{n([...w.getClickNavigationRoute()])}),[]);const R=c?.target||new P.Vector3,m=c?.isActive||!1,h=d?.queue||{actions:[],currentIndex:0},S=h.actions||[],v=h.currentIndex||0,u=a.distanceTo(R)<1,y=m&&!u,r=S.map(t=>t.type==="move"&&t.target?new P.Vector3(t.target.x,t.target.y,t.target.z):null).filter(t=>t!==null),o=a.clone();e!==void 0&&(o.y+=e);const g=f.length>0?f:[R],l=y?[o,...g,...r]:r.length>0?[o,...r]:[];return s.jsxs("group",{children:[y&&s.jsx("group",{position:R,children:s.jsx(K,{})}),l.length>1&&s.jsx(C,{points:l,color:v>=0?"#00ff88":"#ffaa00"}),S.map((t,i)=>{if(t.type==="move"&&t.target){const x=i===v,k=i<v;return s.jsx("group",{position:[t.target.x,t.target.y,t.target.z],children:s.jsxs("mesh",{children:[s.jsx("sphereGeometry",{args:[.1,8,8]}),s.jsx("meshStandardMaterial",{color:k?"#888":x?"#ff4444":"#ffaa00",transparent:!0,opacity:k?.3:.8})]})},`action-${i}`)}return null})]})}function I({clickerOptions:e}){const{onClick:d}=w.useClicker(e),a=c=>{c.stopPropagation();const{cameraOption:f,setCameraOption:n}=E.useGaesupStore.getState();if(f?.focus){n({focus:!1});return}d(c)};return s.jsxs("mesh",{position:[0,0,0],rotation:[-Math.PI/2,0,0],onPointerDown:a,visible:!0,userData:{intangible:!0},children:[s.jsx("planeGeometry",{args:[1e3,1e3]}),s.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function F({props:e,children:d}){const a=E.useGaesupStore(o=>o.mode),{gameStates:c}=w.useStateSystem(),f=E.useGaesupStore(o=>o.rideable),n=E.useGaesupStore(o=>o.urls),R=w.useBuildingStore(o=>o.isInEditMode()),m=D.useGenericRefs();if(M(),R||!a||!c||!f||!n||a.type==="character"&&!n.characterUrl||a.type==="vehicle"&&!n.vehicleUrl||a.type==="airplane"&&!n.airplaneUrl)return null;const{canRide:h,isRiding:S,currentRideable:v}=c,b=v?.id,u=p.useMemo(()=>(b?f[b]?.offset:void 0)??T.vec3(),[b,f]),r=(()=>{const o=e.rigidBodyRef??m.rigidBodyRef,g=e.outerGroupRef??m.outerGroupRef,l=e.innerGroupRef??m.innerGroupRef,t=e.colliderRef??m.colliderRef,i={isActive:!0,componentType:a.type,enableRiding:h,isRiderOn:S,offset:u,ref:o,outerGroupRef:g,innerGroupRef:l,colliderRef:t,parts:(e.parts||[]).filter(j=>!!j.url).map(j=>({...j,url:j.url})),...e.onAnimate?{onAnimate:e.onAnimate}:{},...e.onFrame?{onFrame:e.onFrame}:{},...e.onReady?{onReady:e.onReady}:{},...e.onDestroy?{onDestroy:e.onDestroy}:{},...e.onDestory?{onDestory:e.onDestory}:{},...typeof e.baseColor=="string"&&e.baseColor.trim().length>0?{baseColor:e.baseColor}:{},...Array.isArray(e.excludeBaseNodes)&&e.excludeBaseNodes.length>0?{excludeBaseNodes:e.excludeBaseNodes}:{},...e.rigidBodyProps?{rigidBodyProps:e.rigidBodyProps}:{},...e.controllerOptions?{controllerOptions:e.controllerOptions}:{},...e.groundRay?{groundRay:e.groundRay}:{},...e.colliderSize?{colliderSize:e.colliderSize}:{},...e.position?{position:e.position}:{},...e.rotation?{rotation:e.rotation}:{},...e.scale?{scale:e.scale}:{}},x=S&&a.type!=="character"?n.ridingUrl:void 0,k=typeof x=="string"&&x.length>0?{ridingUrl:x}:{};switch(a.type){case"character":return{...i,url:n.characterUrl||""};case"vehicle":return{...i,...k,url:n.vehicleUrl||"",wheelUrl:n.wheelUrl};case"airplane":return{...i,...k,url:n.airplaneUrl||""};default:return{...i,url:n.characterUrl||""}}})();return a.type==="character"&&c.isRiding?null:s.jsx(w.PhysicsEntity,{...r,children:d})}function L(e){const{clickToMove:d,children:a,clickerOptions:c,...f}=e,n=f.colliderSize?.height?f.colliderSize.height*.5:void 0,R={...c??{},...c?.agentRadius===void 0&&f.colliderSize?.radius!==void 0?{agentRadius:f.colliderSize.radius}:{}};return s.jsx(F,{props:f,children:s.jsxs(s.Fragment,{children:[d&&s.jsxs(s.Fragment,{children:[s.jsx(I,{clickerOptions:R}),s.jsx(B,{...n!==void 0?{lineStartHeight:n}:{}})]}),a]})})}exports.Clicker=B;exports.ControllerWrapper=L;exports.GroundClicker=I;exports.useKeyboard=M;exports.usePlayerPosition=G;
@@ -1,320 +0,0 @@
1
- import { jsx as m, jsxs as k, Fragment as B } from "react/jsx-runtime";
2
- import { useRef as P, useState as C, useEffect as K, useMemo as x, useCallback as I, memo as z } from "react";
3
- import * as M from "three";
4
- import { Line as L } from "@react-three/drei";
5
- import { V as U, G as T, W as N, X as F, Y as A, Z as V, U as q, _ as W } from "./index-C5agFfBe.js";
6
- import { useFrame as Z } from "@react-three/fiber";
7
- import { B as j, u as S } from "./gaesupStore-DTu0tYBp.js";
8
- import { vec3 as Y } from "@react-three/rapier";
9
- import { u as _ } from "./index-D0Rz5_-J.js";
10
- const H = () => ({
11
- position: new M.Vector3(0, 0, 0),
12
- velocity: new M.Vector3(0, 0, 0),
13
- rotation: new M.Euler(0, 0, 0),
14
- isMoving: !1,
15
- isGrounded: !1,
16
- speed: 0,
17
- height: 2
18
- // Default character height
19
- });
20
- function X(e = {}) {
21
- const { updateInterval: g = 0, entityId: u } = e, c = P(null);
22
- c.current || (c.current = H());
23
- const [, l] = C(0), n = P(0), v = P(0), h = P({ x: 0, y: 0, z: 0 }), y = P(void 0), w = P(null), { activeState: p, gameStates: R } = U(), s = (d) => {
24
- if (u) return u;
25
- if (y.current) return y.current;
26
- const r = d.getActiveEntities();
27
- return y.current = r[0], y.current;
28
- };
29
- return K(() => {
30
- y.current = void 0, w.current = j.getOrCreate("motion");
31
- const d = w.current;
32
- if (!d) return;
33
- const r = d.subscribe((i, f) => {
34
- const a = s(d);
35
- if (!a || f !== a) return;
36
- const t = performance.now();
37
- if (v.current = t, g > 0 && t - n.current < g) return;
38
- n.current = t;
39
- const o = c.current;
40
- o.position.copy(i.position), o.velocity.copy(i.velocity), o.rotation.copy(i.rotation), o.isMoving = i.isMoving, o.isGrounded = i.isGrounded, o.speed = i.speed, o.height = 2, l((b) => b + 1);
41
- });
42
- return () => {
43
- r();
44
- };
45
- }, [u, g]), Z(() => {
46
- const d = performance.now();
47
- if (g > 0 && d - n.current < g) return;
48
- const r = c.current, i = w.current, f = (a) => {
49
- const t = h.current, o = a.x - t.x, b = a.y - t.y, E = a.z - t.z;
50
- return o * o + b * b + E * E > 1e-6 ? (t.x = a.x, t.y = a.y, t.z = a.z, !0) : !1;
51
- };
52
- if (i) {
53
- const a = s(i);
54
- if (!(d - v.current < 16) && a) {
55
- const o = i.snapshot(a);
56
- if (o) {
57
- r.position.copy(o.position), r.velocity.copy(o.velocity), r.rotation.copy(o.rotation), r.isMoving = o.isMoving, r.isGrounded = o.isGrounded, r.speed = o.speed, r.height = 2, n.current = d, f(r.position) && l((b) => b + 1);
58
- return;
59
- }
60
- }
61
- }
62
- p?.position && (r.position.copy(p.position), p.velocity ? r.velocity.copy(p.velocity) : r.velocity.set(0, 0, 0), p.euler ? r.rotation.copy(p.euler) : r.rotation.set(0, 0, 0), r.isMoving = R?.isMoving || !1, r.isGrounded = R?.isOnTheGround || !1, r.speed = p.velocity ? p.velocity.length() : 0, r.height = 2, n.current = d, f(r.position) && l((a) => a + 1));
63
- }), c.current;
64
- }
65
- const $ = {
66
- KeyW: "forward",
67
- KeyA: "leftward",
68
- KeyS: "backward",
69
- KeyD: "rightward",
70
- ShiftLeft: "shift",
71
- Space: "space",
72
- KeyZ: "keyZ",
73
- KeyR: "keyR",
74
- KeyF: "keyF",
75
- KeyE: "keyE",
76
- Escape: "escape"
77
- }, J = (e = !0, g = !0, u) => {
78
- const c = S((s) => s.automation?.queue.isRunning), l = S((s) => s.stopAutomation), n = S((s) => s.interaction?.isActive ?? !0), v = T((s) => s.isInEditMode()), h = N(), y = P(/* @__PURE__ */ new Set()), w = x(() => ({ ...$ }), []), p = I(
79
- (s, d) => {
80
- if (!n) return !1;
81
- try {
82
- return h.updateKeyboard({ [s]: d }), d ? y.current.add(s) : y.current.delete(s), !0;
83
- } catch (r) {
84
- return console.error("Error updating keyboard state:", r), !1;
85
- }
86
- },
87
- [h, n]
88
- ), R = I(() => {
89
- y.current.clear(), h.updateKeyboard({
90
- forward: !1,
91
- backward: !1,
92
- leftward: !1,
93
- rightward: !1,
94
- shift: !1,
95
- space: !1,
96
- keyZ: !1,
97
- keyR: !1,
98
- keyF: !1,
99
- keyE: !1,
100
- escape: !1
101
- });
102
- }, [h]);
103
- return K(() => {
104
- (!n || v) && R();
105
- }, [R, n, v]), K(() => {
106
- const s = (f, a) => {
107
- const t = w[f.code];
108
- if (!t) return;
109
- if (!n || v) {
110
- a && f.preventDefault(), R();
111
- return;
112
- }
113
- const o = y.current.has(f.code);
114
- a && !o ? (y.current.add(f.code), f.code === "Space" && f.preventDefault(), g && c && (t === "forward" || t === "backward" || t === "leftward" || t === "rightward") && (l(), h.updateMouse({ isActive: !1, shouldRun: !1 })), h.updateKeyboard({ [t]: !0 })) : !a && o && (y.current.delete(f.code), h.updateKeyboard({ [t]: !1 }));
115
- }, d = (f) => s(f, !0), r = (f) => s(f, !1), i = () => document.hidden && R();
116
- return window.addEventListener("keydown", d), window.addEventListener("keyup", r), document.addEventListener("visibilitychange", i), () => {
117
- window.removeEventListener("keydown", d), window.removeEventListener("keyup", r), document.removeEventListener("visibilitychange", i);
118
- };
119
- }, [
120
- w,
121
- g,
122
- l,
123
- c,
124
- R,
125
- n,
126
- v,
127
- h
128
- ]), {
129
- pressedKeys: Array.from(y.current),
130
- pushKey: p,
131
- isKeyPressed: (s) => y.current.has(s),
132
- clearAllKeys: R
133
- };
134
- }, D = z(({ points: e, color: g }) => e.length < 2 ? null : /* @__PURE__ */ m(
135
- L,
136
- {
137
- points: e,
138
- color: g,
139
- lineWidth: 2,
140
- dashed: !1
141
- }
142
- ));
143
- D.displayName = "PathLine";
144
- const O = z(() => /* @__PURE__ */ k("group", { children: [
145
- /* @__PURE__ */ k("mesh", { children: [
146
- /* @__PURE__ */ m("sphereGeometry", { args: [0.2, 16, 16] }),
147
- /* @__PURE__ */ m(
148
- "meshStandardMaterial",
149
- {
150
- color: "#00ff88",
151
- emissive: "#00ff88",
152
- emissiveIntensity: 0.5,
153
- transparent: !0,
154
- opacity: 0.9
155
- }
156
- )
157
- ] }),
158
- /* @__PURE__ */ k("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
159
- /* @__PURE__ */ m("ringGeometry", { args: [0.3, 0.5, 8] }),
160
- /* @__PURE__ */ m(
161
- "meshStandardMaterial",
162
- {
163
- color: "#00ff88",
164
- transparent: !0,
165
- opacity: 0.6,
166
- side: M.DoubleSide
167
- }
168
- )
169
- ] })
170
- ] }));
171
- O.displayName = "TargetMarker";
172
- function Q({ lineStartHeight: e } = {}) {
173
- const g = S((t) => t.automation), { position: u } = X(), { mouse: c } = F(), [l, n] = C(() => [...A()]);
174
- K(() => V(() => {
175
- n([...A()]);
176
- }), []);
177
- const v = c?.target || new M.Vector3(), h = c?.isActive || !1, y = g?.queue || { actions: [], currentIndex: 0 }, w = y.actions || [], p = y.currentIndex || 0, s = u.distanceTo(v) < 1, d = h && !s, r = w.map((t) => t.type === "move" && t.target ? new M.Vector3(t.target.x, t.target.y, t.target.z) : null).filter((t) => t !== null), i = u.clone();
178
- e !== void 0 && (i.y += e);
179
- const f = l.length > 0 ? l : [v], a = d ? [i, ...f, ...r] : r.length > 0 ? [i, ...r] : [];
180
- return /* @__PURE__ */ k("group", { children: [
181
- d && /* @__PURE__ */ m("group", { position: v, children: /* @__PURE__ */ m(O, {}) }),
182
- a.length > 1 && /* @__PURE__ */ m(
183
- D,
184
- {
185
- points: a,
186
- color: p >= 0 ? "#00ff88" : "#ffaa00"
187
- }
188
- ),
189
- w.map((t, o) => {
190
- if (t.type === "move" && t.target) {
191
- const b = o === p, E = o < p;
192
- return /* @__PURE__ */ m(
193
- "group",
194
- {
195
- position: [t.target.x, t.target.y, t.target.z],
196
- children: /* @__PURE__ */ k("mesh", { children: [
197
- /* @__PURE__ */ m("sphereGeometry", { args: [0.1, 8, 8] }),
198
- /* @__PURE__ */ m(
199
- "meshStandardMaterial",
200
- {
201
- color: E ? "#888" : b ? "#ff4444" : "#ffaa00",
202
- transparent: !0,
203
- opacity: E ? 0.3 : 0.8
204
- }
205
- )
206
- ] })
207
- },
208
- `action-${o}`
209
- );
210
- }
211
- return null;
212
- })
213
- ] });
214
- }
215
- function ee({ clickerOptions: e }) {
216
- const { onClick: g } = q(e), u = (c) => {
217
- c.stopPropagation();
218
- const { cameraOption: l, setCameraOption: n } = S.getState();
219
- if (l?.focus) {
220
- n({ focus: !1 });
221
- return;
222
- }
223
- g(c);
224
- };
225
- return /* @__PURE__ */ k(
226
- "mesh",
227
- {
228
- position: [0, 0, 0],
229
- rotation: [-Math.PI / 2, 0, 0],
230
- onPointerDown: u,
231
- visible: !0,
232
- userData: { intangible: !0 },
233
- children: [
234
- /* @__PURE__ */ m("planeGeometry", { args: [1e3, 1e3] }),
235
- /* @__PURE__ */ m("meshBasicMaterial", { transparent: !0, opacity: 0 })
236
- ]
237
- }
238
- );
239
- }
240
- function te({ props: e, children: g }) {
241
- const u = S((i) => i.mode), { gameStates: c } = U(), l = S((i) => i.rideable), n = S((i) => i.urls), v = T((i) => i.isInEditMode()), h = _();
242
- if (J(), v || !u || !c || !l || !n || u.type === "character" && !n.characterUrl || u.type === "vehicle" && !n.vehicleUrl || u.type === "airplane" && !n.airplaneUrl) return null;
243
- const { canRide: y, isRiding: w, currentRideable: p } = c, R = p?.id, s = x(
244
- () => (R ? l[R]?.offset : void 0) ?? Y(),
245
- [R, l]
246
- ), r = (() => {
247
- const i = e.rigidBodyRef ?? h.rigidBodyRef, f = e.outerGroupRef ?? h.outerGroupRef, a = e.innerGroupRef ?? h.innerGroupRef, t = e.colliderRef ?? h.colliderRef, o = {
248
- isActive: !0,
249
- componentType: u.type,
250
- enableRiding: y,
251
- isRiderOn: w,
252
- offset: s,
253
- ref: i,
254
- outerGroupRef: f,
255
- innerGroupRef: a,
256
- colliderRef: t,
257
- parts: (e.parts || []).filter((G) => !!G.url).map((G) => ({ ...G, url: G.url })),
258
- ...e.onAnimate ? { onAnimate: e.onAnimate } : {},
259
- ...e.onFrame ? { onFrame: e.onFrame } : {},
260
- ...e.onReady ? { onReady: e.onReady } : {},
261
- ...e.onDestroy ? { onDestroy: e.onDestroy } : {},
262
- ...e.onDestory ? { onDestory: e.onDestory } : {},
263
- ...typeof e.baseColor == "string" && e.baseColor.trim().length > 0 ? { baseColor: e.baseColor } : {},
264
- ...Array.isArray(e.excludeBaseNodes) && e.excludeBaseNodes.length > 0 ? { excludeBaseNodes: e.excludeBaseNodes } : {},
265
- ...e.rigidBodyProps ? { rigidBodyProps: e.rigidBodyProps } : {},
266
- ...e.controllerOptions ? { controllerOptions: e.controllerOptions } : {},
267
- ...e.groundRay ? { groundRay: e.groundRay } : {},
268
- ...e.colliderSize ? { colliderSize: e.colliderSize } : {},
269
- ...e.position ? { position: e.position } : {},
270
- ...e.rotation ? { rotation: e.rotation } : {},
271
- ...e.scale ? { scale: e.scale } : {}
272
- }, b = w && u.type !== "character" ? n.ridingUrl : void 0, E = typeof b == "string" && b.length > 0 ? { ridingUrl: b } : {};
273
- switch (u.type) {
274
- case "character":
275
- return {
276
- ...o,
277
- url: n.characterUrl || ""
278
- };
279
- case "vehicle":
280
- return {
281
- ...o,
282
- ...E,
283
- url: n.vehicleUrl || "",
284
- wheelUrl: n.wheelUrl
285
- };
286
- case "airplane":
287
- return {
288
- ...o,
289
- ...E,
290
- url: n.airplaneUrl || ""
291
- };
292
- default:
293
- return {
294
- ...o,
295
- url: n.characterUrl || ""
296
- };
297
- }
298
- })();
299
- return u.type === "character" && c.isRiding ? null : /* @__PURE__ */ m(W, { ...r, children: g });
300
- }
301
- function ue(e) {
302
- const { clickToMove: g, children: u, clickerOptions: c, ...l } = e, n = l.colliderSize?.height ? l.colliderSize.height * 0.5 : void 0, v = {
303
- ...c ?? {},
304
- ...c?.agentRadius === void 0 && l.colliderSize?.radius !== void 0 ? { agentRadius: l.colliderSize.radius } : {}
305
- };
306
- return /* @__PURE__ */ m(te, { props: l, children: /* @__PURE__ */ k(B, { children: [
307
- g && /* @__PURE__ */ k(B, { children: [
308
- /* @__PURE__ */ m(ee, { clickerOptions: v }),
309
- /* @__PURE__ */ m(Q, { ...n !== void 0 ? { lineStartHeight: n } : {} })
310
- ] }),
311
- u
312
- ] }) });
313
- }
314
- export {
315
- ue as C,
316
- ee as G,
317
- Q as a,
318
- X as b,
319
- J as u
320
- };