gaesup-world 1.0.23 → 1.0.24
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 +4 -4
- package/dist/blueprints.cjs +1 -1
- package/dist/blueprints.js +3 -3
- package/dist/core/motions/core/movement/DirectionComponent.d.ts +1 -0
- package/dist/core/navigation/ClickNavigationRoute.d.ts +2 -0
- package/dist/core/navigation/NavigationSystem.d.ts +5 -0
- package/dist/editor.cjs +1 -1
- package/dist/editor.js +4 -4
- package/dist/gaesupStore-CRQ-tcIz.cjs +1 -0
- package/dist/{gaesupStore-DTu0tYBp.js → gaesupStore-x2iiDzsY.js} +18 -25
- package/dist/{index-C7uc7Whg.cjs → index-B-41eb_r.cjs} +1 -1
- package/dist/{index-3WAK67Ha.js → index-BDf7Aizn.js} +3 -3
- package/dist/{index-B0oz8u47.js → index-BK5ayvXP.js} +1 -1
- package/dist/{index-TNaPJQpb.cjs → index-BKWqlQ52.cjs} +1 -1
- package/dist/{index-De3ev_jU.cjs → index-BUmGmDsI.cjs} +1 -1
- package/dist/index-Bb6WkHKt.cjs +1 -0
- package/dist/index-Bv6acWL8.cjs +1 -0
- package/dist/{index-DGifA0e6.js → index-Df7dmsEw.js} +6 -7
- package/dist/{index-C5agFfBe.js → index-DmHVuHAr.js} +1626 -1540
- package/dist/index-d8X2EBuK.js +290 -0
- package/dist/{index-DRLvJF_k.js → index-jFtghT-b.js} +13 -14
- package/dist/{index-RPpT5kHy.cjs → index-tM2v7Sp8.cjs} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1698 -1615
- package/dist/network.cjs +1 -1
- package/dist/network.js +4 -4
- package/dist/{plugin-B4lSjyeZ.cjs → plugin-CS9Elxgw.cjs} +2 -2
- package/dist/{plugin-BFzSydfr.js → plugin-CkD2KlIV.js} +40 -39
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +8 -8
- package/dist/{useSpawnFromBlueprint-aIQsqI3Q.cjs → useSpawnFromBlueprint-CAz_a7R2.cjs} +1 -1
- package/dist/{useSpawnFromBlueprint-BxRHlpvL.js → useSpawnFromBlueprint-C_IzLBK5.js} +1 -1
- package/package.json +1 -1
- package/dist/gaesupStore-2zKBYTYo.cjs +0 -1
- package/dist/index-B3DY2LIR.js +0 -320
- package/dist/index-CJj-Z7Jr.cjs +0 -1
- package/dist/index-Ctehfr0N.cjs +0 -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-Ctehfr0N.cjs"),V=require("./index-TNaPJQpb.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-CAz_a7R2.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-CRQ-tcIz.cjs"),R=require("./index-Bv6acWL8.cjs"),V=require("./index-BKWqlQ52.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-C_IzLBK5.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
|
-
import { u as J } from "./gaesupStore-
|
|
9
|
-
import { u as ne, C as ae, a as se, G as oe } from "./index-
|
|
10
|
-
import { C as le } from "./index-
|
|
8
|
+
import { u as J } from "./gaesupStore-x2iiDzsY.js";
|
|
9
|
+
import { u as ne, C as ae, a as se, G as oe } from "./index-d8X2EBuK.js";
|
|
10
|
+
import { C as le } from "./index-jFtghT-b.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.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./useSpawnFromBlueprint-aIQsqI3Q.cjs"),S=require("react/jsx-runtime"),u=require("react"),P=require("@react-three/rapier"),j=require("three");function E(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const f=E(j);class a{factories=new Map;static instance=null;static getInstance(){return a.instance||(a.instance=new a),a.instance}register(e,t){this.factories.set(e,t)}create(e){const t=this.factories.get(e.type);if(!t)return console.warn(`Component factory not found for type: ${e.type}`),null;const s=t(e.properties);return s.enabled=e.enabled,s}getFactory(e){return this.factories.get(e)}getAllTypes(){return Array.from(this.factories.keys())}clear(){this.factories.clear()}}class b{type;enabled=!0;context=null;constructor(e){this.type=e}initialize(e){this.context=e,this.onInitialize()}update(e){this.enabled&&(this.context=e,this.onUpdate(e))}dispose(){this.onDispose(),this.context=null}}class w{id;blueprint;components=[];context;constructor(e,t,s,r){this.id=e.id,this.blueprint=e,this.context={rigidBodyRef:t,deltaTime:0,entityId:e.id,...s?{innerGroupRef:s}:{},...r?{outerGroupRef:r}:{}},this.createComponents()}createComponents(){const e=a.getInstance();for(const t of this.blueprint.components){const s=e.create(t);s&&(s.initialize(this.context),this.components.push(s))}}update(e){this.context.deltaTime=e;for(const t of this.components)t.enabled&&t.update(this.context)}getComponent(e){return this.components.find(t=>t.type===e)}getComponents(e){return this.components.filter(t=>t.type===e)}addComponent(e){e.initialize(this.context),this.components.push(e)}removeComponent(e){const t=this.components.findIndex(s=>s.type===e);if(t!==-1){const s=this.components[t];s&&s.dispose(),this.components.splice(t,1)}}dispose(){for(const e of this.components)e.dispose();this.components=[]}getId(){return this.id}getBlueprint(){return this.blueprint}}class T{static blueprints=new Map;static async load(e){try{const s=await(await fetch(e)).json();return this.blueprints.set(s.id,s),s}catch(t){throw console.error(`Failed to load blueprint from ${e}:`,t),t}}static loadFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return this.blueprints.set(t.id,t),t}static get(e){return this.blueprints.get(e)}static getAll(){return Array.from(this.blueprints.values())}static clear(){this.blueprints.clear()}}class F extends b{gravity;maxFallSpeed;force;constructor(e={}){super("GravityForce"),this.gravity=e.gravity??-9.81,this.maxFallSpeed=e.maxFallSpeed??50,this.force=new f.Vector3,this.enabled=e.enabled??!0}onInitialize(){this.force.set(0,this.gravity,0)}onUpdate(e){e.rigidBodyRef.current&&this.applyForce(e.rigidBodyRef.current,e.deltaTime)}onDispose(){this.force.set(0,0,0)}getForce(){return this.force.clone()}applyForce(e,t){if(e.linvel().y>-this.maxFallSpeed){const r=this.gravity*t*60;e.applyImpulse({x:0,y:r,z:0},!0)}}setGravity(e){this.gravity=e,this.force.y=e}getGravity(){return this.gravity}}const g=(i,e)=>typeof i=="number"?i:e,v=(i,e)=>typeof i=="string"?i:e,B=(i,e)=>typeof i=="string"||Array.isArray(i)&&i.every(t=>typeof t=="string")?i:e,h=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),D=i=>({...typeof i.gravity=="number"?{gravity:i.gravity}:{},...typeof i.maxFallSpeed=="number"?{maxFallSpeed:i.maxFallSpeed}:{},...typeof i.enabled=="boolean"?{enabled:i.enabled}:{}}),I=i=>({walkSpeed:g(i.walkSpeed,5),runSpeed:g(i.runSpeed,10),jumpHeight:g(i.jumpHeight,2),airControl:g(i.airControl,.2)}),k=i=>{const e=i.animations,t=h(e)&&h(e.jump)?e.jump:{},s=p=>{if(!(!h(e)||!h(e[p])))return Object.fromEntries(Object.entries(e[p]).filter(([,o])=>typeof o=="string"||Array.isArray(o)&&o.every(l=>typeof l=="string")))},r=s("combat"),n=s("special");return{animations:{idle:B(h(e)?e.idle:void 0,"idle"),walk:B(h(e)?e.walk:void 0,"walk"),run:B(h(e)?e.run:void 0,"run"),jump:{start:v(t.start,"jump_start"),loop:v(t.loop,"jump_loop"),land:v(t.land,"jump_land")},...r?{combat:r}:{},...n?{special:n}:{}},defaultAnimation:v(i.defaultAnimation,"idle")}};class G{type="CharacterAnimation";enabled=!0;props;currentAnimation;animationMixer;actions=new Map;constructor(e){this.props=e,this.currentAnimation=e.defaultAnimation}initialize(e){e.innerGroupRef?.current&&(this.animationMixer=new f.AnimationMixer(e.innerGroupRef.current),this.setupAnimations(e))}setupAnimations(e){const t=window.__loadedAnimations??{};Object.entries(this.props.animations).forEach(([s,r])=>{if(typeof r=="string"&&t[r]){const n=this.animationMixer.clipAction(t[r]);this.actions.set(s,n)}}),this.playAnimation(this.currentAnimation)}playAnimation(e){this.actions.forEach(s=>s.stop());const t=this.actions.get(e);t&&(t.reset().play(),this.currentAnimation=e)}update(e){if(!this.animationMixer)return;this.animationMixer.update(e.deltaTime);const t=e.rigidBodyRef.current;if(!t)return;const s=t.linvel(),r=Math.sqrt(s.x**2+s.z**2);let n="idle";s.y>.1?n="jump":r>6?n="run":r>.5&&(n="walk"),n!==this.currentAnimation&&this.playAnimation(n)}dispose(){this.actions.forEach(e=>e.stop()),this.actions.clear(),this.animationMixer?.stopAllAction()}}class O{type="CharacterMovement";enabled=!0;props;velocity=new f.Vector3;isGrounded=!1;constructor(e){this.props=e}initialize(e){e.rigidBodyRef.current&&e.rigidBodyRef.current.setEnabledRotations(!1,!1,!1,!1)}update(e){if(!e.rigidBodyRef.current)return;const t=e.rigidBodyRef.current,s=t.linvel(),r=window.__keyboardState??{},n=window.__mouseState,p=(r.rightward?1:0)-(r.leftward?1:0),o=(r.backward?1:0)-(r.forward?1:0),l=r.shift?this.props.runSpeed:this.props.walkSpeed;if(p!==0||o!==0){const c=new f.Vector3(p,0,o).normalize();c.multiplyScalar(l),n?.angle!==void 0&&c.applyAxisAngle(new f.Vector3(0,1,0),n.angle),this.velocity.x=c.x,this.velocity.z=c.z}else this.velocity.x*=.9,this.velocity.z*=.9;r.space&&this.isGrounded?this.velocity.y=Math.sqrt(2*9.81*this.props.jumpHeight):this.velocity.y=s.y,t.setLinvel(this.velocity,!0)}dispose(){this.velocity.set(0,0,0)}}function _(){const i=a.getInstance();i.register("GravityForce",e=>new F(D(e))),i.register("CharacterMovement",e=>new O(I(e))),i.register("CharacterAnimation",e=>new G(k(e))),i.register("CharacterPhysics",e=>({type:"CharacterPhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("CharacterStats",e=>({type:"CharacterStats",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("CharacterBehavior",e=>({type:"CharacterBehavior",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("VehicleMovement",e=>({type:"VehicleMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("VehiclePhysics",e=>({type:"VehiclePhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("VehicleSeats",e=>({type:"VehicleSeats",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("VehicleAnimation",e=>({type:"VehicleAnimation",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("AirplaneMovement",e=>({type:"AirplaneMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("AirplanePhysics",e=>({type:"AirplanePhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("AirplaneSeats",e=>({type:"AirplaneSeats",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("AirplaneAnimation",e=>({type:"AirplaneAnimation",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e}))}class M{convert(e){const t={id:e.id,name:e.name,type:e.type,components:[],...e.metadata?{metadata:e.metadata}:{}};switch(e.type){case"character":return this.convertCharacter(e,t);case"vehicle":return this.convertVehicle(e,t);case"airplane":return this.convertAirplane(e,t);default:return t}}convertCharacter(e,t){const s=[];return s.push({type:"CharacterPhysics",enabled:!0,properties:{mass:e.physics.mass,height:e.physics.height,radius:e.physics.radius,jumpForce:e.physics.jumpForce,moveSpeed:e.physics.moveSpeed,runSpeed:e.physics.runSpeed,airControl:e.physics.airControl}}),s.push({type:"CharacterMovement",enabled:!0,properties:{walkSpeed:e.physics.moveSpeed,runSpeed:e.physics.runSpeed,jumpHeight:e.physics.jumpForce/e.physics.mass,airControl:e.physics.airControl}}),s.push({type:"CharacterAnimation",enabled:!0,properties:{animations:e.animations,defaultAnimation:"idle"}}),e.stats&&s.push({type:"CharacterStats",enabled:!0,properties:e.stats}),e.behaviors&&s.push({type:"CharacterBehavior",enabled:!0,properties:{type:e.behaviors.type,data:e.behaviors.data}}),{...t,components:s,physics:{mass:e.physics.mass,friction:.5,restitution:0,linearDamping:4,angularDamping:10}}}convertVehicle(e,t){const s=[];return s.push({type:"VehiclePhysics",enabled:!0,properties:{mass:e.physics.mass,maxSpeed:e.physics.maxSpeed,acceleration:e.physics.acceleration,braking:e.physics.braking,turning:e.physics.turning,...e.physics.suspension?{suspension:e.physics.suspension}:{}}}),s.push({type:"VehicleMovement",enabled:!0,properties:{maxSpeed:e.physics.maxSpeed,acceleration:e.physics.acceleration,braking:e.physics.braking,turning:e.physics.turning}}),e.seats&&s.push({type:"VehicleSeats",enabled:!0,properties:{seats:e.seats}}),e.animations&&s.push({type:"VehicleAnimation",enabled:!0,properties:{animations:e.animations}}),{...t,components:s,physics:{mass:e.physics.mass,friction:.8,restitution:.2,linearDamping:.5,angularDamping:1}}}convertAirplane(e,t){const s=[];return s.push({type:"AirplanePhysics",enabled:!0,properties:{mass:e.physics.mass,maxSpeed:e.physics.maxSpeed,acceleration:e.physics.acceleration,turning:e.physics.turning,lift:e.physics.lift,drag:e.physics.drag}}),s.push({type:"AirplaneMovement",enabled:!0,properties:{maxSpeed:e.physics.maxSpeed,acceleration:e.physics.acceleration,turning:e.physics.turning,lift:e.physics.lift,drag:e.physics.drag}}),e.seats&&s.push({type:"AirplaneSeats",enabled:!0,properties:{seats:e.seats}}),e.animations&&s.push({type:"AirplaneAnimation",enabled:!0,properties:{animations:e.animations}}),{...t,components:s,physics:{mass:e.physics.mass,friction:.1,restitution:.1,linearDamping:.2,angularDamping:.5}}}convertToJSON(e){const t=this.convert(e);return JSON.stringify(t,null,2)}validateBlueprint(e){const t=[];switch(e.id||t.push("Blueprint must have an id"),e.name||t.push("Blueprint must have a name"),e.type||t.push("Blueprint must have a type"),e.version||t.push("Blueprint must have a version"),e.type){case"character":const s=e;s.physics||t.push("Character blueprint must have physics"),s.animations||t.push("Character blueprint must have animations"),s.stats||t.push("Character blueprint must have stats");break;case"vehicle":const r=e;r.physics||t.push("Vehicle blueprint must have physics"),r.seats||t.push("Vehicle blueprint must have seats");break;case"airplane":const n=e;n.physics||t.push("Airplane blueprint must have physics"),n.seats||t.push("Airplane blueprint must have seats");break}return{valid:t.length===0,errors:t}}}class y{static instance;converter;componentRegistry;constructor(){this.converter=new M,this.componentRegistry=a.getInstance(),this.initializeDefaultFactories()}static getInstance(){return y.instance||(y.instance=new y),y.instance}initializeDefaultFactories(){this.registerCharacterFactories(),this.registerVehicleFactories(),this.registerAirplaneFactories()}registerCharacterFactories(){this.componentRegistry.register("CharacterMovement",e=>({type:"CharacterMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),this.componentRegistry.register("CharacterAnimation",e=>({type:"CharacterAnimation",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),this.componentRegistry.register("CharacterPhysics",e=>({type:"CharacterPhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e}))}registerVehicleFactories(){this.componentRegistry.register("VehicleMovement",e=>({type:"VehicleMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),this.componentRegistry.register("VehiclePhysics",e=>({type:"VehiclePhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e}))}registerAirplaneFactories(){this.componentRegistry.register("AirplaneMovement",e=>({type:"AirplaneMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),this.componentRegistry.register("AirplanePhysics",e=>({type:"AirplanePhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e}))}createEntity(e,t){const s=this.converter.convert(e);return new w(s,t.rigidBodyRef,t.innerGroupRef,t.outerGroupRef)}async createFromId(e,t){const{blueprintRegistry:s}=await Promise.resolve().then(()=>require("./useSpawnFromBlueprint-aIQsqI3Q.cjs")).then(n=>n.registry),r=s.get(e);return r?this.createEntity(r,t):(console.error(`Blueprint not found: ${e}`),null)}createFromDefinition(e,t){return new w(e,t.rigidBodyRef,t.innerGroupRef,t.outerGroupRef)}registerComponentFactory(e,t){this.componentRegistry.register(e,t)}getAvailableComponentTypes(){return this.componentRegistry.getAllTypes()}}function A(i){return u.useMemo(()=>d.blueprintRegistry.get(i),[i])}function N(i){const e=A(i);if(e?.type==="character")return e}function L(i){const e=A(i);if(e?.type==="vehicle")return e}function q(i){const e=A(i);if(e?.type==="airplane")return e}function U(i){return u.useMemo(()=>d.blueprintRegistry.getByType(i),[i])}function H({blueprint:i,blueprintId:e,position:t=[0,0,0],rotation:s=[0,0,0],scale:r=[1,1,1],onSpawn:n,onDestroy:p,children:o}){const l=u.useRef(null),c=u.useRef(null),C=u.useRef(null),R=u.useRef(null);u.useEffect(()=>{const x=y.getInstance();return(async()=>{let m=null;i?m=x.createEntity(i,{rigidBodyRef:l,innerGroupRef:c,outerGroupRef:C,position:t,rotation:s,scale:r}):e&&(m=await x.createFromId(e,{rigidBodyRef:l,innerGroupRef:c,outerGroupRef:C,position:t,rotation:s,scale:r})),m&&(R.current=m,n?.(m))})(),()=>{R.current&&(R.current.dispose(),p?.())}},[i,e]);const z=i?.type||"character",V=J(z);return S.jsx(P.RigidBody,{ref:l,type:"dynamic",position:t,rotation:s,scale:r,...V,children:S.jsx("group",{ref:C,children:S.jsx("group",{ref:c,children:o})})})}function J(i){switch(i){case"character":return{mass:1,friction:.5,restitution:0,linearDamping:4,angularDamping:10,enabledRotations:[!1,!1,!1]};case"vehicle":return{mass:150,friction:.8,restitution:.2,linearDamping:.5,angularDamping:1};case"airplane":return{mass:500,friction:.1,restitution:.1,linearDamping:.2,angularDamping:.5};default:return{mass:1,friction:.5,restitution:.5}}}exports.BASIC_KART_BLUEPRINT=d.BASIC_KART_BLUEPRINT;exports.FIRE_MAGE_BLUEPRINT=d.FIRE_MAGE_BLUEPRINT;exports.WARRIOR_BLUEPRINT=d.WARRIOR_BLUEPRINT;exports.blueprintRegistry=d.blueprintRegistry;exports.useSpawnFromBlueprint=d.useSpawnFromBlueprint;exports.BaseComponent=b;exports.BlueprintConverter=M;exports.BlueprintEntity=w;exports.BlueprintFactory=y;exports.BlueprintLoader=T;exports.BlueprintSpawner=H;exports.ComponentRegistry=a;exports.GravityForceComponent=F;exports.registerDefaultComponents=_;exports.useAirplaneBlueprint=q;exports.useBlueprint=A;exports.useBlueprintsByType=U;exports.useCharacterBlueprint=N;exports.useVehicleBlueprint=L;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./useSpawnFromBlueprint-CAz_a7R2.cjs"),S=require("react/jsx-runtime"),u=require("react"),P=require("@react-three/rapier"),j=require("three");function E(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const f=E(j);class a{factories=new Map;static instance=null;static getInstance(){return a.instance||(a.instance=new a),a.instance}register(e,t){this.factories.set(e,t)}create(e){const t=this.factories.get(e.type);if(!t)return console.warn(`Component factory not found for type: ${e.type}`),null;const s=t(e.properties);return s.enabled=e.enabled,s}getFactory(e){return this.factories.get(e)}getAllTypes(){return Array.from(this.factories.keys())}clear(){this.factories.clear()}}class b{type;enabled=!0;context=null;constructor(e){this.type=e}initialize(e){this.context=e,this.onInitialize()}update(e){this.enabled&&(this.context=e,this.onUpdate(e))}dispose(){this.onDispose(),this.context=null}}class w{id;blueprint;components=[];context;constructor(e,t,s,r){this.id=e.id,this.blueprint=e,this.context={rigidBodyRef:t,deltaTime:0,entityId:e.id,...s?{innerGroupRef:s}:{},...r?{outerGroupRef:r}:{}},this.createComponents()}createComponents(){const e=a.getInstance();for(const t of this.blueprint.components){const s=e.create(t);s&&(s.initialize(this.context),this.components.push(s))}}update(e){this.context.deltaTime=e;for(const t of this.components)t.enabled&&t.update(this.context)}getComponent(e){return this.components.find(t=>t.type===e)}getComponents(e){return this.components.filter(t=>t.type===e)}addComponent(e){e.initialize(this.context),this.components.push(e)}removeComponent(e){const t=this.components.findIndex(s=>s.type===e);if(t!==-1){const s=this.components[t];s&&s.dispose(),this.components.splice(t,1)}}dispose(){for(const e of this.components)e.dispose();this.components=[]}getId(){return this.id}getBlueprint(){return this.blueprint}}class T{static blueprints=new Map;static async load(e){try{const s=await(await fetch(e)).json();return this.blueprints.set(s.id,s),s}catch(t){throw console.error(`Failed to load blueprint from ${e}:`,t),t}}static loadFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return this.blueprints.set(t.id,t),t}static get(e){return this.blueprints.get(e)}static getAll(){return Array.from(this.blueprints.values())}static clear(){this.blueprints.clear()}}class F extends b{gravity;maxFallSpeed;force;constructor(e={}){super("GravityForce"),this.gravity=e.gravity??-9.81,this.maxFallSpeed=e.maxFallSpeed??50,this.force=new f.Vector3,this.enabled=e.enabled??!0}onInitialize(){this.force.set(0,this.gravity,0)}onUpdate(e){e.rigidBodyRef.current&&this.applyForce(e.rigidBodyRef.current,e.deltaTime)}onDispose(){this.force.set(0,0,0)}getForce(){return this.force.clone()}applyForce(e,t){if(e.linvel().y>-this.maxFallSpeed){const r=this.gravity*t*60;e.applyImpulse({x:0,y:r,z:0},!0)}}setGravity(e){this.gravity=e,this.force.y=e}getGravity(){return this.gravity}}const g=(i,e)=>typeof i=="number"?i:e,v=(i,e)=>typeof i=="string"?i:e,B=(i,e)=>typeof i=="string"||Array.isArray(i)&&i.every(t=>typeof t=="string")?i:e,h=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),D=i=>({...typeof i.gravity=="number"?{gravity:i.gravity}:{},...typeof i.maxFallSpeed=="number"?{maxFallSpeed:i.maxFallSpeed}:{},...typeof i.enabled=="boolean"?{enabled:i.enabled}:{}}),I=i=>({walkSpeed:g(i.walkSpeed,5),runSpeed:g(i.runSpeed,10),jumpHeight:g(i.jumpHeight,2),airControl:g(i.airControl,.2)}),k=i=>{const e=i.animations,t=h(e)&&h(e.jump)?e.jump:{},s=p=>{if(!(!h(e)||!h(e[p])))return Object.fromEntries(Object.entries(e[p]).filter(([,o])=>typeof o=="string"||Array.isArray(o)&&o.every(l=>typeof l=="string")))},r=s("combat"),n=s("special");return{animations:{idle:B(h(e)?e.idle:void 0,"idle"),walk:B(h(e)?e.walk:void 0,"walk"),run:B(h(e)?e.run:void 0,"run"),jump:{start:v(t.start,"jump_start"),loop:v(t.loop,"jump_loop"),land:v(t.land,"jump_land")},...r?{combat:r}:{},...n?{special:n}:{}},defaultAnimation:v(i.defaultAnimation,"idle")}};class G{type="CharacterAnimation";enabled=!0;props;currentAnimation;animationMixer;actions=new Map;constructor(e){this.props=e,this.currentAnimation=e.defaultAnimation}initialize(e){e.innerGroupRef?.current&&(this.animationMixer=new f.AnimationMixer(e.innerGroupRef.current),this.setupAnimations(e))}setupAnimations(e){const t=window.__loadedAnimations??{};Object.entries(this.props.animations).forEach(([s,r])=>{if(typeof r=="string"&&t[r]){const n=this.animationMixer.clipAction(t[r]);this.actions.set(s,n)}}),this.playAnimation(this.currentAnimation)}playAnimation(e){this.actions.forEach(s=>s.stop());const t=this.actions.get(e);t&&(t.reset().play(),this.currentAnimation=e)}update(e){if(!this.animationMixer)return;this.animationMixer.update(e.deltaTime);const t=e.rigidBodyRef.current;if(!t)return;const s=t.linvel(),r=Math.sqrt(s.x**2+s.z**2);let n="idle";s.y>.1?n="jump":r>6?n="run":r>.5&&(n="walk"),n!==this.currentAnimation&&this.playAnimation(n)}dispose(){this.actions.forEach(e=>e.stop()),this.actions.clear(),this.animationMixer?.stopAllAction()}}class O{type="CharacterMovement";enabled=!0;props;velocity=new f.Vector3;isGrounded=!1;constructor(e){this.props=e}initialize(e){e.rigidBodyRef.current&&e.rigidBodyRef.current.setEnabledRotations(!1,!1,!1,!1)}update(e){if(!e.rigidBodyRef.current)return;const t=e.rigidBodyRef.current,s=t.linvel(),r=window.__keyboardState??{},n=window.__mouseState,p=(r.rightward?1:0)-(r.leftward?1:0),o=(r.backward?1:0)-(r.forward?1:0),l=r.shift?this.props.runSpeed:this.props.walkSpeed;if(p!==0||o!==0){const c=new f.Vector3(p,0,o).normalize();c.multiplyScalar(l),n?.angle!==void 0&&c.applyAxisAngle(new f.Vector3(0,1,0),n.angle),this.velocity.x=c.x,this.velocity.z=c.z}else this.velocity.x*=.9,this.velocity.z*=.9;r.space&&this.isGrounded?this.velocity.y=Math.sqrt(2*9.81*this.props.jumpHeight):this.velocity.y=s.y,t.setLinvel(this.velocity,!0)}dispose(){this.velocity.set(0,0,0)}}function _(){const i=a.getInstance();i.register("GravityForce",e=>new F(D(e))),i.register("CharacterMovement",e=>new O(I(e))),i.register("CharacterAnimation",e=>new G(k(e))),i.register("CharacterPhysics",e=>({type:"CharacterPhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("CharacterStats",e=>({type:"CharacterStats",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("CharacterBehavior",e=>({type:"CharacterBehavior",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("VehicleMovement",e=>({type:"VehicleMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("VehiclePhysics",e=>({type:"VehiclePhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("VehicleSeats",e=>({type:"VehicleSeats",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("VehicleAnimation",e=>({type:"VehicleAnimation",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("AirplaneMovement",e=>({type:"AirplaneMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("AirplanePhysics",e=>({type:"AirplanePhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("AirplaneSeats",e=>({type:"AirplaneSeats",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),i.register("AirplaneAnimation",e=>({type:"AirplaneAnimation",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e}))}class M{convert(e){const t={id:e.id,name:e.name,type:e.type,components:[],...e.metadata?{metadata:e.metadata}:{}};switch(e.type){case"character":return this.convertCharacter(e,t);case"vehicle":return this.convertVehicle(e,t);case"airplane":return this.convertAirplane(e,t);default:return t}}convertCharacter(e,t){const s=[];return s.push({type:"CharacterPhysics",enabled:!0,properties:{mass:e.physics.mass,height:e.physics.height,radius:e.physics.radius,jumpForce:e.physics.jumpForce,moveSpeed:e.physics.moveSpeed,runSpeed:e.physics.runSpeed,airControl:e.physics.airControl}}),s.push({type:"CharacterMovement",enabled:!0,properties:{walkSpeed:e.physics.moveSpeed,runSpeed:e.physics.runSpeed,jumpHeight:e.physics.jumpForce/e.physics.mass,airControl:e.physics.airControl}}),s.push({type:"CharacterAnimation",enabled:!0,properties:{animations:e.animations,defaultAnimation:"idle"}}),e.stats&&s.push({type:"CharacterStats",enabled:!0,properties:e.stats}),e.behaviors&&s.push({type:"CharacterBehavior",enabled:!0,properties:{type:e.behaviors.type,data:e.behaviors.data}}),{...t,components:s,physics:{mass:e.physics.mass,friction:.5,restitution:0,linearDamping:4,angularDamping:10}}}convertVehicle(e,t){const s=[];return s.push({type:"VehiclePhysics",enabled:!0,properties:{mass:e.physics.mass,maxSpeed:e.physics.maxSpeed,acceleration:e.physics.acceleration,braking:e.physics.braking,turning:e.physics.turning,...e.physics.suspension?{suspension:e.physics.suspension}:{}}}),s.push({type:"VehicleMovement",enabled:!0,properties:{maxSpeed:e.physics.maxSpeed,acceleration:e.physics.acceleration,braking:e.physics.braking,turning:e.physics.turning}}),e.seats&&s.push({type:"VehicleSeats",enabled:!0,properties:{seats:e.seats}}),e.animations&&s.push({type:"VehicleAnimation",enabled:!0,properties:{animations:e.animations}}),{...t,components:s,physics:{mass:e.physics.mass,friction:.8,restitution:.2,linearDamping:.5,angularDamping:1}}}convertAirplane(e,t){const s=[];return s.push({type:"AirplanePhysics",enabled:!0,properties:{mass:e.physics.mass,maxSpeed:e.physics.maxSpeed,acceleration:e.physics.acceleration,turning:e.physics.turning,lift:e.physics.lift,drag:e.physics.drag}}),s.push({type:"AirplaneMovement",enabled:!0,properties:{maxSpeed:e.physics.maxSpeed,acceleration:e.physics.acceleration,turning:e.physics.turning,lift:e.physics.lift,drag:e.physics.drag}}),e.seats&&s.push({type:"AirplaneSeats",enabled:!0,properties:{seats:e.seats}}),e.animations&&s.push({type:"AirplaneAnimation",enabled:!0,properties:{animations:e.animations}}),{...t,components:s,physics:{mass:e.physics.mass,friction:.1,restitution:.1,linearDamping:.2,angularDamping:.5}}}convertToJSON(e){const t=this.convert(e);return JSON.stringify(t,null,2)}validateBlueprint(e){const t=[];switch(e.id||t.push("Blueprint must have an id"),e.name||t.push("Blueprint must have a name"),e.type||t.push("Blueprint must have a type"),e.version||t.push("Blueprint must have a version"),e.type){case"character":const s=e;s.physics||t.push("Character blueprint must have physics"),s.animations||t.push("Character blueprint must have animations"),s.stats||t.push("Character blueprint must have stats");break;case"vehicle":const r=e;r.physics||t.push("Vehicle blueprint must have physics"),r.seats||t.push("Vehicle blueprint must have seats");break;case"airplane":const n=e;n.physics||t.push("Airplane blueprint must have physics"),n.seats||t.push("Airplane blueprint must have seats");break}return{valid:t.length===0,errors:t}}}class y{static instance;converter;componentRegistry;constructor(){this.converter=new M,this.componentRegistry=a.getInstance(),this.initializeDefaultFactories()}static getInstance(){return y.instance||(y.instance=new y),y.instance}initializeDefaultFactories(){this.registerCharacterFactories(),this.registerVehicleFactories(),this.registerAirplaneFactories()}registerCharacterFactories(){this.componentRegistry.register("CharacterMovement",e=>({type:"CharacterMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),this.componentRegistry.register("CharacterAnimation",e=>({type:"CharacterAnimation",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),this.componentRegistry.register("CharacterPhysics",e=>({type:"CharacterPhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e}))}registerVehicleFactories(){this.componentRegistry.register("VehicleMovement",e=>({type:"VehicleMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),this.componentRegistry.register("VehiclePhysics",e=>({type:"VehiclePhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e}))}registerAirplaneFactories(){this.componentRegistry.register("AirplaneMovement",e=>({type:"AirplaneMovement",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e})),this.componentRegistry.register("AirplanePhysics",e=>({type:"AirplanePhysics",enabled:!0,initialize:()=>{},update:()=>{},dispose:()=>{},...e}))}createEntity(e,t){const s=this.converter.convert(e);return new w(s,t.rigidBodyRef,t.innerGroupRef,t.outerGroupRef)}async createFromId(e,t){const{blueprintRegistry:s}=await Promise.resolve().then(()=>require("./useSpawnFromBlueprint-CAz_a7R2.cjs")).then(n=>n.registry),r=s.get(e);return r?this.createEntity(r,t):(console.error(`Blueprint not found: ${e}`),null)}createFromDefinition(e,t){return new w(e,t.rigidBodyRef,t.innerGroupRef,t.outerGroupRef)}registerComponentFactory(e,t){this.componentRegistry.register(e,t)}getAvailableComponentTypes(){return this.componentRegistry.getAllTypes()}}function A(i){return u.useMemo(()=>d.blueprintRegistry.get(i),[i])}function N(i){const e=A(i);if(e?.type==="character")return e}function L(i){const e=A(i);if(e?.type==="vehicle")return e}function q(i){const e=A(i);if(e?.type==="airplane")return e}function U(i){return u.useMemo(()=>d.blueprintRegistry.getByType(i),[i])}function H({blueprint:i,blueprintId:e,position:t=[0,0,0],rotation:s=[0,0,0],scale:r=[1,1,1],onSpawn:n,onDestroy:p,children:o}){const l=u.useRef(null),c=u.useRef(null),C=u.useRef(null),R=u.useRef(null);u.useEffect(()=>{const x=y.getInstance();return(async()=>{let m=null;i?m=x.createEntity(i,{rigidBodyRef:l,innerGroupRef:c,outerGroupRef:C,position:t,rotation:s,scale:r}):e&&(m=await x.createFromId(e,{rigidBodyRef:l,innerGroupRef:c,outerGroupRef:C,position:t,rotation:s,scale:r})),m&&(R.current=m,n?.(m))})(),()=>{R.current&&(R.current.dispose(),p?.())}},[i,e]);const z=i?.type||"character",V=J(z);return S.jsx(P.RigidBody,{ref:l,type:"dynamic",position:t,rotation:s,scale:r,...V,children:S.jsx("group",{ref:C,children:S.jsx("group",{ref:c,children:o})})})}function J(i){switch(i){case"character":return{mass:1,friction:.5,restitution:0,linearDamping:4,angularDamping:10,enabledRotations:[!1,!1,!1]};case"vehicle":return{mass:150,friction:.8,restitution:.2,linearDamping:.5,angularDamping:1};case"airplane":return{mass:500,friction:.1,restitution:.1,linearDamping:.2,angularDamping:.5};default:return{mass:1,friction:.5,restitution:.5}}}exports.BASIC_KART_BLUEPRINT=d.BASIC_KART_BLUEPRINT;exports.FIRE_MAGE_BLUEPRINT=d.FIRE_MAGE_BLUEPRINT;exports.WARRIOR_BLUEPRINT=d.WARRIOR_BLUEPRINT;exports.blueprintRegistry=d.blueprintRegistry;exports.useSpawnFromBlueprint=d.useSpawnFromBlueprint;exports.BaseComponent=b;exports.BlueprintConverter=M;exports.BlueprintEntity=w;exports.BlueprintFactory=y;exports.BlueprintLoader=T;exports.BlueprintSpawner=H;exports.ComponentRegistry=a;exports.GravityForceComponent=F;exports.registerDefaultComponents=_;exports.useAirplaneBlueprint=q;exports.useBlueprint=A;exports.useBlueprintsByType=U;exports.useCharacterBlueprint=N;exports.useVehicleBlueprint=L;
|
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-C_IzLBK5.js";
|
|
2
|
+
import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-C_IzLBK5.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-C_IzLBK5.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) {
|
|
@@ -18,6 +18,7 @@ export declare class DirectionComponent {
|
|
|
18
18
|
private cameraForward;
|
|
19
19
|
private cameraRight;
|
|
20
20
|
private desiredMovement;
|
|
21
|
+
private nextMousePosition;
|
|
21
22
|
private readonly upAxis;
|
|
22
23
|
constructor(config?: PhysicsConfigType, inputBackend?: InputAdapter);
|
|
23
24
|
updateDirection(physicsState: PhysicsState, controlMode?: string, calcProp?: PhysicsCalcProps, innerGroupRef?: RefObject<THREE.Group>): void;
|
|
@@ -3,9 +3,11 @@ type ClickNavigationListener = () => void;
|
|
|
3
3
|
export declare function nextClickNavigationRequest(): number;
|
|
4
4
|
export declare function isLatestClickNavigationRequest(requestId: number): boolean;
|
|
5
5
|
export declare function setClickNavigationRoute(waypoints: THREE.Vector3[], threshold: number, shouldRun: boolean): void;
|
|
6
|
+
export declare function setClickNavigationPreview(waypoints: THREE.Vector3[]): void;
|
|
6
7
|
export declare function clearClickNavigationRoute(): void;
|
|
7
8
|
export declare function subscribeClickNavigationRoute(listener: ClickNavigationListener): () => void;
|
|
8
9
|
export declare function getClickNavigationRoute(): THREE.Vector3[];
|
|
10
|
+
export declare function hasClickNavigationRoute(): boolean;
|
|
9
11
|
export declare function getClickNavigationSettings(): {
|
|
10
12
|
threshold: number;
|
|
11
13
|
shouldRun: boolean;
|
|
@@ -48,6 +48,9 @@ export declare class NavigationSystem {
|
|
|
48
48
|
private gridPtr;
|
|
49
49
|
private outPathPtr;
|
|
50
50
|
private readonly outCapacity;
|
|
51
|
+
private readonly traversalGridCacheLimit;
|
|
52
|
+
private traversalGridCache;
|
|
53
|
+
private traversalCostGridCache;
|
|
51
54
|
private constructor();
|
|
52
55
|
static getInstance(config?: Partial<NavigationConfig>): NavigationSystem;
|
|
53
56
|
init(): Promise<boolean>;
|
|
@@ -59,6 +62,8 @@ export declare class NavigationSystem {
|
|
|
59
62
|
worldToGrid(worldX: number, worldZ: number): [number, number];
|
|
60
63
|
gridToWorld(gx: number, gz: number, y?: number): Waypoint;
|
|
61
64
|
private resolveAgentFootprint;
|
|
65
|
+
private getFootprintCacheKey;
|
|
66
|
+
private invalidateTraversalCaches;
|
|
62
67
|
private getCellBounds;
|
|
63
68
|
private footprintOverlapsBlockedCell;
|
|
64
69
|
private canOccupyCell;
|
package/dist/editor.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-B4lSjyeZ.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-CJj-Z7Jr.cjs"),l=require("./gaesupStore-2zKBYTYo.cjs"),E=require("./loader-D7cEHkCq.cjs");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const _=g(I);var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(t,i,n,o)=>{for(var d=D(i,n),s=t.length-1,c;s>=0;s--)(c=t[s])&&(d=c(i,n,d)||d);return d&&B(i,n,d),d};class a{static convertLegacyPosition(i){return{x:i[0],y:i[1],z:i[2]}}static convertLegacyRotation(i){return{x:i[0],y:i[1],z:i[2]}}static convertToLegacyPosition(i){return[i.x,i.y,i.z]}static convertToLegacyRotation(i){return[i.x,i.y,i.z]}static convertLegacyWall(i){return{id:i.id||`wall-${Date.now()}`,position:this.convertLegacyPosition(i.position),rotation:this.convertLegacyRotation(i.rotation),wallGroupId:i.wall_parent_id||"default",width:4,height:4,depth:.5}}static convertLegacyTile(i){return{id:i.id||`tile-${Date.now()}`,position:this.convertLegacyPosition(i.position),tileGroupId:i.tile_parent_id||"default",size:4}}static convertLegacyMesh(i){const n={id:i.id||`mesh-${Date.now()}`,color:i.color||"#ffffff",material:i.material==="GLASS"?"GLASS":"STANDARD",roughness:i.roughness||.5,metalness:i.metalness||0,opacity:i.opacity||1,transparent:i.transparent||!1};return i.map_texture_url&&(n.mapTextureUrl=i.map_texture_url),i.normal_texture_url&&(n.normalTextureUrl=i.normal_texture_url),n}}u([l.HandleError(),l.Profile()],a,"convertLegacyPosition");u([l.HandleError(),l.Profile()],a,"convertLegacyRotation");u([l.HandleError()],a,"convertToLegacyPosition");u([l.HandleError()],a,"convertToLegacyRotation");u([l.HandleError(),l.Profile()],a,"convertLegacyWall");u([l.HandleError(),l.Profile()],a,"convertLegacyTile");u([l.HandleError(),l.Profile()],a,"convertLegacyMesh");function L(){const t=T.useMemo(()=>({frustum:new _.Frustum,matrix:new _.Matrix4,camPos:new _.Vector3}),[]);return S.useFrame((i,n)=>{const o=i.camera;e.getGrassManager().size()!==0&&(t.matrix.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),t.frustum.setFromProjectionMatrix(t.matrix),t.camPos.copy(o.position),e.getGrassManager().tick({elapsedTime:i.clock.elapsedTime,delta:n,cameraPosition:t.camPos,frustum:t.frustum}))}),null}exports.AnimationPanel=e.AnimationPanel;exports.Billboard=e.index;exports.BlockSystem=e.BlockSystem;exports.BuildingController=e.BuildingController;exports.BuildingGpuCullingDriver=e.BuildingGpuCullingDriver;exports.BuildingGpuMirrorDriver=e.BuildingGpuMirrorDriver;exports.BuildingGpuUploadDriver=e.BuildingGpuUploadDriver;exports.BuildingIndirectArgsUploadDriver=e.BuildingIndirectArgsUploadDriver;exports.BuildingIndirectDrawDriver=e.BuildingIndirectDrawDriver;exports.BuildingNavigationObstacleDriver=e.BuildingNavigationObstacleDriver;exports.BuildingPanel=e.BuildingPanel;exports.BuildingRenderStateDriver=e.BuildingRenderStateDriver;exports.BuildingSystem=e.BuildingSystem;exports.BuildingUI=e.BuildingUI;exports.BuildingVisibilityDriver=e.BuildingVisibilityDriver;exports.CameraPanel=e.CameraPanel;exports.DEFAULT_BUILDING_GRID_EXTENSION_ID=e.DEFAULT_BUILDING_GRID_EXTENSION_ID;exports.DEFAULT_BUILDING_OBJECT_CATALOG=e.DEFAULT_BUILDING_OBJECT_CATALOG;exports.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID=e.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID;exports.DEFAULT_BUILDING_SAVE_EXTENSION_ID=e.DEFAULT_BUILDING_SAVE_EXTENSION_ID;exports.DEFAULT_BUILDING_STORE_SERVICE_ID=e.DEFAULT_BUILDING_STORE_SERVICE_ID;exports.DRAW_CLUSTER_BILLBOARD=e.DRAW_CLUSTER_BILLBOARD;exports.DRAW_CLUSTER_BLOCK=e.DRAW_CLUSTER_BLOCK;exports.DRAW_CLUSTER_COUNT=e.DRAW_CLUSTER_COUNT;exports.DRAW_CLUSTER_DESCRIPTORS=e.DRAW_CLUSTER_DESCRIPTORS;exports.DRAW_CLUSTER_FIRE=e.DRAW_CLUSTER_FIRE;exports.DRAW_CLUSTER_FLAG=e.DRAW_CLUSTER_FLAG;exports.DRAW_CLUSTER_GRASS=e.DRAW_CLUSTER_GRASS;exports.DRAW_CLUSTER_MODEL=e.DRAW_CLUSTER_MODEL;exports.DRAW_CLUSTER_SAKURA=e.DRAW_CLUSTER_SAKURA;exports.DRAW_CLUSTER_SAND=e.DRAW_CLUSTER_SAND;exports.DRAW_CLUSTER_SNOWFIELD=e.DRAW_CLUSTER_SNOWFIELD;exports.DRAW_CLUSTER_TILE=e.DRAW_CLUSTER_TILE;exports.DRAW_CLUSTER_WALL=e.DRAW_CLUSTER_WALL;exports.DRAW_CLUSTER_WATER=e.DRAW_CLUSTER_WATER;exports.EDITOR_PANEL_COMPONENT_KIND=e.EDITOR_PANEL_COMPONENT_KIND;exports.Editor=e.Editor;exports.EditorLayout=e.EditorLayout;exports.Fire=e.index$1;exports.GPU_META_STRIDE=e.GPU_META_STRIDE;exports.GPU_SPATIAL_STRIDE=e.GPU_SPATIAL_STRIDE;exports.GameplayEventPanel=e.GameplayEventPanel;exports.Grass=e.Grass;exports.GridHelper=e.GridHelper;exports.INDIRECT_DRAW_STRIDE=e.INDIRECT_DRAW_STRIDE;exports.MotionPanel=e.MotionPanel;exports.PerformancePanel=e.PerformancePanel;exports.ResizablePanel=e.ResizablePanel;exports.Sakura=e.Sakura;exports.SakuraBatch=e.SakuraBatch;exports.Sand=e.Sand;exports.SandBatch=e.SandBatch;exports.Snow=e.Snow;exports.Snowfield=e.Snowfield;exports.SnowfieldBatch=e.SnowfieldBatch;exports.StudioPanel=e.StudioPanel;exports.TileSystem=e.TileSystem;exports.VehiclePanel=e.VehiclePanel;exports.WallSystem=e.WallSystem;exports.Water=e.Ocean;exports.applyBuildingNavigationObstacles=e.applyBuildingNavigationObstacles;exports.buildBuildingGpuMirror=e.buildBuildingGpuMirror;exports.buildBuildingIndirectDrawMirror=e.buildBuildingIndirectDrawMirror;exports.buildingPlugin=e.buildingPlugin;exports.createBuildingGpuUploadPlan=e.createBuildingGpuUploadPlan;exports.createBuildingIndirectDrawUploadPlan=e.createBuildingIndirectDrawUploadPlan;exports.createBuildingPlugin=e.createBuildingPlugin;exports.createBuildingScopeId=e.createBuildingScopeId;exports.createCustomMeshId=e.createCustomMeshId;exports.createEditorCommandStack=e.createEditorCommandStack;exports.createEditorShell=e.createEditorShell;exports.createEditorSlice=e.createEditorSlice;exports.createEmptyBuildingGpuUploadResources=e.createEmptyBuildingGpuUploadResources;exports.createEmptyBuildingIndirectDrawMirror=e.createEmptyBuildingIndirectDrawMirror;exports.createEmptyGpuMirror=e.createEmptyGpuMirror;exports.createTerrainBlockMaterial=e.createTerrainBlockMaterial;exports.destroyBuildingGpuUploadResources=e.destroyBuildingGpuUploadResources;exports.editorSlice=e.editorSlice;exports.findTerrainBlockMaterial=e.findTerrainBlockMaterial;exports.getDefaultBuildingObject=e.getDefaultBuildingObject;exports.getDrawClusterForSnapshotEntry=e.getDrawClusterForSnapshotEntry;exports.getGrassManager=e.getGrassManager;exports.getIndirectInstanceCount=e.getIndirectInstanceCount;exports.getWallMaterialKey=e.getWallMaterialKey;exports.getWebGPUDeviceFromRenderer=e.getWebGPUDeviceFromRenderer;exports.isEditorPanelComponentExtension=e.isEditorPanelComponentExtension;exports.parseBuildingGpuVisibilityFlags=e.parseBuildingGpuVisibilityFlags;exports.resolveEditorPanelComponentExtensions=e.resolveEditorPanelComponentExtensions;exports.syncBuildingGpuBuffers=e.syncBuildingGpuBuffers;exports.syncBuildingIndirectArgsBuffer=e.syncBuildingIndirectArgsBuffer;exports.useBuildingEditor=e.useBuildingEditor;exports.useBuildingGpuCullingStore=e.useBuildingGpuCullingStore;exports.useBuildingRenderStateStore=e.useBuildingRenderStateStore;exports.useBuildingVisibilityStore=e.useBuildingVisibilityStore;exports.useEditor=e.useEditor;exports.useEditorStore=e.useEditorStore;exports.BUILDING_BASIC_OBJECT_OPTIONS=r.BUILDING_BASIC_OBJECT_OPTIONS;exports.BUILDING_FLAG_STYLE_OPTIONS=r.BUILDING_FLAG_STYLE_OPTIONS;exports.BUILDING_PLACED_OBJECT_OPTIONS=r.BUILDING_PLACED_OBJECT_OPTIONS;exports.BUILDING_TILE_OBJECT_OPTIONS=r.BUILDING_TILE_OBJECT_OPTIONS;exports.BUILDING_TILE_PRESETS=r.BUILDING_TILE_PRESETS;exports.BUILDING_TILE_SHAPE_OPTIONS=r.BUILDING_TILE_SHAPE_OPTIONS;exports.BUILDING_TREE_COLOR_PRESETS=r.BUILDING_TREE_COLOR_PRESETS;exports.BUILDING_TREE_OPTIONS=r.BUILDING_TREE_OPTIONS;exports.BUILDING_WALL_KIND_OPTIONS=r.BUILDING_WALL_KIND_OPTIONS;exports.BUILDING_WALL_PRESETS=r.BUILDING_WALL_PRESETS;exports.BUILDING_WEATHER_EFFECT_OPTIONS=r.BUILDING_WEATHER_EFFECT_OPTIONS;exports.FLAG_STYLE_META=r.FLAG_STYLE_META;exports.blockToPlacementEntry=r.blockToPlacementEntry;exports.buildingCellToWorld=r.buildingCellToWorld;exports.buildingGridAdapter=r.buildingGridAdapter;exports.buildingGroupsToPlacementEntries=r.buildingGroupsToPlacementEntries;exports.buildingPlacementAdapter=r.buildingPlacementAdapter;exports.cellToTilePosition=r.cellToTilePosition;exports.createBlockFootprint=r.createBlockFootprint;exports.createBuildingPlacementEngine=r.createBuildingPlacementEngine;exports.createTileFootprint=r.createTileFootprint;exports.edgeKey=r.edgeKey;exports.edgeSideToWallRotation=r.edgeSideToWallRotation;exports.edgeToWallTransform=r.edgeToWallTransform;exports.getTileSupportHeight=r.getTileSupportHeight;exports.hasTileCollision=r.hasTileCollision;exports.hasWallCollision=r.hasWallCollision;exports.indexAabb=r.indexAabb;exports.normalizeQuarterTurnRotation=r.normalizeQuarterTurnRotation;exports.pair=r.pair;exports.queryAabbIds=r.queryAabbIds;exports.snapBuildingPosition=r.snapBuildingPosition;exports.tileFootprintKeys=r.tileFootprintKeys;exports.tileGroupToPlacementEntries=r.tileGroupToPlacementEntries;exports.tileHalfSize=r.tileHalfSize;exports.tileOverlaps=r.tileOverlaps;exports.tilePositionToCell=r.tilePositionToCell;exports.tileToPlacementEntry=r.tileToPlacementEntry;exports.unindexId=r.unindexId;exports.useBuildingStore=r.useBuildingStore;exports.wallGroupToPlacementEntries=r.wallGroupToPlacementEntries;exports.wallToPlacementEntry=r.wallToPlacementEntry;exports.wallTransformToEdge=r.wallTransformToEdge;exports.worldToBuildingCell=r.worldToBuildingCell;exports.zigZag=r.zigZag;exports.CONTENT_SCHEMA_VERSION=E.CONTENT_SCHEMA_VERSION;exports.HttpContentBundleSource=E.HttpContentBundleSource;exports.createContentBundleFromSaveSystem=E.createContentBundleFromSaveSystem;exports.loadContentBundleFromManifest=E.loadContentBundleFromManifest;exports.validateContentBundle=E.validateContentBundle;exports.validateContentBundleManifest=E.validateContentBundleManifest;exports.BuildingBridge=a;exports.GrassDriver=L;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-CS9Elxgw.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-Bb6WkHKt.cjs"),l=require("./gaesupStore-CRQ-tcIz.cjs"),E=require("./loader-D7cEHkCq.cjs");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const _=g(I);var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(t,i,n,o)=>{for(var d=D(i,n),s=t.length-1,c;s>=0;s--)(c=t[s])&&(d=c(i,n,d)||d);return d&&B(i,n,d),d};class a{static convertLegacyPosition(i){return{x:i[0],y:i[1],z:i[2]}}static convertLegacyRotation(i){return{x:i[0],y:i[1],z:i[2]}}static convertToLegacyPosition(i){return[i.x,i.y,i.z]}static convertToLegacyRotation(i){return[i.x,i.y,i.z]}static convertLegacyWall(i){return{id:i.id||`wall-${Date.now()}`,position:this.convertLegacyPosition(i.position),rotation:this.convertLegacyRotation(i.rotation),wallGroupId:i.wall_parent_id||"default",width:4,height:4,depth:.5}}static convertLegacyTile(i){return{id:i.id||`tile-${Date.now()}`,position:this.convertLegacyPosition(i.position),tileGroupId:i.tile_parent_id||"default",size:4}}static convertLegacyMesh(i){const n={id:i.id||`mesh-${Date.now()}`,color:i.color||"#ffffff",material:i.material==="GLASS"?"GLASS":"STANDARD",roughness:i.roughness||.5,metalness:i.metalness||0,opacity:i.opacity||1,transparent:i.transparent||!1};return i.map_texture_url&&(n.mapTextureUrl=i.map_texture_url),i.normal_texture_url&&(n.normalTextureUrl=i.normal_texture_url),n}}u([l.HandleError(),l.Profile()],a,"convertLegacyPosition");u([l.HandleError(),l.Profile()],a,"convertLegacyRotation");u([l.HandleError()],a,"convertToLegacyPosition");u([l.HandleError()],a,"convertToLegacyRotation");u([l.HandleError(),l.Profile()],a,"convertLegacyWall");u([l.HandleError(),l.Profile()],a,"convertLegacyTile");u([l.HandleError(),l.Profile()],a,"convertLegacyMesh");function L(){const t=T.useMemo(()=>({frustum:new _.Frustum,matrix:new _.Matrix4,camPos:new _.Vector3}),[]);return S.useFrame((i,n)=>{const o=i.camera;e.getGrassManager().size()!==0&&(t.matrix.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),t.frustum.setFromProjectionMatrix(t.matrix),t.camPos.copy(o.position),e.getGrassManager().tick({elapsedTime:i.clock.elapsedTime,delta:n,cameraPosition:t.camPos,frustum:t.frustum}))}),null}exports.AnimationPanel=e.AnimationPanel;exports.Billboard=e.index;exports.BlockSystem=e.BlockSystem;exports.BuildingController=e.BuildingController;exports.BuildingGpuCullingDriver=e.BuildingGpuCullingDriver;exports.BuildingGpuMirrorDriver=e.BuildingGpuMirrorDriver;exports.BuildingGpuUploadDriver=e.BuildingGpuUploadDriver;exports.BuildingIndirectArgsUploadDriver=e.BuildingIndirectArgsUploadDriver;exports.BuildingIndirectDrawDriver=e.BuildingIndirectDrawDriver;exports.BuildingNavigationObstacleDriver=e.BuildingNavigationObstacleDriver;exports.BuildingPanel=e.BuildingPanel;exports.BuildingRenderStateDriver=e.BuildingRenderStateDriver;exports.BuildingSystem=e.BuildingSystem;exports.BuildingUI=e.BuildingUI;exports.BuildingVisibilityDriver=e.BuildingVisibilityDriver;exports.CameraPanel=e.CameraPanel;exports.DEFAULT_BUILDING_GRID_EXTENSION_ID=e.DEFAULT_BUILDING_GRID_EXTENSION_ID;exports.DEFAULT_BUILDING_OBJECT_CATALOG=e.DEFAULT_BUILDING_OBJECT_CATALOG;exports.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID=e.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID;exports.DEFAULT_BUILDING_SAVE_EXTENSION_ID=e.DEFAULT_BUILDING_SAVE_EXTENSION_ID;exports.DEFAULT_BUILDING_STORE_SERVICE_ID=e.DEFAULT_BUILDING_STORE_SERVICE_ID;exports.DRAW_CLUSTER_BILLBOARD=e.DRAW_CLUSTER_BILLBOARD;exports.DRAW_CLUSTER_BLOCK=e.DRAW_CLUSTER_BLOCK;exports.DRAW_CLUSTER_COUNT=e.DRAW_CLUSTER_COUNT;exports.DRAW_CLUSTER_DESCRIPTORS=e.DRAW_CLUSTER_DESCRIPTORS;exports.DRAW_CLUSTER_FIRE=e.DRAW_CLUSTER_FIRE;exports.DRAW_CLUSTER_FLAG=e.DRAW_CLUSTER_FLAG;exports.DRAW_CLUSTER_GRASS=e.DRAW_CLUSTER_GRASS;exports.DRAW_CLUSTER_MODEL=e.DRAW_CLUSTER_MODEL;exports.DRAW_CLUSTER_SAKURA=e.DRAW_CLUSTER_SAKURA;exports.DRAW_CLUSTER_SAND=e.DRAW_CLUSTER_SAND;exports.DRAW_CLUSTER_SNOWFIELD=e.DRAW_CLUSTER_SNOWFIELD;exports.DRAW_CLUSTER_TILE=e.DRAW_CLUSTER_TILE;exports.DRAW_CLUSTER_WALL=e.DRAW_CLUSTER_WALL;exports.DRAW_CLUSTER_WATER=e.DRAW_CLUSTER_WATER;exports.EDITOR_PANEL_COMPONENT_KIND=e.EDITOR_PANEL_COMPONENT_KIND;exports.Editor=e.Editor;exports.EditorLayout=e.EditorLayout;exports.Fire=e.index$1;exports.GPU_META_STRIDE=e.GPU_META_STRIDE;exports.GPU_SPATIAL_STRIDE=e.GPU_SPATIAL_STRIDE;exports.GameplayEventPanel=e.GameplayEventPanel;exports.Grass=e.Grass;exports.GridHelper=e.GridHelper;exports.INDIRECT_DRAW_STRIDE=e.INDIRECT_DRAW_STRIDE;exports.MotionPanel=e.MotionPanel;exports.PerformancePanel=e.PerformancePanel;exports.ResizablePanel=e.ResizablePanel;exports.Sakura=e.Sakura;exports.SakuraBatch=e.SakuraBatch;exports.Sand=e.Sand;exports.SandBatch=e.SandBatch;exports.Snow=e.Snow;exports.Snowfield=e.Snowfield;exports.SnowfieldBatch=e.SnowfieldBatch;exports.StudioPanel=e.StudioPanel;exports.TileSystem=e.TileSystem;exports.VehiclePanel=e.VehiclePanel;exports.WallSystem=e.WallSystem;exports.Water=e.Ocean;exports.applyBuildingNavigationObstacles=e.applyBuildingNavigationObstacles;exports.buildBuildingGpuMirror=e.buildBuildingGpuMirror;exports.buildBuildingIndirectDrawMirror=e.buildBuildingIndirectDrawMirror;exports.buildingPlugin=e.buildingPlugin;exports.createBuildingGpuUploadPlan=e.createBuildingGpuUploadPlan;exports.createBuildingIndirectDrawUploadPlan=e.createBuildingIndirectDrawUploadPlan;exports.createBuildingPlugin=e.createBuildingPlugin;exports.createBuildingScopeId=e.createBuildingScopeId;exports.createCustomMeshId=e.createCustomMeshId;exports.createEditorCommandStack=e.createEditorCommandStack;exports.createEditorShell=e.createEditorShell;exports.createEditorSlice=e.createEditorSlice;exports.createEmptyBuildingGpuUploadResources=e.createEmptyBuildingGpuUploadResources;exports.createEmptyBuildingIndirectDrawMirror=e.createEmptyBuildingIndirectDrawMirror;exports.createEmptyGpuMirror=e.createEmptyGpuMirror;exports.createTerrainBlockMaterial=e.createTerrainBlockMaterial;exports.destroyBuildingGpuUploadResources=e.destroyBuildingGpuUploadResources;exports.editorSlice=e.editorSlice;exports.findTerrainBlockMaterial=e.findTerrainBlockMaterial;exports.getDefaultBuildingObject=e.getDefaultBuildingObject;exports.getDrawClusterForSnapshotEntry=e.getDrawClusterForSnapshotEntry;exports.getGrassManager=e.getGrassManager;exports.getIndirectInstanceCount=e.getIndirectInstanceCount;exports.getWallMaterialKey=e.getWallMaterialKey;exports.getWebGPUDeviceFromRenderer=e.getWebGPUDeviceFromRenderer;exports.isEditorPanelComponentExtension=e.isEditorPanelComponentExtension;exports.parseBuildingGpuVisibilityFlags=e.parseBuildingGpuVisibilityFlags;exports.resolveEditorPanelComponentExtensions=e.resolveEditorPanelComponentExtensions;exports.syncBuildingGpuBuffers=e.syncBuildingGpuBuffers;exports.syncBuildingIndirectArgsBuffer=e.syncBuildingIndirectArgsBuffer;exports.useBuildingEditor=e.useBuildingEditor;exports.useBuildingGpuCullingStore=e.useBuildingGpuCullingStore;exports.useBuildingRenderStateStore=e.useBuildingRenderStateStore;exports.useBuildingVisibilityStore=e.useBuildingVisibilityStore;exports.useEditor=e.useEditor;exports.useEditorStore=e.useEditorStore;exports.BUILDING_BASIC_OBJECT_OPTIONS=r.BUILDING_BASIC_OBJECT_OPTIONS;exports.BUILDING_FLAG_STYLE_OPTIONS=r.BUILDING_FLAG_STYLE_OPTIONS;exports.BUILDING_PLACED_OBJECT_OPTIONS=r.BUILDING_PLACED_OBJECT_OPTIONS;exports.BUILDING_TILE_OBJECT_OPTIONS=r.BUILDING_TILE_OBJECT_OPTIONS;exports.BUILDING_TILE_PRESETS=r.BUILDING_TILE_PRESETS;exports.BUILDING_TILE_SHAPE_OPTIONS=r.BUILDING_TILE_SHAPE_OPTIONS;exports.BUILDING_TREE_COLOR_PRESETS=r.BUILDING_TREE_COLOR_PRESETS;exports.BUILDING_TREE_OPTIONS=r.BUILDING_TREE_OPTIONS;exports.BUILDING_WALL_KIND_OPTIONS=r.BUILDING_WALL_KIND_OPTIONS;exports.BUILDING_WALL_PRESETS=r.BUILDING_WALL_PRESETS;exports.BUILDING_WEATHER_EFFECT_OPTIONS=r.BUILDING_WEATHER_EFFECT_OPTIONS;exports.FLAG_STYLE_META=r.FLAG_STYLE_META;exports.blockToPlacementEntry=r.blockToPlacementEntry;exports.buildingCellToWorld=r.buildingCellToWorld;exports.buildingGridAdapter=r.buildingGridAdapter;exports.buildingGroupsToPlacementEntries=r.buildingGroupsToPlacementEntries;exports.buildingPlacementAdapter=r.buildingPlacementAdapter;exports.cellToTilePosition=r.cellToTilePosition;exports.createBlockFootprint=r.createBlockFootprint;exports.createBuildingPlacementEngine=r.createBuildingPlacementEngine;exports.createTileFootprint=r.createTileFootprint;exports.edgeKey=r.edgeKey;exports.edgeSideToWallRotation=r.edgeSideToWallRotation;exports.edgeToWallTransform=r.edgeToWallTransform;exports.getTileSupportHeight=r.getTileSupportHeight;exports.hasTileCollision=r.hasTileCollision;exports.hasWallCollision=r.hasWallCollision;exports.indexAabb=r.indexAabb;exports.normalizeQuarterTurnRotation=r.normalizeQuarterTurnRotation;exports.pair=r.pair;exports.queryAabbIds=r.queryAabbIds;exports.snapBuildingPosition=r.snapBuildingPosition;exports.tileFootprintKeys=r.tileFootprintKeys;exports.tileGroupToPlacementEntries=r.tileGroupToPlacementEntries;exports.tileHalfSize=r.tileHalfSize;exports.tileOverlaps=r.tileOverlaps;exports.tilePositionToCell=r.tilePositionToCell;exports.tileToPlacementEntry=r.tileToPlacementEntry;exports.unindexId=r.unindexId;exports.useBuildingStore=r.useBuildingStore;exports.wallGroupToPlacementEntries=r.wallGroupToPlacementEntries;exports.wallToPlacementEntry=r.wallToPlacementEntry;exports.wallTransformToEdge=r.wallTransformToEdge;exports.worldToBuildingCell=r.worldToBuildingCell;exports.zigZag=r.zigZag;exports.CONTENT_SCHEMA_VERSION=E.CONTENT_SCHEMA_VERSION;exports.HttpContentBundleSource=E.HttpContentBundleSource;exports.createContentBundleFromSaveSystem=E.createContentBundleFromSaveSystem;exports.loadContentBundleFromManifest=E.loadContentBundleFromManifest;exports.validateContentBundle=E.validateContentBundle;exports.validateContentBundleManifest=E.validateContentBundleManifest;exports.BuildingBridge=a;exports.GrassDriver=L;
|
package/dist/editor.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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-CkD2KlIV.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-CkD2KlIV.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-
|
|
8
|
-
import { H as t, P as o } from "./gaesupStore-
|
|
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-DmHVuHAr.js";
|
|
8
|
+
import { H as t, P as o } from "./gaesupStore-x2iiDzsY.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) => {
|
|
11
11
|
for (var n = I(a, i), u = e.length - 1, c; u >= 0; u--)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("reflect-metadata");const H=require("zustand"),G=require("zustand/middleware"),k=require("three");function X(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const l=X(k);class m{static registry=new Map;static register(e,t){m.registry.has(e)&&console.warn(`[BridgeRegistry] Domain '${e}' is already registered. Overwriting.`),m.registry.set(e,t)}static get(e){return m.registry.get(e)}static list(){return Array.from(m.registry.keys())}}class w{static instance;enabled=!1;level="info";constructor(){}static getInstance(){return w.instance||(w.instance=new w),w.instance}enable(){this.enabled=!0}disable(){this.enabled=!1}setLevel(e){this.level=e}shouldLog(e){if(!this.enabled)return!1;const t={error:0,warn:1,info:2,log:3};return t[e]<=t[this.level]}log(e,...t){this.shouldLog("log")&&console.log(`[LOG] ${e}`,...t)}info(e,...t){this.shouldLog("info")&&console.info(`[INFO] ${e}`,...t)}warn(e,...t){this.shouldLog("warn")&&console.warn(`[WARN] ${e}`,...t)}error(e,...t){this.shouldLog("error")&&console.error(`[ERROR] ${e}`,...t)}}const d=w.getInstance();function I(n){return typeof n=="function"?n.name:typeof n=="symbol"?n.toString():String(n)}class b{static instance;factories=new Map;singletons=new Map;singletonTokens=new Set;resolving=new Set;constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}register(e,t,s=!0){this.factories.set(e,()=>t()),s?this.singletonTokens.add(e):(this.singletonTokens.delete(e),this.singletons.delete(e))}registerService(e){const t=Reflect.getMetadata("di:token",e)||e;if(this.factories.has(t))return;const s=Reflect.getMetadata("di:singleton",e)??!0,r=()=>this.createInstance(e);this.register(t,r,s)}resolve(e){if(this.resolving.has(e)){const r=`DIContainer: Circular dependency detected: ${Array.from(this.resolving).map(I).join(" -> ")} -> ${I(e)}`;throw d.error(r),new Error(r)}if(this.singletons.has(e))return this.singletons.get(e);const t=this.factories.get(e);if(!t){if(typeof e=="function"&&"prototype"in e)return this.registerService(e),this.resolve(e);throw new Error(`DIContainer: No factory registered for token: ${I(e)}`)}this.resolving.add(e);try{const s=t();return this.singletonTokens.has(e)&&this.singletons.set(e,s),s}finally{this.resolving.delete(e)}}createInstance(e){const t=Reflect.getMetadata("di:paramtypes",e)||[],r=(Reflect.getMetadata("design:paramtypes",e)||[]).map((i,o)=>{const c=t[o]||i;if(!c)throw new Error(`DIContainer: Cannot resolve dependency for parameter ${o} of ${e.name}. Type is not inferable and no @Inject decorator found.`);try{return this.resolve(c)}catch(M){const v=M instanceof Error?M.message:String(M);throw d.error(`DIContainer: Failed to resolve parameter ${o} (${I(c)}) for ${e.name}.`,v),new Error(`Could not construct ${e.name}.`)}}),a=new e(...r);return this.autowireProperties(a),a}injectProperties(e){this.autowireProperties(e)}autowireProperties(e){const t=e.constructor,s=Reflect.getMetadata("autowired",t)||Reflect.getMetadata("autowired",t.prototype)||[];for(const a of s){const i=Reflect.getMetadata("design:type",t.prototype,a)||Reflect.getMetadata("design:type",e,a);if(i)try{e[a]=this.resolve(i)}catch(o){const c=o instanceof Error?o.message:String(o);d.warn(`DIContainer: Failed to autowire property '${a}' on '${t.name}'.`,c)}}const r=Reflect.getMetadata("di:properties",t)||{};for(const a in r){const i=r[a];try{e[a]=this.resolve(i)}catch(o){const c=o instanceof Error?o.message:String(o);d.warn(`DIContainer: Failed to inject property '${a}' with token '${String(i)}' on '${t.name}'.`,c)}}}clear(){this.factories.clear(),this.singletons.clear(),this.singletonTokens.clear(),this.resolving.clear()}}class p{static instances=new Map;static create(e){const t=p.instances.get(e);if(t)return t;const s=m.get(e);if(!s)return d.error(`[BridgeFactory] No bridge registered for domain: ${e}`),null;try{const r=b.getInstance().resolve(s);return p.instances.set(e,r),d.info(`[BridgeFactory] Created bridge instance for domain: ${e}`),r}catch(r){return d.error(`[BridgeFactory] Failed to create bridge for domain: ${e}`,r instanceof Error?r:String(r)),null}}static get(e){const t=p.instances.get(e);return t||null}static getOrCreate(e){return p.get(e)??p.create(e)}static has(e){return p.instances.has(e)}static dispose(e){const t=p.instances.get(e);t&&(d.info(`[BridgeFactory] Disposing bridge instance for domain: ${e}`),t.dispose(),p.instances.delete(e))}static disposeAll(){d.info(`[BridgeFactory] Disposing all bridge instances (${p.instances.size} total)`),p.instances.forEach((e,t)=>{d.info(`[BridgeFactory] Disposing: ${t}`),e.dispose()}),p.instances.clear()}static listDomains(){return m.list()}static listActiveInstances(){return Array.from(p.instances.keys())}static getInstanceCount(){return p.instances.size}}const Q=!0;class J{systems=new Map;safeDispose(e){if(e)try{e.dispose()}catch{}}register(e,t){const s=this.systems.get(e);s!==t&&(s&&Q&&console.warn(`System with type "${e}" is already registered. Overwriting.`),this.systems.set(e,t))}get(e){return this.systems.get(e)}getAll(){return this.systems}unregister(e){if(!this.systems.has(e))return;const t=this.systems.get(e);this.safeDispose(t),this.systems.delete(e)}clear(){this.systems.forEach(e=>this.safeDispose(e)),this.systems.clear()}}const ee=new J;function O(n){return function(e,t,s){const r=s.value;return s.value=function(...a){try{return r.apply(this,a)}catch(i){const o=i instanceof Error?i:String(i);return d.error(`[${this.constructor.name}] Error in ${t}:`,o),n}},s}}function K(n){return function(e){const t=new Proxy(e,{construct(s,r,a){const i=Reflect.construct(s,r,a);return ee.register(n,i),d.info(`[${e.name}] Registered as ${n} system`),i}});return Object.defineProperty(t,"name",{value:e.name}),t}}function te(n={}){return function(e){const t=new WeakMap,s=new Proxy(e,{construct(r,a,i){const o=Reflect.construct(r,a,i),c={animationFrameId:null,lastTime:0,totalTime:0,frameCount:0};t.set(o,c);const M=()=>{c.animationFrameId!==null&&(cancelAnimationFrame(c.animationFrameId),c.animationFrameId=null,d.info(`[${e.name}] Runtime stopped`))},v=()=>{const R=T=>{c.lastTime===0&&(c.lastTime=T);const N=T-c.lastTime;c.lastTime=T,c.totalTime+=N,c.frameCount++;const Y={deltaTime:N,totalTime:c.totalTime,frameCount:c.frameCount};o.update&&typeof o.update=="function"&&o.update(Y),c.animationFrameId=requestAnimationFrame(R)};c.animationFrameId=requestAnimationFrame(R),d.info(`[${e.name}] Runtime started`)},z=o.dispose?.bind(o);return Object.defineProperty(o,"dispose",{configurable:!0,writable:!0,value:()=>{M(),z?.()}}),n.autoStart&&v(),o}});return Object.defineProperty(s,"name",{value:e.name}),s}}const Z=(n,e,t)=>t;function E(n){return Z}function ne(n=100){return Z}function se(n){return function(e,t,s){const r=s.value;return s.value=async function(...a){const i=new Promise((o,c)=>{setTimeout(()=>c(new Error(`${t} timed out after ${n}ms`)),n)});try{return await Promise.race([r.apply(this,a),i])}catch(o){throw d.error(`[${this.constructor.name}] ${t} timeout:`,o instanceof Error?o:String(o)),o}},s}}var re=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,S=(n,e,t,s)=>{for(var r=ae(e,t),a=n.length-1,i;a>=0;a--)(i=n[a])&&(r=i(e,t,r)||r);return r&&re(e,t,r),r};class h{id;capabilities={hasAsync:!0,hasMetrics:!0,hasState:!0,hasEvents:!1};state;metrics;options;_isDisposed=!1;_updateCount=0;constructor(e,t,s){this.options={...s},this.state=this.createInitialState(e,this.options.initialState),this.metrics=this.createInitialMetrics(t,this.options.initialMetrics)}createInitialState(e,t){return{...e,...t,lastUpdate:0}}createInitialMetrics(e,t){return{...e,...t,frameTime:0}}async init(){}async start(){}pause(){}resume(){}update(e){const t=this.createUpdateArgs(e);this.performUpdateWithArgs(t)}createDefaultUpdateArgs(e){return e}performUpdateWithArgs(e){if(this._isDisposed)throw new Error("Cannot update disposed system");const t=performance.now();this._updateCount++,this.state.lastUpdate=Date.now(),this.beforeUpdate(e),this.performUpdate(e);const s=performance.now();this.metrics.frameTime=s-t,this.updateMetrics(e.deltaTime),this.afterUpdate(e)}beforeUpdate(e){}afterUpdate(e){}updateMetrics(e){}getState(){return this.state}getMetrics(){return this.metrics}get isDisposed(){return this._isDisposed}get updateCount(){return this._updateCount}reset(){this.state=this.createInitialState(this.state,this.options.initialState),this.metrics=this.createInitialMetrics(this.metrics,this.options.initialMetrics),this._updateCount=0,this.onReset()}onReset(){}dispose(){this._isDisposed||(this.onDispose(),this._isDisposed=!0)}onDispose(){}}S([O()],h.prototype,"init");S([O()],h.prototype,"start");S([E()],h.prototype,"update");S([E()],h.prototype,"performUpdateWithArgs");S([O()],h.prototype,"reset");S([O()],h.prototype,"dispose");new l.Vector3;new l.Vector3(0,0,1);const ie=[];new l.Vector3(0,0,0);new l.Vector3(1,1,1);function D(){return ie.pop()||new l.Vector3}const y=(n=0,e=0,t=0)=>{const s=D();return s.set(n,e,t),s},oe=()=>D(),ce=()=>y(1,1,1),ue={FRAME_RATE_LERP_SPEED:8},u={OFFSET:y(-10,-10,-10),MAX_DISTANCE:-7,DISTANCE:-1,X_DISTANCE:15,Y_DISTANCE:8,Z_DISTANCE:15,ZOOM:1,ENABLE_ZOOM:!0,ZOOM_SPEED:.001,MIN_ZOOM:.45,MAX_ZOOM:2.4,TARGET:y(0,0,0),POSITION:y(-15,8,-15),FOCUS:!1,ENABLE_COLLISION:!0,COLLISION_MARGIN:.1,SMOOTHING:{POSITION:.08,ROTATION:.1,FOV:.1},FOV:75,MIN_FOV:10,MAX_FOV:120,BOUNDS:{MIN_Y:2,MAX_Y:50}},le=n=>({cameraOption:{offset:u.OFFSET,maxDistance:u.MAX_DISTANCE,distance:u.DISTANCE,xDistance:u.X_DISTANCE,yDistance:u.Y_DISTANCE,zDistance:u.Z_DISTANCE,zoom:u.ZOOM,enableZoom:u.ENABLE_ZOOM,zoomSpeed:u.ZOOM_SPEED,minZoom:u.MIN_ZOOM,maxZoom:u.MAX_ZOOM,target:u.TARGET,position:u.POSITION,focus:u.FOCUS,enableCollision:u.ENABLE_COLLISION,collisionMargin:u.COLLISION_MARGIN,smoothing:{position:u.SMOOTHING.POSITION,rotation:u.SMOOTHING.ROTATION,fov:u.SMOOTHING.FOV},fov:u.FOV,minFov:u.MIN_FOV,maxFov:u.MAX_FOV,bounds:{minY:u.BOUNDS.MIN_Y,maxY:u.BOUNDS.MAX_Y},modeSettings:{}},setCameraOption:e=>n(t=>({cameraOption:{...t.cameraOption,...e}})),replaceCameraOption:e=>n(()=>({cameraOption:e}))}),de={characterUrl:"",vehicleUrl:"",airplaneUrl:"",wheelUrl:"",ridingUrl:""},pe=n=>({urls:de,setUrls:e=>n(t=>({urls:{...t.urls,...e}}))}),P={type:"character",controller:"keyboard",control:"thirdPerson"},_={lerp:{cameraTurn:1,cameraPosition:1}},fe=n=>({mode:P,controllerOptions:_,setMode:e=>n(t=>({mode:{...t.mode,...e}})),setControllerOptions:e=>n(t=>({controllerOptions:{...t.controllerOptions,...e}})),resetMode:()=>n(()=>({mode:P,controllerOptions:_}))}),me=n=>({sizes:{},setSizes:e=>n(t=>({sizes:e(t.sizes)}))}),he=n=>({rideable:{},setRideable:(e,t)=>n(s=>{const a={...s.rideable[e]??{objectkey:e},...t,objectkey:e};return{rideable:{...s.rideable,[e]:a}}}),removeRideable:e=>n(t=>{const s={...t.rideable};return delete s[e],{rideable:s}})}),ge={render:{calls:0,triangles:0,points:0,lines:0},engine:{geometries:0,textures:0,programs:0}},be=n=>({performance:ge,setPerformance:e=>n({performance:e})}),j={walkSpeed:10,runSpeed:20,jumpSpeed:15,jumpGravityScale:2.4,normalGravityScale:1,airDamping:.1,stopDamping:2,maxSpeed:10,accelRatio:2,brakeRatio:5,gravityScale:.3,angleDelta:new k.Vector3(.02,.02,.02),maxAngle:new k.Vector3(Math.PI/6,Math.PI,Math.PI/6),linearDamping:.9},we=n=>({physics:j,setPhysics:e=>n(t=>({physics:{...t.physics,...e}})),resetPhysics:()=>n({physics:j})}),F={character:{current:"idle",default:"idle",store:{}},vehicle:{current:"idle",default:"idle",store:{}},airplane:{current:"idle",default:"idle",store:{}}},Se=n=>({animationState:F,setAnimation:(e,t)=>{n(s=>({animationState:{...s.animationState,[e]:{...s.animationState[e],current:t}}}))},resetAnimations:()=>n(()=>({animationState:F})),setAnimationAction:(e,t,s)=>n(r=>({animationState:{...r.animationState,[e]:{...r.animationState[e],store:{...r.animationState[e].store,[t]:s}}}}))});var Me=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Oe=(n,e,t)=>e in n?Me(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ie=(n,e,t,s)=>{for(var r=s>1?void 0:s?ye(e,t):e,a=n.length-1,i;a>=0;a--)(i=n[a])&&(r=i(r)||r);return r},ve=(n,e,t)=>Oe(n,e+"",t);const Te=["forward","backward","leftward","rightward","shift","space","keyZ","keyR","keyF","keyE","escape"],Ae=["left","right","middle"];let f=class extends h{config;eventCallbacks;constructor(){super({keyboard:{forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1},mouse:{target:new l.Vector3,angle:0,isActive:!1,shouldRun:!1,isLookAround:!1,buttons:{left:!1,right:!1,middle:!1},wheel:0,position:new l.Vector2},gamepad:{connected:!1,leftStick:new l.Vector2,rightStick:new l.Vector2,triggers:{left:0,right:0},buttons:{},vibration:{weak:0,strong:0}},touch:{touches:[],gestures:{pinch:1,rotation:0,pan:new l.Vector2}},lastUpdate:0,isActive:!0},{inputLatency:0,frameTime:0,eventCount:0,activeInputs:[],performanceScore:100,lastUpdate:0}),this.config=this.createDefaultConfig(),this.eventCallbacks=new Map}static getInstance(){return f.instance||(f.instance=new f),f.instance}performUpdate(n){}createUpdateArgs(n){return this.createDefaultUpdateArgs(n)}createDefaultConfig(){return{sensitivity:{mouse:1,gamepad:1,touch:1},deadzone:{gamepad:.1,touch:.05},smoothing:{mouse:.1,gamepad:.2},invertY:!1,enableVibration:!0}}getKeyboardRef(){return this.state.keyboard}getMouseRef(){return this.state.mouse}updateKeyboard(n){Object.assign(this.state.keyboard,n),this.updateMetrics(0),this.emitChange("keyboard",n)}updateMouse(n){Object.assign(this.state.mouse,n),this.updateMetrics(0),this.emitChange("mouse",n)}updateGamepad(n){Object.assign(this.state.gamepad,n),this.updateMetrics(0),this.emitChange("gamepad",n)}updateTouch(n){Object.assign(this.state.touch,n),this.updateMetrics(0),this.emitChange("touch",n)}emitChange(n,e){const t=this.eventCallbacks.get(n);if(!(!t||t.length===0))for(const s of t)try{s(e)}catch(r){console.error("InteractionSystem change callback error:",r)}}dispatchInput(n){this.updateMouse(n)}setConfig(n){Object.assign(this.config,n)}getConfig(){return{...this.config}}addEventListener(n,e){this.eventCallbacks.has(n)||this.eventCallbacks.set(n,[]),this.eventCallbacks.get(n).push(e)}removeEventListener(n,e){const t=this.eventCallbacks.get(n);if(t){const s=t.indexOf(e);s>-1&&t.splice(s,1)}}updateMetrics(n){super.updateMetrics(n),this.metrics.eventCount++,this.collectActiveInputs(this.metrics.activeInputs)}collectActiveInputs(n){n.length=0;for(const t of Te)this.state.keyboard[t]&&n.push(`keyboard:${t}`);for(const t of Ae)this.state.mouse.buttons[t]&&n.push(`mouse:${t}`);this.state.gamepad.connected&&n.push("gamepad:connected");const e=this.state.touch.touches.length;e>0&&n.push(`touch:${e}`)}onReset(){super.onReset()}onDispose(){super.onDispose(),this.eventCallbacks.clear(),f.instance=null}};ve(f,"instance",null);f=Ie([K("interaction")],f);const ke="interaction.input";let Ee=()=>f.getInstance();function A(){return Ee()}function De(n={}){return{forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1,...n}}function Ce(n={}){return{target:n.target?.clone?.()??new l.Vector3,angle:n.angle??0,isActive:n.isActive??!1,shouldRun:n.shouldRun??!1,isLookAround:n.isLookAround??!1,buttons:{left:!1,right:!1,middle:!1,...n.buttons},wheel:n.wheel??0,position:n.position?.clone?.()??new l.Vector2}}function Re(n={}){return{connected:n.connected??!1,leftStick:n.leftStick?.clone?.()??new l.Vector2,rightStick:n.rightStick?.clone?.()??new l.Vector2,triggers:{left:0,right:0,...n.triggers},buttons:{...n.buttons},vibration:{weak:0,strong:0,...n.vibration}}}function Ne(n={}){return{touches:n.touches?.map(e=>({id:e.id,position:e.position.clone(),force:e.force}))??[],gestures:{pinch:1,rotation:0,pan:new l.Vector2,...n.gestures,...n.gestures?.pan?{pan:n.gestures.pan.clone()}:{}}}}function Ge(n,e){const{buttons:t,target:s,position:r,...a}=e;Object.assign(n,a),s&&n.target.copy(s),r&&n.position.copy(r),t&&Object.assign(n.buttons,t)}function Pe(n,e){const{leftStick:t,rightStick:s,triggers:r,vibration:a,buttons:i,...o}=e;Object.assign(n,o),t&&n.leftStick.copy(t),s&&n.rightStick.copy(s),r&&Object.assign(n.triggers,r),a&&Object.assign(n.vibration,a),i&&Object.assign(n.buttons,i)}function _e(n,e){const{touches:t,gestures:s}=e;if(t&&(n.touches=t.map(r=>({id:r.id,position:r.position.clone(),force:r.force}))),s){const{pan:r,...a}=s;Object.assign(n.gestures,a),r&&n.gestures.pan.copy(r)}}function C(n){const e=()=>{const t=n.getState();return{keyboard:n.getKeyboardRef(),mouse:n.getMouseRef(),gamepad:t.gamepad,touch:t.touch}};return{getKeyboard:()=>n.getKeyboardRef(),getMouse:()=>n.getMouseRef(),getGamepad:()=>n.getState().gamepad,getTouch:()=>n.getState().touch,updateKeyboard:t=>n.updateKeyboard(t),updateMouse:t=>n.updateMouse(t),updateGamepad:t=>n.updateGamepad(t),updateTouch:t=>n.updateTouch(t),subscribe:t=>{const s=()=>t(e());return n.addEventListener("keyboard",s),n.addEventListener("mouse",s),n.addEventListener("gamepad",s),n.addEventListener("touch",s),s(),()=>{n.removeEventListener("keyboard",s),n.removeEventListener("mouse",s),n.removeEventListener("gamepad",s),n.removeEventListener("touch",s)}}}}class je{system=null;backend=null;unsubscribeFromBackend=null;listeners=new Set;invalidate(){this.unsubscribeFromBackend?.(),this.unsubscribeFromBackend=null,this.backend=null,this.system=null}getKeyboard(){return this.resolveBackend().getKeyboard()}getMouse(){return this.resolveBackend().getMouse()}getGamepad(){return this.resolveBackend().getGamepad?.()??this.resolveDefaultGamepad()}getTouch(){return this.resolveBackend().getTouch?.()??this.resolveDefaultTouch()}updateKeyboard(e){this.resolveSubscribedBackend().updateKeyboard(e)}updateMouse(e){this.resolveSubscribedBackend().updateMouse(e)}updateGamepad(e){this.resolveSubscribedBackend().updateGamepad?.(e)}updateTouch(e){this.resolveSubscribedBackend().updateTouch?.(e)}subscribe(e){return this.listeners.add(e),this.ensureSubscription()||e(this.snapshot()),()=>{this.listeners.delete(e),this.listeners.size===0&&(this.unsubscribeFromBackend?.(),this.unsubscribeFromBackend=null)}}resolveBackend(){const e=A();return(this.system!==e||!this.backend)&&(this.unsubscribeFromBackend?.(),this.unsubscribeFromBackend=null,this.system=e,this.backend=C(e)),this.backend}resolveSubscribedBackend(){const e=this.resolveBackend();return this.listeners.size>0&&this.bindBackend(e),e}ensureSubscription(){const e=this.resolveBackend();return this.bindBackend(e)}bindBackend(e){return this.unsubscribeFromBackend||!e.subscribe?!1:(this.unsubscribeFromBackend=e.subscribe(t=>{this.listeners.forEach(s=>s(t))}),!0)}snapshot(){const e=this.resolveBackend(),t={keyboard:e.getKeyboard(),mouse:e.getMouse()},s=e.getGamepad?.(),r=e.getTouch?.();return s&&(t.gamepad=s),r&&(t.touch=r),t}resolveDefaultGamepad(){return A().getState().gamepad}resolveDefaultTouch(){return A().getState().touch}}const Fe=new je;function g(){return Fe}function $e(){return g()}function Ve(n){return n?C(n):$e()}function Be(n={}){const e=new Set,t={keyboard:De(n.keyboard),mouse:Ce(n.mouse),gamepad:Re(n.gamepad),touch:Ne(n.touch)},s=()=>t,r=()=>{const a=s();e.forEach(i=>i(a))};return{getKeyboard:()=>t.keyboard,getMouse:()=>t.mouse,getGamepad:()=>t.gamepad,getTouch:()=>t.touch,updateKeyboard:a=>{Object.assign(t.keyboard,a),r()},updateMouse:a=>{Ge(t.mouse,a),r()},updateGamepad:a=>{Pe(t.gamepad,a),r()},updateTouch:a=>{_e(t.touch,a),r()},subscribe:a=>(e.add(a),a(s()),()=>{e.delete(a)})}}const $=()=>({keyboard:{forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1},mouse:{target:new l.Vector3,angle:0,isActive:!1,shouldRun:!1,isLookAround:!1,buttons:{left:!1,right:!1,middle:!1},wheel:0,position:new l.Vector2},gamepad:{connected:!1,leftStick:new l.Vector2,rightStick:new l.Vector2,triggers:{left:0,right:0},buttons:{},vibration:{weak:0,strong:0}},touch:{touches:[],gestures:{pinch:1,rotation:0,pan:new l.Vector2}},lastUpdate:0,isActive:!0}),V=()=>({isActive:!1,queue:{actions:[],currentIndex:0,isRunning:!1,isPaused:!1,loop:!1,maxRetries:3},currentAction:null,executionStats:{totalExecuted:0,successRate:100,averageTime:0,errors:[]},settings:{throttle:100,autoStart:!1,trackProgress:!0,showVisualCues:!0}}),B=()=>({isActive:!0,lastCommand:null,commandHistory:[],syncStatus:"idle"}),L=()=>({sensitivity:{mouse:1,gamepad:1,touch:1},deadzone:{gamepad:.1,touch:.05},smoothing:{mouse:.1,gamepad:.2},invertY:!1,enableVibration:!0}),U=()=>({maxConcurrentActions:1,defaultDelay:100,retryDelay:1e3,timeoutDuration:5e3,enableLogging:!0,visualCues:{showPath:!0,showTargets:!0,lineColor:"#00ff00",targetColor:"#ff0000"}}),q=()=>({lastUpdate:0,inputLatency:0,frameTime:0,eventCount:0,activeInputs:[],performanceScore:100}),x=()=>({queueLength:0,executionTime:0,performance:100,memoryUsage:0,errorRate:0});let W=!1;const Le=n=>{if(W)return;W=!0;let e=!1;g().subscribe?.(({keyboard:t,mouse:s,gamepad:r,touch:a})=>{if(!e){e=!0;return}n(i=>({interaction:{...i.interaction,keyboard:t,mouse:s,gamepad:r??i.interaction.gamepad,touch:a??i.interaction.touch}}))})},Ue=n=>(Le(n),{interaction:$(),automation:V(),bridge:B(),config:{interaction:L(),automation:U()},metrics:{interaction:q(),automation:x()},dispatchInput:e=>{g().updateMouse(e)},addAutomationAction:e=>{const t=`action_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,s={...e,id:t,timestamp:Date.now()};return n(r=>({automation:{...r.automation,queue:{...r.automation.queue,actions:[...r.automation.queue.actions,s]}}})),t},removeAutomationAction:e=>n(t=>({automation:{...t.automation,queue:{...t.automation.queue,actions:t.automation.queue.actions.filter(s=>s.id!==e)}}})),startAutomation:()=>n(e=>({automation:{...e.automation,queue:{...e.automation.queue,isRunning:!0,isPaused:!1}}})),pauseAutomation:()=>n(e=>({automation:{...e.automation,queue:{...e.automation.queue,isPaused:!0}}})),resumeAutomation:()=>n(e=>({automation:{...e.automation,queue:{...e.automation.queue,isPaused:!1}}})),stopAutomation:()=>n(e=>({automation:{...e.automation,queue:{...e.automation.queue,isRunning:!1,isPaused:!1,currentIndex:0},currentAction:null}})),clearAutomationQueue:()=>n(e=>({automation:{...e.automation,queue:{...e.automation.queue,actions:[],currentIndex:0}}})),updateAutomationSettings:e=>n(t=>({automation:{...t.automation,settings:{...t.automation.settings,...e}}})),updateInteractionConfig:e=>n(t=>({config:{...t.config,interaction:{...t.config.interaction,...e}}})),updateAutomationConfig:e=>n(t=>({config:{...t.config,automation:{...t.config.automation,...e}}})),updateInteractionMetrics:e=>n(t=>({metrics:{...t.metrics,interaction:{...t.metrics.interaction,...e}}})),updateAutomationMetrics:e=>n(t=>({metrics:{...t.metrics,automation:{...t.metrics.automation,...e}}})),setBridgeStatus:e=>n(t=>({bridge:{...t.bridge,syncStatus:e}})),addCommandToHistory:e=>n(t=>({bridge:{...t.bridge,lastCommand:e,commandHistory:[...t.bridge.commandHistory,e].slice(-100)}})),resetInteractions:()=>n(()=>({interaction:$(),automation:V(),bridge:B(),config:{interaction:L(),automation:U()},metrics:{interaction:q(),automation:x()}})),updateMouse:e=>{g().updateMouse(e)},updateKeyboard:e=>{g().updateKeyboard(e)},updateGamepad:e=>{g().updateGamepad?.(e)},updateTouch:e=>{g().updateTouch?.(e)},setInteractionActive:e=>n(t=>({interaction:{...t.interaction,isActive:e}}))}),qe=n=>({meshes:new Map,currentMeshId:null,addMesh:e=>{n(t=>{const s=new Map(t.meshes);return s.set(e.id,e),{meshes:s}})},removeMesh:e=>{n(t=>{const s=new Map(t.meshes);return s.delete(e),{meshes:s}})},updateMesh:(e,t)=>{n(s=>{const r=s.meshes.get(e);if(r){const a={...r,...t},i=new Map(s.meshes);return i.set(e,a),{meshes:i}}return s})},setCurrentMeshId:e=>{n({currentMeshId:e})},tiles:new Map,addTile:e=>{n(t=>{const s=new Map(t.tiles);return s.set(e.id,e),{tiles:s}})},removeTile:e=>{n(t=>{const s=new Map(t.tiles);return s.delete(e),{tiles:s}})},updateTile:(e,t)=>{n(s=>{const r=s.tiles.get(e);if(r){const a={...r,...t},i=new Map(s.tiles);return i.set(e,a),{tiles:i}}return s})},tileGroups:new Map,addTileGroup:e=>{n(t=>{const s=new Map(t.tileGroups);return s.set(e.id,e),{tileGroups:s}})},removeTileGroup:e=>{n(t=>{const s=new Map(t.tileGroups);s.delete(e);const r=new Map(t.tiles);return r.forEach(a=>{if(a.groupId===e){const{groupId:i,...o}=a;r.set(a.id,o)}}),{tileGroups:s,tiles:r}})},updateTileGroup:(e,t)=>{n(s=>{const r=s.tileGroups.get(e);if(r){const a={...r,...t},i=new Map(s.tileGroups);return i.set(e,a),{tileGroups:i}}return s})},addTileToGroup:(e,t)=>{n(s=>{const r=s.tiles.get(t);if(r&&s.tileGroups.has(e)){const a=new Map(s.tiles);return a.set(t,{...r,groupId:e}),{tiles:a}}return s})},removeTileFromGroup:e=>{n(t=>{const s=t.tiles.get(e);if(s?.groupId){const r=new Map(t.tiles),{groupId:a,...i}=s;return r.set(e,i),{tiles:r}}return t})},walls:new Map,addWall:e=>{n(t=>{const s=new Map(t.walls);return s.set(e.id,e),{walls:s}})},removeWall:e=>{n(t=>{const s=new Map(t.walls);return s.delete(e),{walls:s}})},updateWall:(e,t)=>{n(s=>{const r=s.walls.get(e);if(r){const a={...r,...t},i=new Map(s.walls);return i.set(e,a),{walls:i}}return s})},wallGroups:new Map,addWallGroup:e=>{n(t=>{const s=new Map(t.wallGroups);return s.set(e.id,e),{wallGroups:s}})},removeWallGroup:e=>{n(t=>{const s=new Map(t.wallGroups);s.delete(e);const r=new Map(t.walls);return r.forEach(a=>{if(a.groupId===e){const{groupId:i,...o}=a;r.set(a.id,o)}}),{wallGroups:s,walls:r}})},updateWallGroup:(e,t)=>{n(s=>{const r=s.wallGroups.get(e);if(r){const a={...r,...t},i=new Map(s.wallGroups);return i.set(e,a),{wallGroups:i}}return s})},addWallToGroup:(e,t)=>{n(s=>{const r=s.walls.get(t);if(r&&s.wallGroups.has(e)){const a=new Map(s.walls);return a.set(t,{...r,groupId:e}),{walls:a}}return s})},removeWallFromGroup:e=>{n(t=>{const s=t.walls.get(e);if(s?.groupId){const r=new Map(t.walls),{groupId:a,...i}=s;return r.set(e,i),{walls:r}}return t})},npcs:new Map,addNpc:e=>{n(t=>{const s=new Map(t.npcs);return s.set(e.id,e),{npcs:s}})},removeNpc:e=>{n(t=>{const s=new Map(t.npcs);return s.delete(e),{npcs:s}})},updateNpc:(e,t)=>{n(s=>{const r=s.npcs.get(e);if(r){const a={...r,...t},i=new Map(s.npcs);return i.set(e,a),{npcs:i}}return s})},interactableObjects:new Map,addInteractableObject:e=>{n(t=>{const s=new Map(t.interactableObjects);return s.set(e.id,e),{interactableObjects:s}})},removeInteractableObject:e=>{n(t=>{const s=new Map(t.interactableObjects);return s.delete(e),{interactableObjects:s}})},updateInteractableObject:(e,t)=>{n(s=>{const r=s.interactableObjects.get(e);if(r){const a={...r,...t},i=new Map(s.interactableObjects);return i.set(e,a),{interactableObjects:i}}return s})}}),xe=H.create()(G.devtools(G.subscribeWithSelector((...n)=>({...fe(...n),...pe(...n),...me(...n),...he(...n),...be(...n),...le(...n),...we(...n),...Se(...n),...Ue(...n),...qe(...n)}))));exports.AbstractSystem=h;exports.BridgeFactory=p;exports.BridgeRegistry=m;exports.CAMERA_CONSTANTS=ue;exports.DEFAULT_INTERACTION_INPUT_EXTENSION_ID=ke;exports.DIContainer=b;exports.HandleError=O;exports.ManageRuntime=te;exports.MonitorMemory=ne;exports.Profile=E;exports.RegisterSystem=K;exports.Timeout=se;exports.V3=y;exports.V30=oe;exports.V31=ce;exports.createInteractionInputAdapter=Ve;exports.createInteractionSystemInputBackend=C;exports.createMemoryInputBackend=Be;exports.getPooledVector=D;exports.logger=d;exports.useGaesupStore=xe;
|
|
@@ -433,16 +433,10 @@ new l.Vector3(1, 1, 1);
|
|
|
433
433
|
function W() {
|
|
434
434
|
return se.pop() || new l.Vector3();
|
|
435
435
|
}
|
|
436
|
-
function Ve(n, e, t) {
|
|
437
|
-
const s = n.x - e.x;
|
|
438
|
-
n.y - e.y;
|
|
439
|
-
const a = n.z - e.z;
|
|
440
|
-
return Math.sqrt(s * s + 0 + a * a);
|
|
441
|
-
}
|
|
442
436
|
const O = (n = 0, e = 0, t = 0) => {
|
|
443
437
|
const s = W();
|
|
444
438
|
return s.set(n, e, t), s;
|
|
445
|
-
},
|
|
439
|
+
}, Ve = () => W(), xe = () => O(1, 1, 1), We = {
|
|
446
440
|
FRAME_RATE_LERP_SPEED: 8
|
|
447
441
|
}, u = {
|
|
448
442
|
OFFSET: O(-10, -10, -10),
|
|
@@ -786,7 +780,7 @@ we(f, "instance", null);
|
|
|
786
780
|
f = be([
|
|
787
781
|
ee("interaction")
|
|
788
782
|
], f);
|
|
789
|
-
const
|
|
783
|
+
const qe = "interaction.input";
|
|
790
784
|
let ye = () => f.getInstance();
|
|
791
785
|
function A() {
|
|
792
786
|
return ye();
|
|
@@ -979,10 +973,10 @@ function m() {
|
|
|
979
973
|
function Ge() {
|
|
980
974
|
return m();
|
|
981
975
|
}
|
|
982
|
-
function
|
|
976
|
+
function Ke(n) {
|
|
983
977
|
return n ? q(n) : Ge();
|
|
984
978
|
}
|
|
985
|
-
function
|
|
979
|
+
function Ze(n = {}) {
|
|
986
980
|
const e = /* @__PURE__ */ new Set(), t = {
|
|
987
981
|
keyboard: Oe(n.keyboard),
|
|
988
982
|
mouse: ve(n.mouse),
|
|
@@ -1084,13 +1078,13 @@ const P = () => ({
|
|
|
1084
1078
|
lastCommand: null,
|
|
1085
1079
|
commandHistory: [],
|
|
1086
1080
|
syncStatus: "idle"
|
|
1087
|
-
}),
|
|
1081
|
+
}), F = () => ({
|
|
1088
1082
|
sensitivity: { mouse: 1, gamepad: 1, touch: 1 },
|
|
1089
1083
|
deadzone: { gamepad: 0.1, touch: 0.05 },
|
|
1090
1084
|
smoothing: { mouse: 0.1, gamepad: 0.2 },
|
|
1091
1085
|
invertY: !1,
|
|
1092
1086
|
enableVibration: !0
|
|
1093
|
-
}),
|
|
1087
|
+
}), j = () => ({
|
|
1094
1088
|
maxConcurrentActions: 1,
|
|
1095
1089
|
defaultDelay: 100,
|
|
1096
1090
|
retryDelay: 1e3,
|
|
@@ -1141,8 +1135,8 @@ const Re = (n) => {
|
|
|
1141
1135
|
automation: _(),
|
|
1142
1136
|
bridge: $(),
|
|
1143
1137
|
config: {
|
|
1144
|
-
interaction:
|
|
1145
|
-
automation:
|
|
1138
|
+
interaction: F(),
|
|
1139
|
+
automation: j()
|
|
1146
1140
|
},
|
|
1147
1141
|
metrics: {
|
|
1148
1142
|
interaction: L(),
|
|
@@ -1271,8 +1265,8 @@ const Re = (n) => {
|
|
|
1271
1265
|
automation: _(),
|
|
1272
1266
|
bridge: $(),
|
|
1273
1267
|
config: {
|
|
1274
|
-
interaction:
|
|
1275
|
-
automation:
|
|
1268
|
+
interaction: F(),
|
|
1269
|
+
automation: j()
|
|
1276
1270
|
},
|
|
1277
1271
|
metrics: {
|
|
1278
1272
|
interaction: L(),
|
|
@@ -1517,7 +1511,7 @@ const Re = (n) => {
|
|
|
1517
1511
|
return s;
|
|
1518
1512
|
});
|
|
1519
1513
|
}
|
|
1520
|
-
}),
|
|
1514
|
+
}), ze = z()(
|
|
1521
1515
|
Y(
|
|
1522
1516
|
H(
|
|
1523
1517
|
(...n) => ({
|
|
@@ -1538,7 +1532,7 @@ const Re = (n) => {
|
|
|
1538
1532
|
export {
|
|
1539
1533
|
g as A,
|
|
1540
1534
|
p as B,
|
|
1541
|
-
|
|
1535
|
+
We as C,
|
|
1542
1536
|
w as D,
|
|
1543
1537
|
v as H,
|
|
1544
1538
|
Le as M,
|
|
@@ -1548,14 +1542,13 @@ export {
|
|
|
1548
1542
|
O as V,
|
|
1549
1543
|
Ue as a,
|
|
1550
1544
|
h as b,
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1545
|
+
Ke as c,
|
|
1546
|
+
qe as d,
|
|
1547
|
+
Ve as e,
|
|
1554
1548
|
xe as f,
|
|
1555
1549
|
W as g,
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
ze as j,
|
|
1550
|
+
q as h,
|
|
1551
|
+
Ze as i,
|
|
1559
1552
|
d as l,
|
|
1560
|
-
|
|
1553
|
+
ze as u
|
|
1561
1554
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),l=require("react"),d=require("@react-three/fiber"),c=require("./gaesupStore-
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),l=require("react"),d=require("@react-three/fiber"),c=require("./gaesupStore-CRQ-tcIz.cjs"),v=require("./index-Bb6WkHKt.cjs"),h=require("./index-BKWqlQ52.cjs");function x(){const r=d.useThree(n=>n.gl),t=c.useGaesupStore(n=>n.setPerformance),o=l.useRef(0);return d.useFrame(()=>{if(o.current++,o.current<30)return;o.current=0;const n=r.info,a="programs"in n?n.programs:void 0;t({render:{calls:n.render.calls,triangles:n.render.triangles,points:n.render.points,lines:n.render.lines},engine:{geometries:n.memory.geometries,textures:n.memory.textures,programs:Array.isArray(a)?a.length:0}})}),null}function g({children:r,showGrid:t,showAxes:o}){return s.jsxs("group",{name:"gaesup-world",children:[t&&s.jsx("gridHelper",{args:[100,100,"#888888","#444444"]}),o&&s.jsx("axesHelper",{args:[10]}),r]})}function f(r){const t=c.useGaesupStore(e=>e.setMode),o=c.useGaesupStore(e=>e.setUrls),n=c.useGaesupStore(e=>e.setCameraOption),a=l.useMemo(()=>{if(!r.urls)return null;const e={};return r.urls.characterUrl!==void 0&&(e.characterUrl=r.urls.characterUrl),r.urls.vehicleUrl!==void 0&&(e.vehicleUrl=r.urls.vehicleUrl),r.urls.airplaneUrl!==void 0&&(e.airplaneUrl=r.urls.airplaneUrl),e.characterUrl===void 0&&r.urls.character!==void 0&&(e.characterUrl=r.urls.character),e.vehicleUrl===void 0&&r.urls.vehicle!==void 0&&(e.vehicleUrl=r.urls.vehicle),e.airplaneUrl===void 0&&r.urls.airplane!==void 0&&(e.airplaneUrl=r.urls.airplane),Object.keys(e).length>0?e:null},[r.urls]);l.useEffect(()=>{a&&o(a)},[a,o]);const u=l.useMemo(()=>{const e=r.cameraOption;if(!e)return null;const m=e.distance??15,i={};return e.xDistance!==void 0?i.xDistance=e.xDistance:e.type==="topDown"?i.xDistance=0:e.type!=="firstPerson"&&(i.xDistance=m),e.yDistance!==void 0?i.yDistance=e.yDistance:i.yDistance=e.height??(e.type==="topDown"?m:8),e.zDistance!==void 0?i.zDistance=e.zDistance:e.type==="topDown"?i.zDistance=0:e.type!=="firstPerson"&&(i.zDistance=m),e.fov!==void 0&&(i.fov=e.fov),e.zoom!==void 0&&(i.zoom=e.zoom),e.enableZoom!==void 0&&(i.enableZoom=e.enableZoom),e.minZoom!==void 0&&(i.minZoom=e.minZoom),e.maxZoom!==void 0&&(i.maxZoom=e.maxZoom),e.zoomSpeed!==void 0&&(i.zoomSpeed=e.zoomSpeed),e.enableCollision!==void 0&&(i.enableCollision=e.enableCollision),e.smoothness!==void 0&&(i.smoothing={position:e.smoothness,rotation:e.smoothness,fov:e.smoothness}),i},[r.cameraOption]);return l.useLayoutEffect(()=>{r.mode&&t(r.mode),r.cameraOption&&t({control:r.cameraOption.type}),u&&n(u)},[u,r.cameraOption,r.mode,n,t]),r.runtime?s.jsx(v.GaesupRuntimeProvider,{runtime:r.runtime,revision:r.runtimeRevision??0,children:r.children}):r.children}const U=f;function D({children:r,showGrid:t,showAxes:o}){return s.jsxs(l.Suspense,{fallback:null,children:[s.jsx(h.Camera,{}),s.jsx(x,{}),s.jsx(g,{showGrid:t??!1,showAxes:o??!1,children:r})]})}exports.GaesupWorldContent=D;exports.WorldConfigProvider=f;exports.WorldContainer=U;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
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
|
-
import { u as l } from "./gaesupStore-
|
|
5
|
-
import { T as x } from "./index-
|
|
6
|
-
import { C as y } from "./index-
|
|
4
|
+
import { u as l } from "./gaesupStore-x2iiDzsY.js";
|
|
5
|
+
import { T as x } from "./index-DmHVuHAr.js";
|
|
6
|
+
import { C as y } from "./index-jFtghT-b.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(() => {
|
|
@@ -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-Df7dmsEw.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";
|