gaesup-world 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blueprints-editor.cjs +1 -1
- package/dist/blueprints-editor.js +3 -3
- package/dist/blueprints.js +3 -3
- package/dist/core/animation/core/AnimationSystem.d.ts +0 -1
- package/dist/core/motions/entities/refs/types.d.ts +2 -1
- package/dist/editor.cjs +1 -1
- package/dist/editor.js +3 -3
- package/dist/{index-BTMn3XG3.js → index-B0hl0p1Z.js} +1 -1
- package/dist/{index-D7m8-PMj.js → index-B2hAamTj.js} +2 -2
- package/dist/index-BKqky34r.js +319 -0
- package/dist/{index-CNZKzWcj.js → index-B_IfvQvL.js} +1 -1
- package/dist/index-C-4Q2Amk.cjs +1 -0
- package/dist/{index-YipPPpo3.js → index-C-wwuvo7.js} +606 -637
- package/dist/index-CJj-Z7Jr.cjs +1 -0
- package/dist/index-D1hpjfAw.cjs +1 -0
- package/dist/{index-DohsnUt-.cjs → index-DHZJyO9k.cjs} +1 -1
- package/dist/{index-BPONQEKM.js → index-FQgcO1SU.js} +1 -1
- package/dist/index-co-QAQz9.cjs +1 -0
- package/dist/{index-BHhDgXJv.cjs → index-syAx2qzT.cjs} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1128 -1254
- package/dist/network.cjs +1 -1
- package/dist/network.js +4 -4
- package/dist/{plugin-CoV-RDBc.js → plugin--mlpG6-U.js} +13 -13
- package/dist/{plugin-DCDfy4Pk.cjs → plugin-CS2nMv9n.cjs} +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +7 -7
- package/dist/{useSpawnFromBlueprint-BxRHlpvL.js → useSpawnFromBlueprint-TYxXKoM5.js} +5 -4
- package/package.json +4 -4
- package/dist/index-CYlmKzCB.cjs +0 -1
- package/dist/index-DfkoTTUv.js +0 -321
- package/dist/index-DvS9OAwO.cjs +0 -1
- package/dist/index-OkIWS7So.cjs +0 -1
- package/dist/index-T4Wcvuuh.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-DvS9OAwO.cjs"),V=require("./index-CYlmKzCB.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-aIQsqI3Q.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-2zKBYTYo.cjs"),R=require("./index-C-4Q2Amk.cjs"),V=require("./index-D1hpjfAw.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
|
|
@@ -1,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-TYxXKoM5.js";
|
|
4
4
|
import { Environment as H, Grid as q } from "@react-three/drei";
|
|
5
5
|
import { Canvas as X } from "@react-three/fiber";
|
|
6
6
|
import { Physics as ee, euler as te, RigidBody as ie } from "@react-three/rapier";
|
|
7
7
|
import * as re from "three";
|
|
8
8
|
import { u as J } from "./gaesupStore-DTu0tYBp.js";
|
|
9
|
-
import { u as ne, C as ae, a as se, G as oe } from "./index-
|
|
10
|
-
import { C as le } from "./index-
|
|
9
|
+
import { u as ne, C as ae, a as se, G as oe } from "./index-BKqky34r.js";
|
|
10
|
+
import { C as le } from "./index-B0hl0p1Z.js";
|
|
11
11
|
const w = (t) => t?.type === "character";
|
|
12
12
|
function ce({ blueprint: t }) {
|
|
13
13
|
const d = J((n) => n.setUrls), b = J((n) => n.setCameraOption), r = J((n) => n.setMode), h = J((n) => n.mode), [l, u] = g(20), c = w(t) ? t.controls?.clickToMove ?? !0 : !1, C = w(t) ? t.controls?.enableKeyboard ?? !0 : !1, O = w(t) ? t.controls?.enableMouse ?? !0 : !1;
|
package/dist/blueprints.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as x } from "./useSpawnFromBlueprint-
|
|
2
|
-
import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-
|
|
1
|
+
import { b as x } from "./useSpawnFromBlueprint-TYxXKoM5.js";
|
|
2
|
+
import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-TYxXKoM5.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-TYxXKoM5.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,7 +18,6 @@ export declare class AnimationSystem extends AbstractSystem<AnimationSystemState
|
|
|
18
18
|
initializeMixer(object: THREE.Object3D): void;
|
|
19
19
|
addAnimation(name: string, clip: THREE.AnimationClip): void;
|
|
20
20
|
registerAction(name: string, action: THREE.AnimationAction): void;
|
|
21
|
-
private resolveActionName;
|
|
22
21
|
playAnimation(name: string, fadeInDuration?: number): void;
|
|
23
22
|
stopAnimation(): void;
|
|
24
23
|
setWeight(weight: number): void;
|
|
@@ -18,7 +18,7 @@ export type ModelRendererProps = {
|
|
|
18
18
|
};
|
|
19
19
|
export type InnerGroupRefType = {
|
|
20
20
|
children?: React.ReactNode;
|
|
21
|
-
|
|
21
|
+
modelChildren?: React.ReactNode;
|
|
22
22
|
objectNode?: THREE.Object3D;
|
|
23
23
|
animationRef: RefObject<THREE.Object3D | null | undefined>;
|
|
24
24
|
nodes: Record<string, THREE.Object3D>;
|
|
@@ -26,6 +26,7 @@ export type InnerGroupRefType = {
|
|
|
26
26
|
skeleton?: THREE.Skeleton | null | undefined;
|
|
27
27
|
componentType?: string;
|
|
28
28
|
modelYawOffset?: number;
|
|
29
|
+
modelScale?: THREE.Vector3 | [number, number, number] | number;
|
|
29
30
|
isActive?: boolean;
|
|
30
31
|
ridingUrl?: string;
|
|
31
32
|
offset?: THREE.Vector3;
|
package/dist/editor.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-DCDfy4Pk.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-OkIWS7So.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-CS2nMv9n.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;
|
package/dist/editor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import { g as _ } from "./plugin-
|
|
3
|
-
import { A, s as C, y as G, w as U, F as f, z as N, D as O, I as v, H as y, K as W, B as x, x as w, v as F, U as b, J as h, C as M, _ as z, X as H, $ as k, a0 as K, a1 as V, ac as j, ad as J, ae as q, a8 as X, af as $, ag as Q, ah as Y, ai as Z, aj as aa, ak as ea, al as ia, am as ta, an as ra, ao as sa, E as na, a as oa, b as la, t as ua, aq as da, ap as ca, G as _a, q as Ea, N as Ta, a6 as Sa, M as Ia, P as La, R as ma, j as Da, k as pa, l as Ba, m as ga, p as Ra, n as Pa, o as Aa, S as Ca, T as Ga, V as Ua, W as fa, O as Na, a4 as Oa, as as va, aa as ya, a3 as Wa, at as xa, ab as wa, a2 as Fa, Z as ba, Q as ha, c as Ma, d as za, h as Ha, ax as ka, a9 as Ka, ar as Va, aD as ja, az as Ja, e as qa, aE as Xa, Y as $a, au as Qa, a7 as Ya, L as Za, ay as ae, i as ee, av as ie, r as te, aA as re, aB as se, aF as ne, aw as oe, a5 as le, aC as ue, u as de, f as ce } from "./plugin-
|
|
2
|
+
import { g as _ } from "./plugin--mlpG6-U.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--mlpG6-U.js";
|
|
4
4
|
import { useMemo as E } from "react";
|
|
5
5
|
import { useFrame as T } from "@react-three/fiber";
|
|
6
6
|
import * as d from "three";
|
|
7
|
-
import { Q as Ee, S as Te, R as Se, O as Ie, L as Le, P as me, N as De, M as pe, I as Be, K as ge, H as Re, J as Pe, a as Ae, b as Ce, e as Ge, d as Ue, f as fe, n as Ne, o as Oe, c as ve, r as ye, g as We, h as xe, i as we, j as Fe, k as be, l as he, m as Me, F as ze, p as He, q as ke, s as Ke, u as Ve, t as je, v as Je, w as qe, x as Xe, y as $e, z as Qe, G as Ye, A as Ze, B as ai, C as ei, D as ii, E as ti } from "./index-
|
|
7
|
+
import { Q as Ee, S as Te, R as Se, O as Ie, L as Le, P as me, N as De, M as pe, I as Be, K as ge, H as Re, J as Pe, a as Ae, b as Ce, e as Ge, d as Ue, f as fe, n as Ne, o as Oe, c as ve, r as ye, g as We, h as xe, i as we, j as Fe, k as be, l as he, m as Me, F as ze, p as He, q as ke, s as Ke, u as Ve, t as je, v as Je, w as qe, x as Xe, y as $e, z as Qe, G as Ye, A as Ze, B as ai, C as ei, D as ii, E as ti } from "./index-C-wwuvo7.js";
|
|
8
8
|
import { H as t, P as o } from "./gaesupStore-DTu0tYBp.js";
|
|
9
9
|
import { C as si, H as ni, c as oi, l as li, v as ui, a as di } from "./loader-C3ZwumCe.js";
|
|
10
10
|
var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, r = (e, a, i, l) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef as h, useEffect as b, useCallback as A, useMemo as ut, useLayoutEffect as J } from "react";
|
|
2
2
|
import { useFrame as ct, useThree as mt } from "@react-three/fiber";
|
|
3
3
|
import * as a from "three";
|
|
4
|
-
import { V as dt, G as ht, W as gt } from "./index-
|
|
4
|
+
import { V as dt, G as ht, W as gt } from "./index-C-wwuvo7.js";
|
|
5
5
|
import { H, P as G, C as pt, M as vt, u as U } from "./gaesupStore-DTu0tYBp.js";
|
|
6
6
|
import "reflect-metadata";
|
|
7
7
|
import yt from "mitt";
|
|
@@ -2,8 +2,8 @@ import { jsx as s, jsxs as u } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef as d, useMemo as f, useEffect as v, useLayoutEffect as h, Suspense as g } from "react";
|
|
3
3
|
import { useThree as U, useFrame as D } from "@react-three/fiber";
|
|
4
4
|
import { u as l } from "./gaesupStore-DTu0tYBp.js";
|
|
5
|
-
import { T as x } from "./index-
|
|
6
|
-
import { C as y } from "./index-
|
|
5
|
+
import { T as x } from "./index-C-wwuvo7.js";
|
|
6
|
+
import { C as y } from "./index-B0hl0p1Z.js";
|
|
7
7
|
function C() {
|
|
8
8
|
const r = U((o) => o.gl), t = l((o) => o.setPerformance), n = d(0);
|
|
9
9
|
return D(() => {
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { jsx as m, jsxs as E, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as P, useState as C, useEffect as K, useMemo as x, useCallback as I, memo as U } from "react";
|
|
3
|
+
import * as S from "three";
|
|
4
|
+
import { Line as L } from "@react-three/drei";
|
|
5
|
+
import { V as T, G as z, W as N, X as F, Y as A, Z as V, U as q, _ as W } from "./index-C-wwuvo7.js";
|
|
6
|
+
import { useFrame as Z } from "@react-three/fiber";
|
|
7
|
+
import "reflect-metadata";
|
|
8
|
+
import { B as j, u as k } from "./gaesupStore-DTu0tYBp.js";
|
|
9
|
+
import { vec3 as Y } from "@react-three/rapier";
|
|
10
|
+
import { u as _ } from "./index-B0hl0p1Z.js";
|
|
11
|
+
const H = () => ({
|
|
12
|
+
position: new S.Vector3(0, 0, 0),
|
|
13
|
+
velocity: new S.Vector3(0, 0, 0),
|
|
14
|
+
rotation: new S.Euler(0, 0, 0),
|
|
15
|
+
isMoving: !1,
|
|
16
|
+
isGrounded: !1,
|
|
17
|
+
speed: 0,
|
|
18
|
+
height: 2
|
|
19
|
+
// Default character height
|
|
20
|
+
});
|
|
21
|
+
function X(e = {}) {
|
|
22
|
+
const { updateInterval: d = 0, entityId: f } = e, l = P(null);
|
|
23
|
+
l.current || (l.current = H());
|
|
24
|
+
const [, g] = C(0), r = P(0), w = P(0), h = P({ x: 0, y: 0, z: 0 }), y = P(void 0), v = P(null), { activeState: R, gameStates: p } = T(), s = (u) => {
|
|
25
|
+
if (f) return f;
|
|
26
|
+
if (y.current) return y.current;
|
|
27
|
+
const n = u.getActiveEntities();
|
|
28
|
+
return y.current = n[0], y.current;
|
|
29
|
+
};
|
|
30
|
+
return K(() => {
|
|
31
|
+
y.current = void 0, v.current = j.getOrCreate("motion");
|
|
32
|
+
const u = v.current;
|
|
33
|
+
if (!u) return;
|
|
34
|
+
const n = u.subscribe((i, t) => {
|
|
35
|
+
const a = s(u);
|
|
36
|
+
if (!a || t !== a) return;
|
|
37
|
+
const c = performance.now();
|
|
38
|
+
if (w.current = c, d > 0 && c - r.current < d) return;
|
|
39
|
+
r.current = c;
|
|
40
|
+
const o = l.current;
|
|
41
|
+
o.position.copy(i.position), o.velocity.copy(i.velocity), o.rotation.copy(i.rotation), o.isMoving = i.isMoving, o.isGrounded = i.isGrounded, o.speed = i.speed, o.height = 2, g((b) => b + 1);
|
|
42
|
+
});
|
|
43
|
+
return () => {
|
|
44
|
+
n();
|
|
45
|
+
};
|
|
46
|
+
}, [f, d]), Z(() => {
|
|
47
|
+
const u = performance.now();
|
|
48
|
+
if (d > 0 && u - r.current < d) return;
|
|
49
|
+
const n = l.current, i = v.current, t = (a) => {
|
|
50
|
+
const c = h.current, o = a.x - c.x, b = a.y - c.y, M = a.z - c.z;
|
|
51
|
+
return o * o + b * b + M * M > 1e-6 ? (c.x = a.x, c.y = a.y, c.z = a.z, !0) : !1;
|
|
52
|
+
};
|
|
53
|
+
if (i) {
|
|
54
|
+
const a = s(i);
|
|
55
|
+
if (!(u - w.current < 16) && a) {
|
|
56
|
+
const o = i.snapshot(a);
|
|
57
|
+
if (o) {
|
|
58
|
+
n.position.copy(o.position), n.velocity.copy(o.velocity), n.rotation.copy(o.rotation), n.isMoving = o.isMoving, n.isGrounded = o.isGrounded, n.speed = o.speed, n.height = 2, r.current = u, t(n.position) && g((b) => b + 1);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
R?.position && (n.position.copy(R.position), R.velocity ? n.velocity.copy(R.velocity) : n.velocity.set(0, 0, 0), R.euler ? n.rotation.copy(R.euler) : n.rotation.set(0, 0, 0), n.isMoving = p?.isMoving || !1, n.isGrounded = p?.isOnTheGround || !1, n.speed = R.velocity ? R.velocity.length() : 0, n.height = 2, r.current = u, t(n.position) && g((a) => a + 1));
|
|
64
|
+
}), l.current;
|
|
65
|
+
}
|
|
66
|
+
const $ = {
|
|
67
|
+
KeyW: "forward",
|
|
68
|
+
KeyA: "leftward",
|
|
69
|
+
KeyS: "backward",
|
|
70
|
+
KeyD: "rightward",
|
|
71
|
+
ShiftLeft: "shift",
|
|
72
|
+
Space: "space",
|
|
73
|
+
KeyZ: "keyZ",
|
|
74
|
+
KeyR: "keyR",
|
|
75
|
+
KeyF: "keyF",
|
|
76
|
+
KeyE: "keyE",
|
|
77
|
+
Escape: "escape"
|
|
78
|
+
}, J = (e = !0, d = !0, f) => {
|
|
79
|
+
const l = k((s) => s.automation?.queue.isRunning), g = k((s) => s.stopAutomation), r = k((s) => s.interaction?.isActive ?? !0), w = z((s) => s.isInEditMode()), h = N(), y = P(/* @__PURE__ */ new Set()), v = x(() => ({ ...$ }), []), R = I(
|
|
80
|
+
(s, u) => {
|
|
81
|
+
if (!r) return !1;
|
|
82
|
+
try {
|
|
83
|
+
return h.updateKeyboard({ [s]: u }), u ? y.current.add(s) : y.current.delete(s), !0;
|
|
84
|
+
} catch (n) {
|
|
85
|
+
return console.error("Error updating keyboard state:", n), !1;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[h, r]
|
|
89
|
+
), p = I(() => {
|
|
90
|
+
y.current.clear(), h.updateKeyboard({
|
|
91
|
+
forward: !1,
|
|
92
|
+
backward: !1,
|
|
93
|
+
leftward: !1,
|
|
94
|
+
rightward: !1,
|
|
95
|
+
shift: !1,
|
|
96
|
+
space: !1,
|
|
97
|
+
keyZ: !1,
|
|
98
|
+
keyR: !1,
|
|
99
|
+
keyF: !1,
|
|
100
|
+
keyE: !1,
|
|
101
|
+
escape: !1
|
|
102
|
+
});
|
|
103
|
+
}, [h]);
|
|
104
|
+
return K(() => {
|
|
105
|
+
(!r || w) && p();
|
|
106
|
+
}, [p, r, w]), K(() => {
|
|
107
|
+
const s = (t, a) => {
|
|
108
|
+
const c = v[t.code];
|
|
109
|
+
if (!c) return;
|
|
110
|
+
if (!r || w) {
|
|
111
|
+
a && t.preventDefault(), p();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const o = y.current.has(t.code);
|
|
115
|
+
a && !o ? (y.current.add(t.code), t.code === "Space" && t.preventDefault(), d && l && (c === "forward" || c === "backward" || c === "leftward" || c === "rightward") && (g(), h.updateMouse({ isActive: !1, shouldRun: !1 })), h.updateKeyboard({ [c]: !0 })) : !a && o && (y.current.delete(t.code), h.updateKeyboard({ [c]: !1 }));
|
|
116
|
+
}, u = (t) => s(t, !0), n = (t) => s(t, !1), i = () => document.hidden && p();
|
|
117
|
+
return window.addEventListener("keydown", u), window.addEventListener("keyup", n), document.addEventListener("visibilitychange", i), () => {
|
|
118
|
+
window.removeEventListener("keydown", u), window.removeEventListener("keyup", n), document.removeEventListener("visibilitychange", i);
|
|
119
|
+
};
|
|
120
|
+
}, [
|
|
121
|
+
v,
|
|
122
|
+
d,
|
|
123
|
+
g,
|
|
124
|
+
l,
|
|
125
|
+
p,
|
|
126
|
+
r,
|
|
127
|
+
w,
|
|
128
|
+
h
|
|
129
|
+
]), {
|
|
130
|
+
pressedKeys: Array.from(y.current),
|
|
131
|
+
pushKey: R,
|
|
132
|
+
isKeyPressed: (s) => y.current.has(s),
|
|
133
|
+
clearAllKeys: p
|
|
134
|
+
};
|
|
135
|
+
}, D = U(({ points: e, color: d }) => e.length < 2 ? null : /* @__PURE__ */ m(
|
|
136
|
+
L,
|
|
137
|
+
{
|
|
138
|
+
points: e,
|
|
139
|
+
color: d,
|
|
140
|
+
lineWidth: 2,
|
|
141
|
+
dashed: !1
|
|
142
|
+
}
|
|
143
|
+
));
|
|
144
|
+
D.displayName = "PathLine";
|
|
145
|
+
const O = U(() => /* @__PURE__ */ E("group", { children: [
|
|
146
|
+
/* @__PURE__ */ E("mesh", { children: [
|
|
147
|
+
/* @__PURE__ */ m("sphereGeometry", { args: [0.2, 16, 16] }),
|
|
148
|
+
/* @__PURE__ */ m(
|
|
149
|
+
"meshStandardMaterial",
|
|
150
|
+
{
|
|
151
|
+
color: "#00ff88",
|
|
152
|
+
emissive: "#00ff88",
|
|
153
|
+
emissiveIntensity: 0.5,
|
|
154
|
+
transparent: !0,
|
|
155
|
+
opacity: 0.9
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
] }),
|
|
159
|
+
/* @__PURE__ */ E("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
|
|
160
|
+
/* @__PURE__ */ m("ringGeometry", { args: [0.3, 0.5, 8] }),
|
|
161
|
+
/* @__PURE__ */ m(
|
|
162
|
+
"meshStandardMaterial",
|
|
163
|
+
{
|
|
164
|
+
color: "#00ff88",
|
|
165
|
+
transparent: !0,
|
|
166
|
+
opacity: 0.6,
|
|
167
|
+
side: S.DoubleSide
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] })
|
|
171
|
+
] }));
|
|
172
|
+
O.displayName = "TargetMarker";
|
|
173
|
+
function Q() {
|
|
174
|
+
const e = k((t) => t.automation), { position: d } = X(), { mouse: f } = F(), [l, g] = C(() => [...A()]);
|
|
175
|
+
K(() => V(() => {
|
|
176
|
+
g([...A()]);
|
|
177
|
+
}), []);
|
|
178
|
+
const r = f?.target || new S.Vector3(), w = f?.isActive || !1, h = e?.queue || { actions: [], currentIndex: 0 }, y = h.actions || [], v = h.currentIndex || 0, p = d.distanceTo(r) < 1, s = w && !p, u = y.map((t) => t.type === "move" && t.target ? new S.Vector3(t.target.x, t.target.y, t.target.z) : null).filter((t) => t !== null), n = l.length > 0 ? l : [r], i = s ? [d, ...n, ...u] : u.length > 0 ? [d, ...u] : [];
|
|
179
|
+
return /* @__PURE__ */ E("group", { children: [
|
|
180
|
+
s && /* @__PURE__ */ m("group", { position: r, children: /* @__PURE__ */ m(O, {}) }),
|
|
181
|
+
i.length > 1 && /* @__PURE__ */ m(
|
|
182
|
+
D,
|
|
183
|
+
{
|
|
184
|
+
points: i,
|
|
185
|
+
color: v >= 0 ? "#00ff88" : "#ffaa00"
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
y.map((t, a) => {
|
|
189
|
+
if (t.type === "move" && t.target) {
|
|
190
|
+
const c = a === v, o = a < v;
|
|
191
|
+
return /* @__PURE__ */ m(
|
|
192
|
+
"group",
|
|
193
|
+
{
|
|
194
|
+
position: [t.target.x, t.target.y, t.target.z],
|
|
195
|
+
children: /* @__PURE__ */ E("mesh", { children: [
|
|
196
|
+
/* @__PURE__ */ m("sphereGeometry", { args: [0.1, 8, 8] }),
|
|
197
|
+
/* @__PURE__ */ m(
|
|
198
|
+
"meshStandardMaterial",
|
|
199
|
+
{
|
|
200
|
+
color: o ? "#888" : c ? "#ff4444" : "#ffaa00",
|
|
201
|
+
transparent: !0,
|
|
202
|
+
opacity: o ? 0.3 : 0.8
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
] })
|
|
206
|
+
},
|
|
207
|
+
`action-${a}`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
})
|
|
212
|
+
] });
|
|
213
|
+
}
|
|
214
|
+
function ee({ clickerOptions: e }) {
|
|
215
|
+
const { onClick: d } = q(e), f = (l) => {
|
|
216
|
+
l.stopPropagation();
|
|
217
|
+
const { cameraOption: g, setCameraOption: r } = k.getState();
|
|
218
|
+
if (g?.focus) {
|
|
219
|
+
r({ focus: !1 });
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
d(l);
|
|
223
|
+
};
|
|
224
|
+
return /* @__PURE__ */ E(
|
|
225
|
+
"mesh",
|
|
226
|
+
{
|
|
227
|
+
position: [0, 0, 0],
|
|
228
|
+
rotation: [-Math.PI / 2, 0, 0],
|
|
229
|
+
onPointerDown: f,
|
|
230
|
+
visible: !0,
|
|
231
|
+
userData: { intangible: !0 },
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ m("planeGeometry", { args: [1e3, 1e3] }),
|
|
234
|
+
/* @__PURE__ */ m("meshBasicMaterial", { transparent: !0, opacity: 0 })
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
function te({ props: e, children: d }) {
|
|
240
|
+
const f = k((i) => i.mode), { gameStates: l } = T(), g = k((i) => i.rideable), r = k((i) => i.urls), w = z((i) => i.isInEditMode()), h = _();
|
|
241
|
+
if (J(), w || !f || !l || !g || !r || f.type === "character" && !r.characterUrl || f.type === "vehicle" && !r.vehicleUrl || f.type === "airplane" && !r.airplaneUrl) return null;
|
|
242
|
+
const { canRide: y, isRiding: v, currentRideable: R } = l, p = R?.id, s = x(
|
|
243
|
+
() => (p ? g[p]?.offset : void 0) ?? Y(),
|
|
244
|
+
[p, g]
|
|
245
|
+
), n = (() => {
|
|
246
|
+
const i = e.rigidBodyRef ?? h.rigidBodyRef, t = e.outerGroupRef ?? h.outerGroupRef, a = e.innerGroupRef ?? h.innerGroupRef, c = e.colliderRef ?? h.colliderRef, o = {
|
|
247
|
+
isActive: !0,
|
|
248
|
+
componentType: f.type,
|
|
249
|
+
enableRiding: y,
|
|
250
|
+
isRiderOn: v,
|
|
251
|
+
offset: s,
|
|
252
|
+
ref: i,
|
|
253
|
+
outerGroupRef: t,
|
|
254
|
+
innerGroupRef: a,
|
|
255
|
+
colliderRef: c,
|
|
256
|
+
parts: (e.parts || []).filter((G) => !!G.url).map((G) => ({ ...G, url: G.url })),
|
|
257
|
+
...e.onAnimate ? { onAnimate: e.onAnimate } : {},
|
|
258
|
+
...e.onFrame ? { onFrame: e.onFrame } : {},
|
|
259
|
+
...e.onReady ? { onReady: e.onReady } : {},
|
|
260
|
+
...e.onDestroy ? { onDestroy: e.onDestroy } : {},
|
|
261
|
+
...e.onDestory ? { onDestory: e.onDestory } : {},
|
|
262
|
+
...typeof e.baseColor == "string" && e.baseColor.trim().length > 0 ? { baseColor: e.baseColor } : {},
|
|
263
|
+
...Array.isArray(e.excludeBaseNodes) && e.excludeBaseNodes.length > 0 ? { excludeBaseNodes: e.excludeBaseNodes } : {},
|
|
264
|
+
...e.rigidBodyProps ? { rigidBodyProps: e.rigidBodyProps } : {},
|
|
265
|
+
...e.controllerOptions ? { controllerOptions: e.controllerOptions } : {},
|
|
266
|
+
...e.groundRay ? { groundRay: e.groundRay } : {},
|
|
267
|
+
...e.colliderSize ? { colliderSize: e.colliderSize } : {},
|
|
268
|
+
...e.position ? { position: e.position } : {},
|
|
269
|
+
...e.rotation ? { rotation: e.rotation } : {},
|
|
270
|
+
...e.scale ? { scale: e.scale } : {}
|
|
271
|
+
}, b = v && f.type !== "character" ? r.ridingUrl : void 0, M = typeof b == "string" && b.length > 0 ? { ridingUrl: b } : {};
|
|
272
|
+
switch (f.type) {
|
|
273
|
+
case "character":
|
|
274
|
+
return {
|
|
275
|
+
...o,
|
|
276
|
+
url: r.characterUrl || ""
|
|
277
|
+
};
|
|
278
|
+
case "vehicle":
|
|
279
|
+
return {
|
|
280
|
+
...o,
|
|
281
|
+
...M,
|
|
282
|
+
url: r.vehicleUrl || "",
|
|
283
|
+
wheelUrl: r.wheelUrl
|
|
284
|
+
};
|
|
285
|
+
case "airplane":
|
|
286
|
+
return {
|
|
287
|
+
...o,
|
|
288
|
+
...M,
|
|
289
|
+
url: r.airplaneUrl || ""
|
|
290
|
+
};
|
|
291
|
+
default:
|
|
292
|
+
return {
|
|
293
|
+
...o,
|
|
294
|
+
url: r.characterUrl || ""
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
})();
|
|
298
|
+
return f.type === "character" && l.isRiding ? null : /* @__PURE__ */ m(W, { ...n, children: d });
|
|
299
|
+
}
|
|
300
|
+
function de(e) {
|
|
301
|
+
const { clickToMove: d, children: f, clickerOptions: l, ...g } = e, r = {
|
|
302
|
+
...l ?? {},
|
|
303
|
+
...l?.agentRadius === void 0 && g.colliderSize?.radius !== void 0 ? { agentRadius: g.colliderSize.radius } : {}
|
|
304
|
+
};
|
|
305
|
+
return /* @__PURE__ */ m(te, { props: g, children: /* @__PURE__ */ E(B, { children: [
|
|
306
|
+
d && /* @__PURE__ */ E(B, { children: [
|
|
307
|
+
/* @__PURE__ */ m(ee, { clickerOptions: r }),
|
|
308
|
+
/* @__PURE__ */ m(Q, {})
|
|
309
|
+
] }),
|
|
310
|
+
f
|
|
311
|
+
] }) });
|
|
312
|
+
}
|
|
313
|
+
export {
|
|
314
|
+
de as C,
|
|
315
|
+
ee as G,
|
|
316
|
+
Q as a,
|
|
317
|
+
X as b,
|
|
318
|
+
J as u
|
|
319
|
+
};
|
|
@@ -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-FQgcO1SU.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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),h=require("react"),A=require("three"),O=require("@react-three/drei"),S=require("./index-CJj-Z7Jr.cjs"),T=require("@react-three/fiber"),E=require("./gaesupStore-2zKBYTYo.cjs"),D=require("@react-three/rapier"),z=require("./index-D1hpjfAw.cjs");function U(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const u=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(c,a,u.get?u:{enumerable:!0,get:()=>e[a]})}}return c.default=e,Object.freeze(c)}const k=U(A),q=()=>({position:new k.Vector3(0,0,0),velocity:new k.Vector3(0,0,0),rotation:new k.Euler(0,0,0),isMoving:!1,isGrounded:!1,speed:0,height:2});function G(e={}){const{updateInterval:c=0,entityId:a}=e,u=h.useRef(null);u.current||(u.current=q());const[,p]=h.useState(0),r=h.useRef(0),x=h.useRef(0),m=h.useRef({x:0,y:0,z:0}),g=h.useRef(void 0),R=h.useRef(null),{activeState:b,gameStates:v}=S.useStateSystem(),l=y=>{if(a)return a;if(g.current)return g.current;const n=y.getActiveEntities();return g.current=n[0],g.current};return h.useEffect(()=>{g.current=void 0,R.current=E.BridgeFactory.getOrCreate("motion");const y=R.current;if(!y)return;const n=y.subscribe((s,t)=>{const d=l(y);if(!d||t!==d)return;const f=performance.now();if(x.current=f,c>0&&f-r.current<c)return;r.current=f;const o=u.current;o.position.copy(s.position),o.velocity.copy(s.velocity),o.rotation.copy(s.rotation),o.isMoving=s.isMoving,o.isGrounded=s.isGrounded,o.speed=s.speed,o.height=2,p(w=>w+1)});return()=>{n()}},[a,c]),T.useFrame(()=>{const y=performance.now();if(c>0&&y-r.current<c)return;const n=u.current,s=R.current,t=d=>{const f=m.current,o=d.x-f.x,w=d.y-f.y,P=d.z-f.z;return o*o+w*w+P*P>1e-6?(f.x=d.x,f.y=d.y,f.z=d.z,!0):!1};if(s){const d=l(s);if(!(y-x.current<16)&&d){const o=s.snapshot(d);if(o){n.position.copy(o.position),n.velocity.copy(o.velocity),n.rotation.copy(o.rotation),n.isMoving=o.isMoving,n.isGrounded=o.isGrounded,n.speed=o.speed,n.height=2,r.current=y,t(n.position)&&p(w=>w+1);return}}}b?.position&&(n.position.copy(b.position),b.velocity?n.velocity.copy(b.velocity):n.velocity.set(0,0,0),b.euler?n.rotation.copy(b.euler):n.rotation.set(0,0,0),n.isMoving=v?.isMoving||!1,n.isGrounded=v?.isOnTheGround||!1,n.speed=b.velocity?b.velocity.length():0,n.height=2,r.current=y,t(n.position)&&p(d=>d+1))}),u.current}const N={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},M=(e=!0,c=!0,a)=>{const u=E.useGaesupStore(l=>l.automation?.queue.isRunning),p=E.useGaesupStore(l=>l.stopAutomation),r=E.useGaesupStore(l=>l.interaction?.isActive??!0),x=S.useBuildingStore(l=>l.isInEditMode()),m=S.useInputBackend(),g=h.useRef(new Set),R=h.useMemo(()=>({...N}),[]),b=h.useCallback((l,y)=>{if(!r)return!1;try{return m.updateKeyboard({[l]:y}),y?g.current.add(l):g.current.delete(l),!0}catch(n){return console.error("Error updating keyboard state:",n),!1}},[m,r]),v=h.useCallback(()=>{g.current.clear(),m.updateKeyboard({forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1})},[m]);return h.useEffect(()=>{(!r||x)&&v()},[v,r,x]),h.useEffect(()=>{const l=(t,d)=>{const f=R[t.code];if(!f)return;if(!r||x){d&&t.preventDefault(),v();return}const o=g.current.has(t.code);d&&!o?(g.current.add(t.code),t.code==="Space"&&t.preventDefault(),c&&u&&(f==="forward"||f==="backward"||f==="leftward"||f==="rightward")&&(p(),m.updateMouse({isActive:!1,shouldRun:!1})),m.updateKeyboard({[f]:!0})):!d&&o&&(g.current.delete(t.code),m.updateKeyboard({[f]:!1}))},y=t=>l(t,!0),n=t=>l(t,!1),s=()=>document.hidden&&v();return window.addEventListener("keydown",y),window.addEventListener("keyup",n),document.addEventListener("visibilitychange",s),()=>{window.removeEventListener("keydown",y),window.removeEventListener("keyup",n),document.removeEventListener("visibilitychange",s)}},[R,c,p,u,v,r,x,m]),{pressedKeys:Array.from(g.current),pushKey:b,isKeyPressed:l=>g.current.has(l),clearAllKeys:v}},C=h.memo(({points:e,color:c})=>e.length<2?null:i.jsx(O.Line,{points:e,color:c,lineWidth:2,dashed:!1}));C.displayName="PathLine";const K=h.memo(()=>i.jsxs("group",{children:[i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.2,16,16]}),i.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),i.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[i.jsx("ringGeometry",{args:[.3,.5,8]}),i.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:k.DoubleSide})]})]}));K.displayName="TargetMarker";function B(){const e=E.useGaesupStore(t=>t.automation),{position:c}=G(),{mouse:a}=S.useInteractionSystem(),[u,p]=h.useState(()=>[...S.getClickNavigationRoute()]);h.useEffect(()=>S.subscribeClickNavigationRoute(()=>{p([...S.getClickNavigationRoute()])}),[]);const r=a?.target||new k.Vector3,x=a?.isActive||!1,m=e?.queue||{actions:[],currentIndex:0},g=m.actions||[],R=m.currentIndex||0,v=c.distanceTo(r)<1,l=x&&!v,y=g.map(t=>t.type==="move"&&t.target?new k.Vector3(t.target.x,t.target.y,t.target.z):null).filter(t=>t!==null),n=u.length>0?u:[r],s=l?[c,...n,...y]:y.length>0?[c,...y]:[];return i.jsxs("group",{children:[l&&i.jsx("group",{position:r,children:i.jsx(K,{})}),s.length>1&&i.jsx(C,{points:s,color:R>=0?"#00ff88":"#ffaa00"}),g.map((t,d)=>{if(t.type==="move"&&t.target){const f=d===R,o=d<R;return i.jsx("group",{position:[t.target.x,t.target.y,t.target.z],children:i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.1,8,8]}),i.jsx("meshStandardMaterial",{color:o?"#888":f?"#ff4444":"#ffaa00",transparent:!0,opacity:o?.3:.8})]})},`action-${d}`)}return null})]})}function I({clickerOptions:e}){const{onClick:c}=S.useClicker(e),a=u=>{u.stopPropagation();const{cameraOption:p,setCameraOption:r}=E.useGaesupStore.getState();if(p?.focus){r({focus:!1});return}c(u)};return i.jsxs("mesh",{position:[0,0,0],rotation:[-Math.PI/2,0,0],onPointerDown:a,visible:!0,userData:{intangible:!0},children:[i.jsx("planeGeometry",{args:[1e3,1e3]}),i.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function F({props:e,children:c}){const a=E.useGaesupStore(s=>s.mode),{gameStates:u}=S.useStateSystem(),p=E.useGaesupStore(s=>s.rideable),r=E.useGaesupStore(s=>s.urls),x=S.useBuildingStore(s=>s.isInEditMode()),m=z.useGenericRefs();if(M(),x||!a||!u||!p||!r||a.type==="character"&&!r.characterUrl||a.type==="vehicle"&&!r.vehicleUrl||a.type==="airplane"&&!r.airplaneUrl)return null;const{canRide:g,isRiding:R,currentRideable:b}=u,v=b?.id,l=h.useMemo(()=>(v?p[v]?.offset:void 0)??D.vec3(),[v,p]),n=(()=>{const s=e.rigidBodyRef??m.rigidBodyRef,t=e.outerGroupRef??m.outerGroupRef,d=e.innerGroupRef??m.innerGroupRef,f=e.colliderRef??m.colliderRef,o={isActive:!0,componentType:a.type,enableRiding:g,isRiderOn:R,offset:l,ref:s,outerGroupRef:t,innerGroupRef:d,colliderRef:f,parts:(e.parts||[]).filter(j=>!!j.url).map(j=>({...j,url:j.url})),...e.onAnimate?{onAnimate:e.onAnimate}:{},...e.onFrame?{onFrame:e.onFrame}:{},...e.onReady?{onReady:e.onReady}:{},...e.onDestroy?{onDestroy:e.onDestroy}:{},...e.onDestory?{onDestory:e.onDestory}:{},...typeof e.baseColor=="string"&&e.baseColor.trim().length>0?{baseColor:e.baseColor}:{},...Array.isArray(e.excludeBaseNodes)&&e.excludeBaseNodes.length>0?{excludeBaseNodes:e.excludeBaseNodes}:{},...e.rigidBodyProps?{rigidBodyProps:e.rigidBodyProps}:{},...e.controllerOptions?{controllerOptions:e.controllerOptions}:{},...e.groundRay?{groundRay:e.groundRay}:{},...e.colliderSize?{colliderSize:e.colliderSize}:{},...e.position?{position:e.position}:{},...e.rotation?{rotation:e.rotation}:{},...e.scale?{scale:e.scale}:{}},w=R&&a.type!=="character"?r.ridingUrl:void 0,P=typeof w=="string"&&w.length>0?{ridingUrl:w}:{};switch(a.type){case"character":return{...o,url:r.characterUrl||""};case"vehicle":return{...o,...P,url:r.vehicleUrl||"",wheelUrl:r.wheelUrl};case"airplane":return{...o,...P,url:r.airplaneUrl||""};default:return{...o,url:r.characterUrl||""}}})();return a.type==="character"&&u.isRiding?null:i.jsx(S.PhysicsEntity,{...n,children:c})}function L(e){const{clickToMove:c,children:a,clickerOptions:u,...p}=e,r={...u??{},...u?.agentRadius===void 0&&p.colliderSize?.radius!==void 0?{agentRadius:p.colliderSize.radius}:{}};return i.jsx(F,{props:p,children:i.jsxs(i.Fragment,{children:[c&&i.jsxs(i.Fragment,{children:[i.jsx(I,{clickerOptions:r}),i.jsx(B,{})]}),a]})})}exports.Clicker=B;exports.ControllerWrapper=L;exports.GroundClicker=I;exports.useKeyboard=M;exports.usePlayerPosition=G;
|