gaesup-world 1.0.20 → 1.0.21
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.
- package/dist/blueprints-editor.cjs +1 -1
- package/dist/blueprints-editor.js +3 -3
- package/dist/blueprints.js +3 -3
- package/dist/core/interactions/components/Clicker/index.d.ts +4 -1
- package/dist/editor.js +3 -3
- package/dist/{index-FQgcO1SU.js → index-BUQXtHf3.js} +5 -6
- package/dist/index-CHoKlv0U.cjs +1 -0
- package/dist/{index-B0hl0p1Z.js → index-D0Rz5_-J.js} +5 -6
- package/dist/{index-B_IfvQvL.js → index-DShLht0Q.js} +1 -1
- package/dist/{index-B2hAamTj.js → index-Drmv86ws.js} +2 -2
- package/dist/index-HxpKt5rO.js +320 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +13 -13
- package/dist/network.cjs +1 -1
- package/dist/network.js +4 -4
- package/dist/{plugin--mlpG6-U.js → plugin-BEJHB06f.js} +35 -36
- package/dist/runtime.js +7 -7
- package/dist/{useSpawnFromBlueprint-TYxXKoM5.js → useSpawnFromBlueprint-BxRHlpvL.js} +4 -5
- package/package.json +1 -1
- package/dist/index-BKqky34r.js +0 -319
- package/dist/index-C-4Q2Amk.cjs +0 -1
- package/dist/{index-C-wwuvo7.js → index-C5agFfBe.js} +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-aIQsqI3Q.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-2zKBYTYo.cjs"),R=require("./index-C-4Q2Amk.cjs"),V=require("./index-D1hpjfAw.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-aIQsqI3Q.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-2zKBYTYo.cjs"),R=require("./index-CHoKlv0U.cjs"),V=require("./index-D1hpjfAw.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e, Fragment as K } from "react/jsx-runtime";
|
|
2
2
|
import { useState as g, useEffect as F, useMemo as M, useCallback as Q } from "react";
|
|
3
|
-
import { u as W, b as D } from "./useSpawnFromBlueprint-
|
|
3
|
+
import { u as W, b as D } from "./useSpawnFromBlueprint-BxRHlpvL.js";
|
|
4
4
|
import { Environment as H, Grid as q } from "@react-three/drei";
|
|
5
5
|
import { Canvas as X } from "@react-three/fiber";
|
|
6
6
|
import { Physics as ee, euler as te, RigidBody as ie } from "@react-three/rapier";
|
|
7
7
|
import * as re from "three";
|
|
8
8
|
import { u as J } from "./gaesupStore-DTu0tYBp.js";
|
|
9
|
-
import { u as ne, C as ae, a as se, G as oe } from "./index-
|
|
10
|
-
import { C as le } from "./index-
|
|
9
|
+
import { u as ne, C as ae, a as se, G as oe } from "./index-HxpKt5rO.js";
|
|
10
|
+
import { C as le } from "./index-D0Rz5_-J.js";
|
|
11
11
|
const w = (t) => t?.type === "character";
|
|
12
12
|
function ce({ blueprint: t }) {
|
|
13
13
|
const d = J((n) => n.setUrls), b = J((n) => n.setCameraOption), r = J((n) => n.setMode), h = J((n) => n.mode), [l, u] = g(20), c = w(t) ? t.controls?.clickToMove ?? !0 : !1, C = w(t) ? t.controls?.enableKeyboard ?? !0 : !1, O = w(t) ? t.controls?.enableMouse ?? !0 : !1;
|
package/dist/blueprints.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as x } from "./useSpawnFromBlueprint-
|
|
2
|
-
import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-
|
|
1
|
+
import { b as x } from "./useSpawnFromBlueprint-BxRHlpvL.js";
|
|
2
|
+
import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-BxRHlpvL.js";
|
|
3
3
|
import { jsx as C } from "react/jsx-runtime";
|
|
4
4
|
import { useMemo as z, useRef as m, useEffect as M } from "react";
|
|
5
5
|
import { RigidBody as b } from "@react-three/rapier";
|
|
@@ -674,7 +674,7 @@ class u {
|
|
|
674
674
|
);
|
|
675
675
|
}
|
|
676
676
|
async createFromId(e, t) {
|
|
677
|
-
const { blueprintRegistry: s } = await import("./useSpawnFromBlueprint-
|
|
677
|
+
const { blueprintRegistry: s } = await import("./useSpawnFromBlueprint-BxRHlpvL.js").then((n) => n.r), r = s.get(e);
|
|
678
678
|
return r ? this.createEntity(r, t) : (console.error(`Blueprint not found: ${e}`), null);
|
|
679
679
|
}
|
|
680
680
|
createFromDefinition(e, t) {
|
package/dist/editor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import { g as _ } from "./plugin
|
|
3
|
-
import { A, s as C, y as G, w as U, F as f, z as N, D as O, I as v, H as y, K as W, B as x, x as w, v as F, U as b, J as h, C as M, _ as z, X as H, $ as k, a0 as K, a1 as V, ac as j, ad as J, ae as q, a8 as X, af as $, ag as Q, ah as Y, ai as Z, aj as aa, ak as ea, al as ia, am as ta, an as ra, ao as sa, E as na, a as oa, b as la, t as ua, aq as da, ap as ca, G as _a, q as Ea, N as Ta, a6 as Sa, M as Ia, P as La, R as ma, j as Da, k as pa, l as Ba, m as ga, p as Ra, n as Pa, o as Aa, S as Ca, T as Ga, V as Ua, W as fa, O as Na, a4 as Oa, as as va, aa as ya, a3 as Wa, at as xa, ab as wa, a2 as Fa, Z as ba, Q as ha, c as Ma, d as za, h as Ha, ax as ka, a9 as Ka, ar as Va, aD as ja, az as Ja, e as qa, aE as Xa, Y as $a, au as Qa, a7 as Ya, L as Za, ay as ae, i as ee, av as ie, r as te, aA as re, aB as se, aF as ne, aw as oe, a5 as le, aC as ue, u as de, f as ce } from "./plugin
|
|
2
|
+
import { g as _ } from "./plugin-BEJHB06f.js";
|
|
3
|
+
import { A, s as C, y as G, w as U, F as f, z as N, D as O, I as v, H as y, K as W, B as x, x as w, v as F, U as b, J as h, C as M, _ as z, X as H, $ as k, a0 as K, a1 as V, ac as j, ad as J, ae as q, a8 as X, af as $, ag as Q, ah as Y, ai as Z, aj as aa, ak as ea, al as ia, am as ta, an as ra, ao as sa, E as na, a as oa, b as la, t as ua, aq as da, ap as ca, G as _a, q as Ea, N as Ta, a6 as Sa, M as Ia, P as La, R as ma, j as Da, k as pa, l as Ba, m as ga, p as Ra, n as Pa, o as Aa, S as Ca, T as Ga, V as Ua, W as fa, O as Na, a4 as Oa, as as va, aa as ya, a3 as Wa, at as xa, ab as wa, a2 as Fa, Z as ba, Q as ha, c as Ma, d as za, h as Ha, ax as ka, a9 as Ka, ar as Va, aD as ja, az as Ja, e as qa, aE as Xa, Y as $a, au as Qa, a7 as Ya, L as Za, ay as ae, i as ee, av as ie, r as te, aA as re, aB as se, aF as ne, aw as oe, a5 as le, aC as ue, u as de, f as ce } from "./plugin-BEJHB06f.js";
|
|
4
4
|
import { useMemo as E } from "react";
|
|
5
5
|
import { useFrame as T } from "@react-three/fiber";
|
|
6
6
|
import * as d from "three";
|
|
7
|
-
import { Q as Ee, S as Te, R as Se, O as Ie, L as Le, P as me, N as De, M as pe, I as Be, K as ge, H as Re, J as Pe, a as Ae, b as Ce, e as Ge, d as Ue, f as fe, n as Ne, o as Oe, c as ve, r as ye, g as We, h as xe, i as we, j as Fe, k as be, l as he, m as Me, F as ze, p as He, q as ke, s as Ke, u as Ve, t as je, v as Je, w as qe, x as Xe, y as $e, z as Qe, G as Ye, A as Ze, B as ai, C as ei, D as ii, E as ti } from "./index-
|
|
7
|
+
import { Q as Ee, S as Te, R as Se, O as Ie, L as Le, P as me, N as De, M as pe, I as Be, K as ge, H as Re, J as Pe, a as Ae, b as Ce, e as Ge, d as Ue, f as fe, n as Ne, o as Oe, c as ve, r as ye, g as We, h as xe, i as we, j as Fe, k as be, l as he, m as Me, F as ze, p as He, q as ke, s as Ke, u as Ve, t as je, v as Je, w as qe, x as Xe, y as $e, z as Qe, G as Ye, A as Ze, B as ai, C as ei, D as ii, E as ti } from "./index-C5agFfBe.js";
|
|
8
8
|
import { H as t, P as o } from "./gaesupStore-DTu0tYBp.js";
|
|
9
9
|
import { C as si, H as ni, c as oi, l as li, v as ui, a as di } from "./loader-C3ZwumCe.js";
|
|
10
10
|
var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, r = (e, a, i, l) => {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsxs as R, jsx as k } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as P, useMemo as T, useEffect as B } from "react";
|
|
3
3
|
import * as S from "three";
|
|
4
|
-
import { U as A } from "./index-
|
|
5
|
-
import "reflect-metadata";
|
|
4
|
+
import { U as A } from "./index-C5agFfBe.js";
|
|
6
5
|
import { A as E, R as I, M as z } from "./gaesupStore-DTu0tYBp.js";
|
|
7
6
|
const O = "gaesup-save", _ = 1, w = "slots";
|
|
8
7
|
function L() {
|
|
@@ -183,7 +182,7 @@ function U() {
|
|
|
183
182
|
const e = typeof indexedDB < "u" ? new V() : new W();
|
|
184
183
|
return new j({ adapter: e, defaultSlot: "main", currentVersion: 1 });
|
|
185
184
|
}
|
|
186
|
-
function
|
|
185
|
+
function Y() {
|
|
187
186
|
return M || (M = U()), M;
|
|
188
187
|
}
|
|
189
188
|
var X = Object.defineProperty, F = Object.getOwnPropertyDescriptor, G = (e, t, r) => t in e ? X(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Z = (e, t, r, s) => {
|
|
@@ -336,7 +335,7 @@ u = Z([
|
|
|
336
335
|
I("minimap"),
|
|
337
336
|
z({ autoStart: !1 })
|
|
338
337
|
], u);
|
|
339
|
-
function
|
|
338
|
+
function Q({
|
|
340
339
|
type: e = "normal",
|
|
341
340
|
text: t,
|
|
342
341
|
position: r,
|
|
@@ -399,7 +398,7 @@ export {
|
|
|
399
398
|
W as L,
|
|
400
399
|
u as M,
|
|
401
400
|
j as S,
|
|
402
|
-
|
|
401
|
+
Q as W,
|
|
403
402
|
U as c,
|
|
404
|
-
|
|
403
|
+
Y as g
|
|
405
404
|
};
|
|
@@ -0,0 +1 @@
|
|
|
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,9 +1,8 @@
|
|
|
1
1
|
import { useRef as h, useEffect as b, useCallback as A, useMemo as ut, useLayoutEffect as J } from "react";
|
|
2
2
|
import { useFrame as ct, useThree as mt } from "@react-three/fiber";
|
|
3
3
|
import * as a from "three";
|
|
4
|
-
import { V as dt, G as ht, W as gt } from "./index-
|
|
4
|
+
import { V as dt, G as ht, W as gt } from "./index-C5agFfBe.js";
|
|
5
5
|
import { H, P as G, C as pt, M as vt, u as U } from "./gaesupStore-DTu0tYBp.js";
|
|
6
|
-
import "reflect-metadata";
|
|
7
6
|
import yt from "mitt";
|
|
8
7
|
var wt = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, K = (e, o, t, i) => {
|
|
9
8
|
for (var n = Ct(o, t), r = e.length - 1, c; r >= 0; r--)
|
|
@@ -688,10 +687,10 @@ function Zt() {
|
|
|
688
687
|
system: F
|
|
689
688
|
};
|
|
690
689
|
}
|
|
691
|
-
function
|
|
690
|
+
function Kt() {
|
|
692
691
|
return Zt(), null;
|
|
693
692
|
}
|
|
694
|
-
function
|
|
693
|
+
function $t() {
|
|
695
694
|
const e = h(null), o = h(null), t = h(null), i = h(null);
|
|
696
695
|
return {
|
|
697
696
|
outerGroupRef: e,
|
|
@@ -701,7 +700,7 @@ function Jt() {
|
|
|
701
700
|
};
|
|
702
701
|
}
|
|
703
702
|
export {
|
|
704
|
-
|
|
703
|
+
Kt as C,
|
|
705
704
|
j as a,
|
|
706
|
-
|
|
705
|
+
$t as u
|
|
707
706
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect as k, useRef as I, useState as P, useCallback as W, useMemo as Y } from "react";
|
|
2
|
-
import { g as $, S as tt } from "./index-
|
|
2
|
+
import { g as $, S as tt } from "./index-BUQXtHf3.js";
|
|
3
3
|
import { c as et, a as nt, f as rt } from "./runtimeFilter-CS35UPHd.js";
|
|
4
4
|
import { u as st } from "./assetStore-mAClONjR.js";
|
|
5
5
|
import { c as ot } from "./snapshot-OExk53wq.js";
|
|
@@ -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-
|
|
6
|
-
import { C as y } from "./index-
|
|
5
|
+
import { T as x } from "./index-C5agFfBe.js";
|
|
6
|
+
import { C as y } from "./index-D0Rz5_-J.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(() => {
|
|
@@ -0,0 +1,320 @@
|
|
|
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
|
+
};
|