gaesup-world 1.0.15 → 1.0.17
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 +2 -2
- package/dist/editor.js +2 -2
- package/dist/{index-N6HSFbPb.js → index-B7w-rMkc.js} +1 -1
- package/dist/{index-DEqnKUlv.js → index-BTPsN-6q.js} +1 -1
- package/dist/{index-hIdHLcEu.js → index-CZ6IwKxC.js} +4 -5
- package/dist/index-DO8uHvUt.cjs +1 -0
- package/dist/index-Dq05wJMi.js +321 -0
- package/dist/{index-CsKqKct1.js → index-DwWvqzkp.js} +4 -5
- package/dist/index.cjs +1 -1
- package/dist/index.js +11 -11
- package/dist/network.cjs +1 -1
- package/dist/network.js +2 -2
- package/dist/{plugin-Bt4zuKQx.js → plugin-kPQP113O.js} +34 -35
- package/dist/runtime.js +5 -5
- package/package.json +1 -1
- package/dist/index-9qQ_uAUZ.cjs +0 -1
- package/dist/index-DBLoviZI.js +0 -319
|
@@ -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-9qQ_uAUZ.cjs"),V=require("./index-B0ymJw1j.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-DO8uHvUt.cjs"),V=require("./index-B0ymJw1j.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;
|
|
@@ -6,8 +6,8 @@ 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-Dq05wJMi.js";
|
|
10
|
+
import { C as le } from "./index-DwWvqzkp.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/editor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-kPQP113O.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-kPQP113O.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";
|
|
@@ -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-CZ6IwKxC.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";
|
|
@@ -3,7 +3,7 @@ import { useRef as d, useMemo as f, useEffect as v, useLayoutEffect as h, Suspen
|
|
|
3
3
|
import { useThree as U, useFrame as D } from "@react-three/fiber";
|
|
4
4
|
import { u as l } from "./gaesupStore-DTu0tYBp.js";
|
|
5
5
|
import { T as x } from "./index-BcoQ669j.js";
|
|
6
|
-
import { C as y } from "./index-
|
|
6
|
+
import { C as y } from "./index-DwWvqzkp.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(() => {
|
|
@@ -2,7 +2,6 @@ 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
4
|
import { U as A } from "./index-BcoQ669j.js";
|
|
5
|
-
import "reflect-metadata";
|
|
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 o=require("react/jsx-runtime"),h=require("react"),B=require("three"),I=require("@react-three/drei"),S=require("./index-KD0DiwVP.cjs"),O=require("@react-three/fiber"),E=require("./gaesupStore-2zKBYTYo.cjs"),T=require("@react-three/rapier"),D=require("./index-B0ymJw1j.cjs");function z(e){const u=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(u,a,c.get?c:{enumerable:!0,get:()=>e[a]})}}return u.default=e,Object.freeze(u)}const P=z(B),U=()=>({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 j(e={}){const{updateInterval:u=0,entityId:a}=e,c=h.useRef(null);c.current||(c.current=U());const[,g]=h.useState(0),n=h.useRef(0),x=h.useRef(0),m=h.useRef({x:0,y:0,z:0}),y=h.useRef(void 0),b=h.useRef(null),{activeState:R,gameStates:v}=S.useStateSystem(),d=f=>{if(a)return a;if(y.current)return y.current;const t=f.getActiveEntities();return y.current=t[0],y.current};return h.useEffect(()=>{y.current=void 0,b.current=E.BridgeFactory.getOrCreate("motion");const f=b.current;if(!f)return;const t=f.subscribe((p,r)=>{const l=d(f);if(!l||r!==l)return;const s=performance.now();if(x.current=s,u>0&&s-n.current<u)return;n.current=s;const i=c.current;i.position.copy(p.position),i.velocity.copy(p.velocity),i.rotation.copy(p.rotation),i.isMoving=p.isMoving,i.isGrounded=p.isGrounded,i.speed=p.speed,i.height=2,g(w=>w+1)});return()=>{t()}},[a,u]),O.useFrame(()=>{const f=performance.now();if(u>0&&f-n.current<u)return;const t=c.current,p=b.current,r=l=>{const s=m.current,i=l.x-s.x,w=l.y-s.y,k=l.z-s.z;return i*i+w*w+k*k>1e-6?(s.x=l.x,s.y=l.y,s.z=l.z,!0):!1};if(p){const l=d(p);if(!(f-x.current<16)&&l){const i=p.snapshot(l);if(i){t.position.copy(i.position),t.velocity.copy(i.velocity),t.rotation.copy(i.rotation),t.isMoving=i.isMoving,t.isGrounded=i.isGrounded,t.speed=i.speed,t.height=2,n.current=f,r(t.position)&&g(w=>w+1);return}}}R?.position&&(t.position.copy(R.position),R.velocity?t.velocity.copy(R.velocity):t.velocity.set(0,0,0),R.euler?t.rotation.copy(R.euler):t.rotation.set(0,0,0),t.isMoving=v?.isMoving||!1,t.isGrounded=v?.isOnTheGround||!1,t.speed=R.velocity?R.velocity.length():0,t.height=2,n.current=f,r(t.position)&&g(l=>l+1))}),c.current}const q={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},G=(e=!0,u=!0,a)=>{const c=E.useGaesupStore(d=>d.automation?.queue.isRunning),g=E.useGaesupStore(d=>d.stopAutomation),n=E.useGaesupStore(d=>d.interaction?.isActive??!0),x=S.useBuildingStore(d=>d.isInEditMode()),m=S.useInputBackend(),y=h.useRef(new Set),b=h.useMemo(()=>({...q}),[]),R=h.useCallback((d,f)=>{if(!n)return!1;try{return m.updateKeyboard({[d]:f}),f?y.current.add(d):y.current.delete(d),!0}catch(t){return console.error("Error updating keyboard state:",t),!1}},[m,n]),v=h.useCallback(()=>{y.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 h.useEffect(()=>{(!n||x)&&v()},[v,n,x]),h.useEffect(()=>{const d=(r,l)=>{const s=b[r.code];if(!s)return;if(!n||x){l&&r.preventDefault(),v();return}const i=y.current.has(r.code);l&&!i?(y.current.add(r.code),r.code==="Space"&&r.preventDefault(),u&&c&&(s==="forward"||s==="backward"||s==="leftward"||s==="rightward")&&(g(),m.updateMouse({isActive:!1,shouldRun:!1})),m.updateKeyboard({[s]:!0})):!l&&i&&(y.current.delete(r.code),m.updateKeyboard({[s]:!1}))},f=r=>d(r,!0),t=r=>d(r,!1),p=()=>document.hidden&&v();return window.addEventListener("keydown",f),window.addEventListener("keyup",t),document.addEventListener("visibilitychange",p),()=>{window.removeEventListener("keydown",f),window.removeEventListener("keyup",t),document.removeEventListener("visibilitychange",p)}},[b,u,g,c,v,n,x,m]),{pressedKeys:Array.from(y.current),pushKey:R,isKeyPressed:d=>y.current.has(d),clearAllKeys:v}},M=h.memo(({points:e,color:u})=>e.length<2?null:o.jsx(I.Line,{points:e,color:u,lineWidth:2,dashed:!1}));M.displayName="PathLine";const C=h.memo(()=>o.jsxs("group",{children:[o.jsxs("mesh",{children:[o.jsx("sphereGeometry",{args:[.2,16,16]}),o.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),o.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[o.jsx("ringGeometry",{args:[.3,.5,8]}),o.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:P.DoubleSide})]})]}));C.displayName="TargetMarker";function K(){const e=E.useGaesupStore(r=>r.automation),{position:u}=j(),{mouse:a}=S.useInteractionSystem(),[c,g]=h.useState(()=>[...S.getClickNavigationRoute()]);h.useEffect(()=>S.subscribeClickNavigationRoute(()=>{g([...S.getClickNavigationRoute()])}),[]);const n=a?.target||new P.Vector3,x=a?.isActive||!1,m=e?.queue||{actions:[],currentIndex:0},y=m.actions||[],b=m.currentIndex||0,v=u.distanceTo(n)<1,d=x&&!v,f=y.map(r=>r.type==="move"&&r.target?new P.Vector3(r.target.x,r.target.y,r.target.z):null).filter(r=>r!==null),t=c.length>0?c:[n],p=d?[u,...t,...f]:f.length>0?[u,...f]:[];return o.jsxs("group",{children:[d&&o.jsx("group",{position:n,children:o.jsx(C,{})}),p.length>1&&o.jsx(M,{points:p,color:b>=0?"#00ff88":"#ffaa00"}),y.map((r,l)=>{if(r.type==="move"&&r.target){const s=l===b,i=l<b;return o.jsx("group",{position:[r.target.x,r.target.y,r.target.z],children:o.jsxs("mesh",{children:[o.jsx("sphereGeometry",{args:[.1,8,8]}),o.jsx("meshStandardMaterial",{color:i?"#888":s?"#ff4444":"#ffaa00",transparent:!0,opacity:i?.3:.8})]})},`action-${l}`)}return null})]})}function A({clickerOptions:e}){const{onClick:u}=S.useClicker(e),a=c=>{c.stopPropagation();const{cameraOption:g,setCameraOption:n}=E.useGaesupStore.getState();if(g?.focus){n({focus:!1});return}u(c)};return o.jsxs("mesh",{position:[0,0,0],rotation:[-Math.PI/2,0,0],onPointerDown:a,visible:!0,userData:{intangible:!0},children:[o.jsx("planeGeometry",{args:[1e3,1e3]}),o.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function N({props:e,children:u}){const a=E.useGaesupStore(t=>t.mode),{gameStates:c}=S.useStateSystem(),g=E.useGaesupStore(t=>t.rideable),n=E.useGaesupStore(t=>t.urls),x=S.useBuildingStore(t=>t.isInEditMode()),m=D.useGenericRefs();G();const y=c?.currentRideable?.id,b=h.useMemo(()=>(y&&g?g[y]?.offset:void 0)??T.vec3(),[y,g]);if(x||!a||!c||!g||!n||a.type==="character"&&!n.characterUrl||a.type==="vehicle"&&!n.vehicleUrl||a.type==="airplane"&&!n.airplaneUrl)return null;const{canRide:R,isRiding:v}=c,f=(()=>{const t=e.rigidBodyRef??m.rigidBodyRef,p=e.outerGroupRef??m.outerGroupRef,r=e.innerGroupRef??m.innerGroupRef,l=e.colliderRef??m.colliderRef,s={isActive:!0,componentType:a.type,enableRiding:R,isRiderOn:v,offset:b,ref:t,outerGroupRef:p,innerGroupRef:r,colliderRef:l,parts:(e.parts||[]).filter(k=>!!k.url).map(k=>({...k,url:k.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}:{},...e.currentAnimation?{currentAnimation:e.currentAnimation}:{}},i=v&&a.type!=="character"?n.ridingUrl:void 0,w=typeof i=="string"&&i.length>0?{ridingUrl:i}:{};switch(a.type){case"character":return{...s,url:n.characterUrl||""};case"vehicle":return{...s,...w,url:n.vehicleUrl||"",wheelUrl:n.wheelUrl};case"airplane":return{...s,...w,url:n.airplaneUrl||""};default:return{...s,url:n.characterUrl||""}}})();return a.type==="character"&&c.isRiding?null:o.jsx(S.PhysicsEntity,{...f,children:u})}function F(e){const{clickToMove:u,children:a,clickerOptions:c,...g}=e,n={...c??{},...c?.agentRadius===void 0&&g.colliderSize?.radius!==void 0?{agentRadius:g.colliderSize.radius}:{}};return o.jsxs(o.Fragment,{children:[o.jsx(N,{props:g,children:a}),u&&o.jsxs(o.Fragment,{children:[o.jsx(A,{clickerOptions:n}),o.jsx(K,{})]})]})}exports.Clicker=K;exports.ControllerWrapper=F;exports.GroundClicker=A;exports.useKeyboard=G;exports.usePlayerPosition=j;
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { jsx as h, jsxs as E, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as S, useState as I, useEffect as A, useMemo as C, useCallback as K, memo as x } from "react";
|
|
3
|
+
import * as M from "three";
|
|
4
|
+
import { Line as O } from "@react-three/drei";
|
|
5
|
+
import { V as U, G as T, W as L, X as N, Y as B, Z as F, U as V, _ as q } from "./index-BcoQ669j.js";
|
|
6
|
+
import { useFrame as W } from "@react-three/fiber";
|
|
7
|
+
import { B as Z, u as k } from "./gaesupStore-DTu0tYBp.js";
|
|
8
|
+
import { vec3 as j } from "@react-three/rapier";
|
|
9
|
+
import { u as Y } from "./index-DwWvqzkp.js";
|
|
10
|
+
const _ = () => ({
|
|
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 H(e = {}) {
|
|
21
|
+
const { updateInterval: d = 0, entityId: f } = e, c = S(null);
|
|
22
|
+
c.current || (c.current = _());
|
|
23
|
+
const [, y] = I(0), n = S(0), w = S(0), g = S({ x: 0, y: 0, z: 0 }), u = S(void 0), R = S(null), { activeState: v, gameStates: p } = U(), a = (l) => {
|
|
24
|
+
if (f) return f;
|
|
25
|
+
if (u.current) return u.current;
|
|
26
|
+
const t = l.getActiveEntities();
|
|
27
|
+
return u.current = t[0], u.current;
|
|
28
|
+
};
|
|
29
|
+
return A(() => {
|
|
30
|
+
u.current = void 0, R.current = Z.getOrCreate("motion");
|
|
31
|
+
const l = R.current;
|
|
32
|
+
if (!l) return;
|
|
33
|
+
const t = l.subscribe((m, r) => {
|
|
34
|
+
const s = a(l);
|
|
35
|
+
if (!s || r !== s) return;
|
|
36
|
+
const i = performance.now();
|
|
37
|
+
if (w.current = i, d > 0 && i - n.current < d) return;
|
|
38
|
+
n.current = i;
|
|
39
|
+
const o = c.current;
|
|
40
|
+
o.position.copy(m.position), o.velocity.copy(m.velocity), o.rotation.copy(m.rotation), o.isMoving = m.isMoving, o.isGrounded = m.isGrounded, o.speed = m.speed, o.height = 2, y((b) => b + 1);
|
|
41
|
+
});
|
|
42
|
+
return () => {
|
|
43
|
+
t();
|
|
44
|
+
};
|
|
45
|
+
}, [f, d]), W(() => {
|
|
46
|
+
const l = performance.now();
|
|
47
|
+
if (d > 0 && l - n.current < d) return;
|
|
48
|
+
const t = c.current, m = R.current, r = (s) => {
|
|
49
|
+
const i = g.current, o = s.x - i.x, b = s.y - i.y, P = s.z - i.z;
|
|
50
|
+
return o * o + b * b + P * P > 1e-6 ? (i.x = s.x, i.y = s.y, i.z = s.z, !0) : !1;
|
|
51
|
+
};
|
|
52
|
+
if (m) {
|
|
53
|
+
const s = a(m);
|
|
54
|
+
if (!(l - w.current < 16) && s) {
|
|
55
|
+
const o = m.snapshot(s);
|
|
56
|
+
if (o) {
|
|
57
|
+
t.position.copy(o.position), t.velocity.copy(o.velocity), t.rotation.copy(o.rotation), t.isMoving = o.isMoving, t.isGrounded = o.isGrounded, t.speed = o.speed, t.height = 2, n.current = l, r(t.position) && y((b) => b + 1);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
v?.position && (t.position.copy(v.position), v.velocity ? t.velocity.copy(v.velocity) : t.velocity.set(0, 0, 0), v.euler ? t.rotation.copy(v.euler) : t.rotation.set(0, 0, 0), t.isMoving = p?.isMoving || !1, t.isGrounded = p?.isOnTheGround || !1, t.speed = v.velocity ? v.velocity.length() : 0, t.height = 2, n.current = l, r(t.position) && y((s) => s + 1));
|
|
63
|
+
}), c.current;
|
|
64
|
+
}
|
|
65
|
+
const X = {
|
|
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
|
+
}, $ = (e = !0, d = !0, f) => {
|
|
78
|
+
const c = k((a) => a.automation?.queue.isRunning), y = k((a) => a.stopAutomation), n = k((a) => a.interaction?.isActive ?? !0), w = T((a) => a.isInEditMode()), g = L(), u = S(/* @__PURE__ */ new Set()), R = C(() => ({ ...X }), []), v = K(
|
|
79
|
+
(a, l) => {
|
|
80
|
+
if (!n) return !1;
|
|
81
|
+
try {
|
|
82
|
+
return g.updateKeyboard({ [a]: l }), l ? u.current.add(a) : u.current.delete(a), !0;
|
|
83
|
+
} catch (t) {
|
|
84
|
+
return console.error("Error updating keyboard state:", t), !1;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
[g, n]
|
|
88
|
+
), p = K(() => {
|
|
89
|
+
u.current.clear(), g.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
|
+
}, [g]);
|
|
103
|
+
return A(() => {
|
|
104
|
+
(!n || w) && p();
|
|
105
|
+
}, [p, n, w]), A(() => {
|
|
106
|
+
const a = (r, s) => {
|
|
107
|
+
const i = R[r.code];
|
|
108
|
+
if (!i) return;
|
|
109
|
+
if (!n || w) {
|
|
110
|
+
s && r.preventDefault(), p();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const o = u.current.has(r.code);
|
|
114
|
+
s && !o ? (u.current.add(r.code), r.code === "Space" && r.preventDefault(), d && c && (i === "forward" || i === "backward" || i === "leftward" || i === "rightward") && (y(), g.updateMouse({ isActive: !1, shouldRun: !1 })), g.updateKeyboard({ [i]: !0 })) : !s && o && (u.current.delete(r.code), g.updateKeyboard({ [i]: !1 }));
|
|
115
|
+
}, l = (r) => a(r, !0), t = (r) => a(r, !1), m = () => document.hidden && p();
|
|
116
|
+
return window.addEventListener("keydown", l), window.addEventListener("keyup", t), document.addEventListener("visibilitychange", m), () => {
|
|
117
|
+
window.removeEventListener("keydown", l), window.removeEventListener("keyup", t), document.removeEventListener("visibilitychange", m);
|
|
118
|
+
};
|
|
119
|
+
}, [
|
|
120
|
+
R,
|
|
121
|
+
d,
|
|
122
|
+
y,
|
|
123
|
+
c,
|
|
124
|
+
p,
|
|
125
|
+
n,
|
|
126
|
+
w,
|
|
127
|
+
g
|
|
128
|
+
]), {
|
|
129
|
+
pressedKeys: Array.from(u.current),
|
|
130
|
+
pushKey: v,
|
|
131
|
+
isKeyPressed: (a) => u.current.has(a),
|
|
132
|
+
clearAllKeys: p
|
|
133
|
+
};
|
|
134
|
+
}, z = x(({ points: e, color: d }) => e.length < 2 ? null : /* @__PURE__ */ h(
|
|
135
|
+
O,
|
|
136
|
+
{
|
|
137
|
+
points: e,
|
|
138
|
+
color: d,
|
|
139
|
+
lineWidth: 2,
|
|
140
|
+
dashed: !1
|
|
141
|
+
}
|
|
142
|
+
));
|
|
143
|
+
z.displayName = "PathLine";
|
|
144
|
+
const D = x(() => /* @__PURE__ */ E("group", { children: [
|
|
145
|
+
/* @__PURE__ */ E("mesh", { children: [
|
|
146
|
+
/* @__PURE__ */ h("sphereGeometry", { args: [0.2, 16, 16] }),
|
|
147
|
+
/* @__PURE__ */ h(
|
|
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__ */ E("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
|
|
159
|
+
/* @__PURE__ */ h("ringGeometry", { args: [0.3, 0.5, 8] }),
|
|
160
|
+
/* @__PURE__ */ h(
|
|
161
|
+
"meshStandardMaterial",
|
|
162
|
+
{
|
|
163
|
+
color: "#00ff88",
|
|
164
|
+
transparent: !0,
|
|
165
|
+
opacity: 0.6,
|
|
166
|
+
side: M.DoubleSide
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] })
|
|
170
|
+
] }));
|
|
171
|
+
D.displayName = "TargetMarker";
|
|
172
|
+
function J() {
|
|
173
|
+
const e = k((r) => r.automation), { position: d } = H(), { mouse: f } = N(), [c, y] = I(() => [...B()]);
|
|
174
|
+
A(() => F(() => {
|
|
175
|
+
y([...B()]);
|
|
176
|
+
}), []);
|
|
177
|
+
const n = f?.target || new M.Vector3(), w = f?.isActive || !1, g = e?.queue || { actions: [], currentIndex: 0 }, u = g.actions || [], R = g.currentIndex || 0, p = d.distanceTo(n) < 1, a = w && !p, l = u.map((r) => r.type === "move" && r.target ? new M.Vector3(r.target.x, r.target.y, r.target.z) : null).filter((r) => r !== null), t = c.length > 0 ? c : [n], m = a ? [d, ...t, ...l] : l.length > 0 ? [d, ...l] : [];
|
|
178
|
+
return /* @__PURE__ */ E("group", { children: [
|
|
179
|
+
a && /* @__PURE__ */ h("group", { position: n, children: /* @__PURE__ */ h(D, {}) }),
|
|
180
|
+
m.length > 1 && /* @__PURE__ */ h(
|
|
181
|
+
z,
|
|
182
|
+
{
|
|
183
|
+
points: m,
|
|
184
|
+
color: R >= 0 ? "#00ff88" : "#ffaa00"
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
u.map((r, s) => {
|
|
188
|
+
if (r.type === "move" && r.target) {
|
|
189
|
+
const i = s === R, o = s < R;
|
|
190
|
+
return /* @__PURE__ */ h(
|
|
191
|
+
"group",
|
|
192
|
+
{
|
|
193
|
+
position: [r.target.x, r.target.y, r.target.z],
|
|
194
|
+
children: /* @__PURE__ */ E("mesh", { children: [
|
|
195
|
+
/* @__PURE__ */ h("sphereGeometry", { args: [0.1, 8, 8] }),
|
|
196
|
+
/* @__PURE__ */ h(
|
|
197
|
+
"meshStandardMaterial",
|
|
198
|
+
{
|
|
199
|
+
color: o ? "#888" : i ? "#ff4444" : "#ffaa00",
|
|
200
|
+
transparent: !0,
|
|
201
|
+
opacity: o ? 0.3 : 0.8
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
] })
|
|
205
|
+
},
|
|
206
|
+
`action-${s}`
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
return null;
|
|
210
|
+
})
|
|
211
|
+
] });
|
|
212
|
+
}
|
|
213
|
+
function Q({ clickerOptions: e }) {
|
|
214
|
+
const { onClick: d } = V(e), f = (c) => {
|
|
215
|
+
c.stopPropagation();
|
|
216
|
+
const { cameraOption: y, setCameraOption: n } = k.getState();
|
|
217
|
+
if (y?.focus) {
|
|
218
|
+
n({ focus: !1 });
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
d(c);
|
|
222
|
+
};
|
|
223
|
+
return /* @__PURE__ */ E(
|
|
224
|
+
"mesh",
|
|
225
|
+
{
|
|
226
|
+
position: [0, 0, 0],
|
|
227
|
+
rotation: [-Math.PI / 2, 0, 0],
|
|
228
|
+
onPointerDown: f,
|
|
229
|
+
visible: !0,
|
|
230
|
+
userData: { intangible: !0 },
|
|
231
|
+
children: [
|
|
232
|
+
/* @__PURE__ */ h("planeGeometry", { args: [1e3, 1e3] }),
|
|
233
|
+
/* @__PURE__ */ h("meshBasicMaterial", { transparent: !0, opacity: 0 })
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
function ee({ props: e, children: d }) {
|
|
239
|
+
const f = k((t) => t.mode), { gameStates: c } = U(), y = k((t) => t.rideable), n = k((t) => t.urls), w = T((t) => t.isInEditMode()), g = Y();
|
|
240
|
+
$();
|
|
241
|
+
const u = c?.currentRideable?.id, R = C(
|
|
242
|
+
() => (u && y ? y[u]?.offset : void 0) ?? j(),
|
|
243
|
+
[u, y]
|
|
244
|
+
);
|
|
245
|
+
if (w || !f || !c || !y || !n || f.type === "character" && !n.characterUrl || f.type === "vehicle" && !n.vehicleUrl || f.type === "airplane" && !n.airplaneUrl) return null;
|
|
246
|
+
const { canRide: v, isRiding: p } = c, l = (() => {
|
|
247
|
+
const t = e.rigidBodyRef ?? g.rigidBodyRef, m = e.outerGroupRef ?? g.outerGroupRef, r = e.innerGroupRef ?? g.innerGroupRef, s = e.colliderRef ?? g.colliderRef, i = {
|
|
248
|
+
isActive: !0,
|
|
249
|
+
componentType: f.type,
|
|
250
|
+
enableRiding: v,
|
|
251
|
+
isRiderOn: p,
|
|
252
|
+
offset: R,
|
|
253
|
+
ref: t,
|
|
254
|
+
outerGroupRef: m,
|
|
255
|
+
innerGroupRef: r,
|
|
256
|
+
colliderRef: s,
|
|
257
|
+
parts: (e.parts || []).filter((P) => !!P.url).map((P) => ({ ...P, url: P.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
|
+
...e.currentAnimation ? { currentAnimation: e.currentAnimation } : {}
|
|
273
|
+
}, o = p && f.type !== "character" ? n.ridingUrl : void 0, b = typeof o == "string" && o.length > 0 ? { ridingUrl: o } : {};
|
|
274
|
+
switch (f.type) {
|
|
275
|
+
case "character":
|
|
276
|
+
return {
|
|
277
|
+
...i,
|
|
278
|
+
url: n.characterUrl || ""
|
|
279
|
+
};
|
|
280
|
+
case "vehicle":
|
|
281
|
+
return {
|
|
282
|
+
...i,
|
|
283
|
+
...b,
|
|
284
|
+
url: n.vehicleUrl || "",
|
|
285
|
+
wheelUrl: n.wheelUrl
|
|
286
|
+
};
|
|
287
|
+
case "airplane":
|
|
288
|
+
return {
|
|
289
|
+
...i,
|
|
290
|
+
...b,
|
|
291
|
+
url: n.airplaneUrl || ""
|
|
292
|
+
};
|
|
293
|
+
default:
|
|
294
|
+
return {
|
|
295
|
+
...i,
|
|
296
|
+
url: n.characterUrl || ""
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
})();
|
|
300
|
+
return f.type === "character" && c.isRiding ? null : /* @__PURE__ */ h(q, { ...l, children: d });
|
|
301
|
+
}
|
|
302
|
+
function le(e) {
|
|
303
|
+
const { clickToMove: d, children: f, clickerOptions: c, ...y } = e, n = {
|
|
304
|
+
...c ?? {},
|
|
305
|
+
...c?.agentRadius === void 0 && y.colliderSize?.radius !== void 0 ? { agentRadius: y.colliderSize.radius } : {}
|
|
306
|
+
};
|
|
307
|
+
return /* @__PURE__ */ E(G, { children: [
|
|
308
|
+
/* @__PURE__ */ h(ee, { props: y, children: f }),
|
|
309
|
+
d && /* @__PURE__ */ E(G, { children: [
|
|
310
|
+
/* @__PURE__ */ h(Q, { clickerOptions: n }),
|
|
311
|
+
/* @__PURE__ */ h(J, {})
|
|
312
|
+
] })
|
|
313
|
+
] });
|
|
314
|
+
}
|
|
315
|
+
export {
|
|
316
|
+
le as C,
|
|
317
|
+
Q as G,
|
|
318
|
+
J as a,
|
|
319
|
+
H as b,
|
|
320
|
+
$ as u
|
|
321
|
+
};
|
|
@@ -3,7 +3,6 @@ import { useFrame as ct, useThree as mt } from "@react-three/fiber";
|
|
|
3
3
|
import * as a from "three";
|
|
4
4
|
import { V as dt, G as ht, W as gt } from "./index-BcoQ669j.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
|
};
|