mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-19 20:31:13 +00:00
1 line
No EOL
18 KiB
JavaScript
1 line
No EOL
18 KiB
JavaScript
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./jsx-runtime-BpGWiA-R.js";import{i}from"./react-three-fiber.esm-BccVk4IG.js";import{a}from"./SettingsProvider-Dg81XAbP.js";import{S as o,a as s,d as c,f as l,i as u,l as d,p as f,r as p,t as m}from"./GenericShape-DAZtlj_H.js";import"./logger-CC5j_O4o.js";import"./traditional-ec-lUAFC.js";import{Q as h,Z as g,i as _,o as v,s as y,yt as b}from"./three.module-BRbuBcDx.js";import"./mission-CIAFVbLs.js";import{a as x,i as S,o as C}from"./engineStore-CXPwEu5b.js";import{r as ee}from"./loaders-rPPwBkLs.js";import{n as w}from"./AudioContext-Bb-fZu5u.js";import"./FloatingLabel-D6iwwZhJ.js";import{getCachedAudioBuffer as te,getSoundGeneration as ne,playOneShotSound as re,resolveAudioProfile as ie,trackSound as T,untrackSound as E}from"./AudioEmitter-CuAYR_rn.js";import{t as D}from"./DebugSuspense-B3kNcNBI.js";import{n as O}from"./streamPlaybackStore-_jj5RFzm.js";import{c as ae}from"./globalFogUniforms-BV3x5ZpT.js";import{t as k}from"./ShapeErrorBoundary-D99rpxiY.js";var A=t(),j=e(n(),1),M=.1;function N(e){return-2*Math.atan2(e[1],e[3])}function P(e,t,n,r){if(n)return{animation:`fall`,timeScale:1};if(r)return{animation:`jet`,timeScale:1};if(!e)return{animation:`root`,timeScale:1};let[i,a,o]=e;if(Math.abs(o)>2)return{animation:`root`,timeScale:1};let s=N(t),c=Math.cos(s),l=Math.sin(s),u=i*c+a*l,d=-i*l+a*c,f=d,p=-d,m=-u,h=u,g=Math.max(f,p,m,h);return g<M?{animation:`root`,timeScale:1}:g===f?{animation:`run`,timeScale:1}:g===p?{animation:`back`,timeScale:1}:g===m?{animation:`side`,timeScale:1}:{animation:`side`,timeScale:-1}}var F=-1,I=32,L=1,R=2,z=3,B=4,V=class{states;seqIndexToName;currentStateIndex=0;delayTime=0;lastFireCount=-1;spinTimeScale=0;constructor(e,t){this.states=e,this.seqIndexToName=t,e.length>0&&(this.delayTime=e[0].timeoutValue??0)}get stateIndex(){return this.currentStateIndex}reset(){this.currentStateIndex=0,this.delayTime=this.states.length>0?this.states[0].timeoutValue??0:0,this.lastFireCount=-1}tick(e,t){if(this.states.length===0)return{sequenceName:null,isFiring:!1,spinTimeScale:0,reverse:!1,scaleAnimation:!1,timeoutValue:0,transitioned:!1,soundDataBlockIds:[],stateIndex:-1};let n=this.lastFireCount>=0&&t.fireCount!==this.lastFireCount;this.lastFireCount=t.fireCount;let r=[];if(n){let e=this.states.findIndex(e=>e.fire);if(e>=0&&e!==this.currentStateIndex){this.currentStateIndex=e,this.delayTime=this.states[e].timeoutValue??0;let t=this.states[e].soundDataBlockId;t>=0&&r.push(t)}}this.delayTime-=e;let i=n,a=this.evaluateTickTransitions(t),o=0;for(;a>=0&&o<I;){if(o++,i=!0,a===this.currentStateIndex){this.delayTime=this.states[a].timeoutValue??0;break}let e=this.states[this.currentStateIndex].spin,n=this.delayTime;this.currentStateIndex=a;let s=this.states[a].timeoutValue??0;this.delayTime=s;let c=this.states[a].soundDataBlockId;switch(c>=0&&r.push(c),this.states[a].spin){case L:this.spinTimeScale=0;break;case B:this.spinTimeScale=1;break;case R:e===z&&s>0&&(this.delayTime*=1-n/s);break;case z:e===R&&s>0&&(this.delayTime*=1-n/s);break}a=this.evaluateEntryTransitions(t)}let s=this.states[this.currentStateIndex],c=s.timeoutValue??0;switch(s.spin){case L:this.spinTimeScale=0;break;case R:this.spinTimeScale=c>0?Math.max(0,1-this.delayTime/c):1;break;case B:this.spinTimeScale=1;break;case z:this.spinTimeScale=c>0?Math.max(0,this.delayTime/c):0;break}return{sequenceName:this.resolveSequenceName(s),isFiring:s.fire,spinTimeScale:this.spinTimeScale,reverse:!s.direction,scaleAnimation:s.scaleAnimation,timeoutValue:s.timeoutValue??0,transitioned:i,soundDataBlockIds:r,stateIndex:this.currentStateIndex}}evaluateTickTransitions(e){let t=this.states[this.currentStateIndex],n=this.delayTime<=0;if(!(n||!t.waitForTimeout))return-1;let r=this.evaluateConditions(t,e);if(r!==-1)return r;if(n){let e=t.transitionOnTimeout;if(e!==F)return e}return-1}evaluateEntryTransitions(e){let t=this.states[this.currentStateIndex];return this.evaluateConditions(t,e)}evaluateConditions(e,t){let n=t.loaded?e.transitionOnLoaded:e.transitionOnNotLoaded;if(n!==F)return n;let r=t.ammo?e.transitionOnAmmo:e.transitionOnNoAmmo;if(r!==F)return r;let i=t.target?e.transitionOnTarget:e.transitionOnNoTarget;if(i!==F)return i;let a=t.wet?e.transitionOnWet:e.transitionOnNotWet;if(a!==F)return a;let o=t.triggerDown?e.transitionOnTriggerDown:e.transitionOnTriggerUp;return o===F?-1:o}resolveSequenceName(e){return e.sequence==null||e.sequence<0?null:this.seqIndexToName[e.sequence]??null}},H=r();function U(e){if(!e)return`lookde`;let t=e.toLowerCase();return t.includes(`missile`)?`lookms`:t.includes(`sniper`)?`looksn`:`lookde`}var W=8,G=[`root`,`run`,`back`,`side`,`fall`,`jet`,`jump`,`land`];function K(e,t,n=0){let r=new Map,i=[];for(let n of e){let e=n.indexOf(` `);if(e===-1)continue;let r=n.slice(0,e).toLowerCase(),a=n.slice(e+1).trim().toLowerCase();if(!a||!r.startsWith(t)||!r.endsWith(`.dsq`))continue;let o=r.slice(t.length,-4);o&&i.push({clipName:o,alias:a})}let a=new Set;for(let e=0;e<G.length;e++){let t=G[e];for(let n=0;n<i.length;n++)if(i[n].alias===t){a.add(n),r.set(e,i[n]);break}}let o=W+n;for(let e=0;e<i.length;e++)a.has(e)||(r.set(o,i[e]),o++);return r}var q=new Set(G);function J(e,t,n){let r=e.userData?.dts_sequence_names;if(typeof r!=`string`)return 0;let i;try{i=JSON.parse(r)}catch{return 0}if(!Array.isArray(i)||i.length===0)return 0;let a=new Set;for(let e of t){let t=e.indexOf(` `);if(t===-1)continue;let r=e.slice(0,t).toLowerCase();if(!r.startsWith(n)||!r.endsWith(`.dsq`))continue;let i=r.slice(n.length,-4);i&&a.add(i)}let o=0;for(let e of i){if(a.has(e.toLowerCase()))break;q.has(e.toLowerCase())||o++}return o}function Y(e,t,n){let r=e.current;if(r){E(r);try{r.stop()}catch{}try{r.disconnect()}catch{}n?.remove(r),e.current=null,t.current=-1}}function X({entity:e}){let t=x(),n=e.shapeName??e.dataBlock,r=p(n),a=S(e=>{let t=n?.toLowerCase();return t?e.runtime.sequenceAliases.get(t):void 0}),s=ae(),{clonedScene:l,mixer:b,mount0:ee,mount1:w,mount2:te,iflInitializers:ne}=(0,j.useMemo)(()=>{let e=o(r.scene),t=f(e,void 0,{anisotropy:s});e.traverse(e=>{if(e.isMesh&&e.material){let t=Array.isArray(e.material)?e.material:[e.material];for(let e of t)e.side=0}});let n=new v(e),i=null,a=null,c=null;return e.traverse(e=>{!i&&e.name===`Mount0`&&(i=e),!a&&e.name===`Mount1`&&(a=e),!c&&e.name===`Mount2`&&(c=e)}),{clonedScene:e,mixer:n,mount0:i,mount1:a,mount2:c,iflInitializers:t}},[r,s]);(0,j.useEffect)(()=>()=>{d(l),b.uncacheRoot(l)},[l,b]);let re=(0,j.useRef)(new Map),ie=(0,j.useRef)({head:null,headside:null}),T=(0,j.useRef)(new Map),E=(0,j.useRef)(null),A=(0,j.useRef)({name:`root`,timeScale:1}),M=(0,j.useRef)(!1),N=(0,j.useRef)(void 0),F=(0,j.useMemo)(()=>{let e=t.getState().playback.recording?.streamingPlayback,i=n?.toLowerCase();if(!e||!i)return new Map;let a=e.getShapeConstructorSequences(i);if(!a)return new Map;let o=i.replace(/\.dts$/i,``)+`_`;return K(a,o,J(r.scene,a,o))},[t,n,r.scene]),I=(0,j.useMemo)(()=>{let e=new Map,t=r.scene.userData?.dts_sequence_names,n=r.scene.userData?.dts_sequence_cyclic;if(typeof t==`string`&&typeof n==`string`)try{let r=JSON.parse(t),i=JSON.parse(n),o=new Map;for(let e=0;e<r.length;e++)o.set(r[e].toLowerCase(),i[e]??!0);if(a)for(let[t,n]of a){let r=o.get(n);r!=null&&e.set(t,r)}for(let[t,n]of o)e.has(t)||e.set(t,n)}catch{}return e},[r.scene,a]);(0,j.useEffect)(()=>{let e=C(r.animations,b,a);re.current=e;let t=e.get(`root`);t&&t.play(),A.current={name:`root`,timeScale:1};let n={head:null,headside:null};for(let{key:e,names:t}of[{key:`head`,names:[`head`]},{key:`headside`,names:[`headside`]}]){let i=r.animations.find(e=>t.includes(e.name.toLowerCase()));if(!i)continue;let a=i.clone(),o=Math.round(i.duration*30/2);y.makeClipAdditive(a,o,i,30);let s=b.clipAction(a);s.blendMode=_,s.timeScale=0,s.weight=1,s.play(),n[e]=s}ie.current=n;let i=new Map,o=r.animations.find(e=>e.name.toLowerCase()===`lookde`),s=o?Math.round(o.duration*30/2):0;for(let e of[`lookde`,`lookms`,`looksn`]){let t=r.animations.find(t=>t.name.toLowerCase()===e);if(!t)continue;let n=t.clone(),a=o??t;y.makeClipAdditive(n,s,a,30);let c=b.clipAction(n);c.blendMode=_,c.timeScale=0,c.weight=0,c.play(),i.set(e,c)}T.current=i;let c=i.get(`lookde`);return c&&(c.weight=1,E.current=`lookde`),b.update(0),()=>{b.stopAllAction(),re.current=new Map,ie.current={head:null,headside:null},T.current=new Map,E.current=null}},[b,r.animations,a]),(0,j.useEffect)(()=>{let e=[];for(let{mesh:t,initialize:n}of ne)n(t,()=>O.getState().time).then(t=>e.push(t)).catch(()=>{});return()=>e.forEach(e=>e())},[ne]);let L=(0,j.useRef)(e.weaponShape),[R,z]=(0,j.useState)(e.weaponShape),B=(0,j.useRef)(e.packShape),[V,G]=(0,j.useState)(e.packShape),q=(0,j.useRef)(e.flagShape),[Y,X]=(0,j.useState)(e.flagShape);return i((n,r)=>{e.weaponShape!==L.current&&(L.current=e.weaponShape,z(e.weaponShape)),e.packShape!==B.current&&(B.current=e.packShape,G(e.packShape)),e.flagShape!==q.current&&(q.current=e.flagShape,X(e.flagShape));let i=t.getState().playback,a=i.status===`playing`,o=O.getState().time,s=c(e.keyframes??[],o),l=s?.damageState!=null&&s.damageState>=1,d=re.current;if(l&&!M.current){M.current=!0;let e=s.actionAnim==null?void 0:F.get(s.actionAnim);if(e){let t=d.get(e.clipName);if(t){let n=d.get(A.current.name.toLowerCase());n&&n.fadeOut(u),t.setLoop(g,1),t.clampWhenFinished=!0,t.reset().fadeIn(u).play(),A.current={name:e.clipName,timeScale:1},N.current=s.actionAnim}}}if(!l&&M.current){M.current=!1,N.current=void 0;let e=d.get(A.current.name.toLowerCase());e&&(e.stop(),e.setLoop(h,1/0),e.clampWhenFinished=!1),A.current={name:`root`,timeScale:1};let t=d.get(`root`);t&&t.reset().play()}let f=s?.actionAnim,p=N.current;if(!M.current&&f!==p){N.current=f;let e=f!=null&&f>=W,t=p!=null&&p>=W;if(e){let e=F.get(f);if(e){let t=d.get(e.clipName);if(t){let n=d.get(A.current.name.toLowerCase());n&&n.fadeOut(u),t.setLoop(g,1),t.clampWhenFinished=!0,t.reset().fadeIn(u).play(),A.current={name:e.clipName,timeScale:1}}}}else if(t){let e=F.get(p);if(e){let t=d.get(e.clipName);t&&(t.fadeOut(u),t.setLoop(h,1/0),t.clampWhenFinished=!1)}A.current={name:`root`,timeScale:1};let t=d.get(`root`);t&&t.reset().fadeIn(u).play()}}if(f!=null&&f>=W&&s?.actionAtEnd){let e=F.get(f);if(e){let t=d.get(e.clipName);t&&(t.paused=!0)}}let m=N.current!=null&&N.current>=W;if(!M.current&&!m){let t=P(s?.velocity,s?.rotation??[0,0,0,1],e.falling,e.jetting),n=A.current;if(t.animation!==n.name||t.timeScale!==n.timeScale){let e=d.get(n.name.toLowerCase()),r=d.get(t.animation.toLowerCase());r&&(I.get(t.animation)??!0?(r.setLoop(h,1/0),r.clampWhenFinished=!1):(r.setLoop(g,1),r.clampWhenFinished=!0),a&&e&&e!==r?(e.fadeOut(u),r.reset().fadeIn(u).play()):(e&&e!==r&&e.stop(),r.reset().play()),r.timeScale=t.timeScale,A.current={name:t.animation,timeScale:t.timeScale})}}let _=U(e.weaponShape);if(_!==E.current){let e=T.current,t=E.current?e.get(E.current):null,n=e.get(_);n&&(t&&(t.weight=0),n.weight=l?0:1,E.current=_)}let{head:v,headside:y}=ie.current,x=E.current?T.current.get(E.current):null,S=l?0:1,C=e.headPitch??0,ee=e.headYaw??0,w=(C+1)/2,te=(ee+1)/2;x&&(x.time=w*x.getClip().duration,x.weight=S),v&&(v.time=w*v.getClip().duration,v.weight=S),y&&(y.time=te*y.getClip().duration,y.weight=S),a?b.update(r*i.rate):b.update(0)}),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`group`,{rotation:[0,Math.PI/2,0],children:(0,H.jsx)(`primitive`,{object:l})}),R&&ee&&(0,H.jsx)(k,{fallback:(0,H.jsx)(m,{color:`red`,label:R}),children:(0,H.jsx)(D,{name:`Weapon:${e.id}/${R}`,fallback:(0,H.jsx)(m,{color:`cyan`,label:R}),children:(0,H.jsx)(Z,{entity:e,weaponShape:R,mount0:ee})})},R),V&&w&&(0,H.jsx)(k,{fallback:(0,H.jsx)(m,{color:`red`,label:V}),children:(0,H.jsx)(D,{name:`Pack:${e.id}/${V}`,fallback:(0,H.jsx)(m,{color:`cyan`,label:V}),children:(0,H.jsx)(de,{packShape:V,mountBone:w})})},V),Y&&te&&(0,H.jsx)(k,{fallback:(0,H.jsx)(m,{color:`red`,label:Y}),children:(0,H.jsx)(D,{name:`Flag:${e.id}/${Y}`,fallback:(0,H.jsx)(m,{color:`cyan`,label:Y}),children:(0,H.jsx)(de,{packShape:Y,mountBone:te})})},Y)]})}function oe(e,t){let n=e.userData?.dts_sequence_names;if(typeof n==`string`)try{return JSON.parse(n).map(e=>e.toLowerCase())}catch{}return t.map(e=>e.name.toLowerCase())}function Z(e){let t=(0,A.c)(43),{entity:n,weaponShape:r,mount0:s}=e,c=x(),u=p(r),m=ae(),g,_,y,S;if(t[0]!==m||t[1]!==u.animations||t[2]!==u.scene){g=o(u.scene),_=f(g,void 0,{anisotropy:m});let e=l(u.scene,u.animations,`Mountpoint`);if(e){let t=e.quaternion.clone().invert(),n=e.position.clone().negate().applyQuaternion(t);g.position.copy(n),g.quaternion.copy(t)}S=new Map,g.traverse(e=>{if(!e.isMesh)return;let t=(e.userData?.vis_sequence??``).toLowerCase();if(!t)return;let n=S.get(t);n||(n=[],S.set(t,n)),n.push(e)}),y=new v(g),t[0]=m,t[1]=u.animations,t[2]=u.scene,t[3]=g,t[4]=_,t[5]=y,t[6]=S}else g=t[3],_=t[4],y=t[5],S=t[6];let C=y,E=u.scene,D;t[7]!==E||t[8]!==u.animations?(D=oe(E,u.animations),t[7]=E,t[8]=u.animations,t[9]=D):D=t[9];let O=D,k;t[10]!==g||t[11]!==_||t[12]!==C||t[13]!==O||t[14]!==S?(k={weaponClone:g,weaponMixer:C,seqIndexToName:O,visNodesBySequence:S,weaponIflInitializers:_},t[10]=g,t[11]=_,t[12]=C,t[13]=O,t[14]=S,t[15]=k):k=t[15];let{weaponClone:M,weaponMixer:N,seqIndexToName:P,visNodesBySequence:F,weaponIflInitializers:I}=k,L,R;t[16]!==M||t[17]!==N?(L=()=>()=>{d(M),N.uncacheRoot(M)},R=[M,N],t[16]=M,t[17]=N,t[18]=L,t[19]=R):(L=t[18],R=t[19]),(0,j.useEffect)(L,R);let z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(z=new Map,t[20]=z):z=t[20];let B=(0,j.useRef)(z),H=(0,j.useRef)(null),U,W;t[21]!==u.animations||t[22]!==N?(U=()=>{let e=new Map;for(let t of u.animations)e.set(t.name.toLowerCase(),N.clipAction(t));B.current=e;let t=e.get(`spin`);return t&&(t.setLoop(h,1/0),t.timeScale=0,t.play()),H.current=t??null,N.update(0),()=>{N.stopAllAction(),B.current=new Map,H.current=null,Y(Q,$)}},W=[N,u.animations],t[21]=u.animations,t[22]=N,t[23]=U,t[24]=W):(U=t[23],W=t[24]),(0,j.useEffect)(U,W);let G,K;t[25]===I?(G=t[26],K=t[27]):(G=()=>{let e=[];for(let{mesh:t,initialize:n}of I)n(t,le).then(t=>e.push(t)).catch(ce);return()=>e.forEach(se)},K=[I],t[25]=I,t[26]=G,t[27]=K),(0,j.useEffect)(G,K);let{audioLoader:q,audioListener:J}=w(),X=a()?.audioEnabled??!1,Z=(0,j.useRef)(null),de=(0,j.useRef)(null),fe=(0,j.useRef)(n.weaponImageStates),Q=(0,j.useRef)(null),$=(0,j.useRef)(-1),pe,me;t[28]!==s||t[29]!==M?(pe=()=>(s.add(M),()=>{s.remove(M)}),me=[M,s],t[28]=s,t[29]=M,t[30]=pe,t[31]=me):(pe=t[30],me=t[31]),(0,j.useEffect)(pe,me);let he;return t[32]!==X||t[33]!==J||t[34]!==q||t[35]!==c||t[36]!==n.weaponImageState||t[37]!==n.weaponImageStates||t[38]!==P||t[39]!==F||t[40]!==M||t[41]!==N?(he=(e,t)=>{let r=c.getState().playback,i=r.status===`playing`,a=B.current,o=n.weaponImageState,s=n.weaponImageStates;s!==fe.current&&(fe.current=s,s&&s.length>0?Z.current=new V(s,P):Z.current=null,de.current=null,Y(Q,$,M)),!Z.current&&s&&s.length>0&&(Z.current=new V(s,P));let l=Z.current;if(l&&o&&i){let e=t*r.rate,n=l.tick(e,o);if(ue(n,a,de,F),Q.current&&n.stateIndex!==$.current&&Y(Q,$,M),X&&q&&J&&n.soundDataBlockIds.length>0){let e=r.recording?.streamingPlayback.getDataBlockData.bind(r.recording.streamingPlayback);if(e)for(let t of n.soundDataBlockIds){let n=ie(t,e);if(n)if(n.isLooping){if(!Q.current)try{let e=ee(n.filename),t=ne();te(e,q,e=>{if(t!==ne()||Q.current)return;let i=l.stateIndex,a=new b(J);a.setBuffer(e),a.setDistanceModel(`inverse`),a.setRefDistance(n.refDist),a.setMaxDistance(n.maxDist),a.setRolloffFactor(1),a.setVolume(n.volume),a.setPlaybackRate(r.rate),a.setLoop(!0),M.add(a),T(a),a.play(),Q.current=a,$.current=i})}catch{}}else re(n,J,q,void 0,M)}}H.current&&(H.current.timeScale=n.spinTimeScale)}i?N.update(t*r.rate):N.update(0)},t[32]=X,t[33]=J,t[34]=q,t[35]=c,t[36]=n.weaponImageState,t[37]=n.weaponImageStates,t[38]=P,t[39]=F,t[40]=M,t[41]=N,t[42]=he):he=t[42],i(he),null}function se(e){return e()}function ce(){}function le(){return O.getState().time}function ue(e,t,n,r){let i=e.sequenceName,a=n.current;if(i===a&&!e.transitioned)return;if(i!==a){if(a){let e=r.get(a);if(e)for(let t of e)t.visible=!1}if(i){let e=r.get(i);if(e)for(let t of e)t.visible=!0}}if(!i){if(a){let e=t.get(a);e&&e.fadeOut(u),n.current=null}return}let o=t.get(i);if(o&&(e.transitioned||i!==a)){let r=a?t.get(a):null;if(e.isFiring||e.timeoutValue>0?(o.setLoop(g,1),o.clampWhenFinished=!0):(o.setLoop(h,1/0),o.clampWhenFinished=!1),e.scaleAnimation&&e.timeoutValue>0){let t=o.getClip().duration;o.timeScale=t>0?t/e.timeoutValue:1}else o.timeScale=e.reverse?-1:1;r&&r!==o?(r.fadeOut(u),o.reset().fadeIn(u).play()):o.reset().play(),n.current=i}}function de(e){let t=(0,A.c)(15),{packShape:n,mountBone:r}=e,i=p(n),a=ae(),s,c;if(t[0]!==a||t[1]!==i.animations||t[2]!==i.scene){s=o(i.scene),c=f(s,void 0,{anisotropy:a});let e=l(i.scene,i.animations,`Mountpoint`);if(e){let t=e.quaternion.clone().invert(),n=e.position.clone().negate().applyQuaternion(t);s.position.copy(n),s.quaternion.copy(t)}t[0]=a,t[1]=i.animations,t[2]=i.scene,t[3]=s,t[4]=c}else s=t[3],c=t[4];let u;t[5]!==s||t[6]!==c?(u={packClone:s,packIflInitializers:c},t[5]=s,t[6]=c,t[7]=u):u=t[7];let{packClone:m,packIflInitializers:h}=u,g,_;t[8]!==r||t[9]!==m?(g=()=>(r.add(m),()=>{r.remove(m),d(m)}),_=[m,r],t[8]=r,t[9]=m,t[10]=g,t[11]=_):(g=t[10],_=t[11]),(0,j.useEffect)(g,_);let v,y;return t[12]===h?(v=t[13],y=t[14]):(v=()=>{let e=[];for(let{mesh:t,initialize:n}of h)n(t,$).then(t=>e.push(t)).catch(Q);return()=>e.forEach(fe)},y=[h],t[12]=h,t[13]=v,t[14]=y),(0,j.useEffect)(v,y),null}function fe(e){return e()}function Q(){}function $(){return O.getState().time}function pe(e){let t=(0,A.c)(7),{shapeName:n,eyeOffsetRef:r}=e,i=p(n),a;t[0]!==r||t[1]!==i.animations||t[2]!==i.scene?(a=()=>{let e=l(i.scene,i.animations,`Eye`);e?r.current.set(e.position.z,e.position.y,-e.position.x):r.current.set(0,s,0)},t[0]=r,t[1]=i.animations,t[2]=i.scene,t[3]=a):a=t[3];let o;return t[4]!==r||t[5]!==i?(o=[i,r],t[4]=r,t[5]=i,t[6]=o):o=t[6],(0,j.useEffect)(a,o),null}export{pe as PlayerEyeOffset,X as PlayerModel}; |