mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-17 11:21:09 +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-1xQMUSXT.js";import"./Html-BD9DC-n9.js";import{a}from"./SettingsProvider-DlQTXm3x.js";import"./logger-DePRU8Hm.js";import"./traditional-DPdbI9gv.js";import{Q as o,Z as s,i as c,o as l,s as u,yt as d}from"./three.module-Bu2Gkdne.js";import"./mission-CWASMBNZ.js";import{a as f,i as p,o as m}from"./engineStore-Clbs91WD.js";import{A as h,B as g,D as _,M as v,c as y,f as ee,h as te,i as b,m as x,n as S,o as ne,p as re,r as ie,s as C,z as w}from"./index-ClGJzuqQ.js";import{getCachedAudioBuffer as T,getSoundGeneration as E,playOneShotSound as D,resolveAudioProfile as O,trackSound as k,untrackSound as A}from"./AudioEmitter-CpW3GMEa.js";var ae=t(),j=e(n(),1),M=.1;function N(e){return-2*Math.atan2(e[1],e[3])}function oe(e,t,n,r){if(n)return{animation:`fall`,timeScale:1};if(!e)return r?{animation:`jet`,timeScale:1}:{animation:`root`,timeScale:1};let[i,a,o]=e,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?r?{animation:`jet`,timeScale:1}:{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 P=-1,F=32,I=1,L=2,R=3,z=4,se=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<F;){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 I:this.spinTimeScale=0;break;case z:this.spinTimeScale=1;break;case L:e===R&&s>0&&(this.delayTime*=1-n/s);break;case R:e===L&&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 I:this.spinTimeScale=0;break;case L:this.spinTimeScale=c>0?Math.max(0,1-this.delayTime/c):1;break;case z:this.spinTimeScale=1;break;case R: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!==P)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!==P)return n;let r=t.ammo?e.transitionOnAmmo:e.transitionOnNoAmmo;if(r!==P)return r;let i=t.target?e.transitionOnTarget:e.transitionOnNoTarget;if(i!==P)return i;let a=t.wet?e.transitionOnWet:e.transitionOnNotWet;if(a!==P)return a;let o=t.triggerDown?e.transitionOnTriggerDown:e.transitionOnTriggerUp;return o===P?-1:o}resolveSequenceName(e){return e.sequence==null||e.sequence<0?null:this.seqIndexToName[e.sequence]??null}},B=r();function ce(e){if(!e)return`lookde`;let t=e.toLowerCase();return t.includes(`missile`)?`lookms`:t.includes(`sniper`)?`looksn`:`lookde`}var V=8,H=[`root`,`run`,`back`,`side`,`fall`,`jet`,`jump`,`land`];function le(e,t){let n=new Map,r=[];for(let n of e){let e=n.indexOf(` `);if(e===-1)continue;let i=n.slice(0,e).toLowerCase(),a=n.slice(e+1).trim().toLowerCase();if(!a||!i.startsWith(t)||!i.endsWith(`.dsq`))continue;let o=i.slice(t.length,-4);o&&r.push({clipName:o,alias:a})}let i=new Set;for(let e=0;e<H.length;e++){let t=H[e];for(let a=0;a<r.length;a++)if(r[a].alias===t){i.add(a),n.set(e,r[a]);break}}let a=V;for(let e=0;e<r.length;e++)i.has(e)||(n.set(a,r[e]),a++);return n}function U(e,t,n){let r=e.current;if(r){A(r);try{r.stop()}catch{}try{r.disconnect()}catch{}n?.remove(r),e.current=null,t.current=-1}}function W(e){let t=(0,ae.c)(70),{entity:n}=e,r=f(),a=n.shapeName??n.dataBlock,d=ne(a),g;t[0]===a?g=t[1]:(g=e=>{let t=a?.toLowerCase();return t?e.runtime.sequenceAliases.get(t):void 0},t[0]=a,t[1]=g);let v=p(g),y=_(),x,T,E,D,O,k;t[2]!==y||t[3]!==d.scene?(k=h(d.scene),x=te(k,void 0,{anisotropy:y}),k.traverse(me),O=new l(k),T=null,E=null,D=null,k.traverse(e=>{!T&&e.name===`Mount0`&&(T=e),!E&&e.name===`Mount1`&&(E=e),!D&&e.name===`Mount2`&&(D=e)}),t[2]=y,t[3]=d.scene,t[4]=x,t[5]=T,t[6]=E,t[7]=D,t[8]=O,t[9]=k):(x=t[4],T=t[5],E=t[6],D=t[7],O=t[8],k=t[9]);let A;t[10]!==x||t[11]!==T||t[12]!==E||t[13]!==D||t[14]!==O||t[15]!==k?(A={clonedScene:k,mixer:O,mount0:T,mount1:E,mount2:D,iflInitializers:x},t[10]=x,t[11]=T,t[12]=E,t[13]=D,t[14]=O,t[15]=k,t[16]=A):A=t[16];let{clonedScene:M,mixer:N,mount0:P,mount1:F,mount2:I,iflInitializers:L}=A,R,z;t[17]!==M||t[18]!==N?(R=()=>()=>{ee(M),N.uncacheRoot(M)},z=[M,N],t[17]=M,t[18]=N,t[19]=R,t[20]=z):(R=t[19],z=t[20]),(0,j.useEffect)(R,z);let se;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(se=new Map,t[21]=se):se=t[21];let H=(0,j.useRef)(se),U;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(U={head:null,headside:null},t[22]=U):U=t[22];let W=(0,j.useRef)(U),he;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(he=new Map,t[23]=he):he=t[23];let ge=(0,j.useRef)(he),K=(0,j.useRef)(null),_e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_e={name:`root`,timeScale:1},t[24]=_e):_e=t[24];let q=(0,j.useRef)(_e),J=(0,j.useRef)(!1),Y=(0,j.useRef)(void 0),X;if(t[25]!==r||t[26]!==a){bb0:{let e=r.getState().playback.recording?.streamingPlayback,n=a?.toLowerCase();if(!e||!n){let e;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[28]=e):e=t[28],X=e;break bb0}let i=e.getShapeConstructorSequences(n);if(!i){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[29]=e):e=t[29],X=e;break bb0}X=le(i,n.replace(/\.dts$/i,``)+`_`)}t[25]=r,t[26]=a,t[27]=X}else X=t[27];let ye=X,be,xe;t[30]!==d.animations||t[31]!==N||t[32]!==v?(be=()=>{let e=m(d.animations,N,v);H.current=e;let t=e.get(`root`);t&&t.play(),q.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 r=d.animations.find(e=>t.includes(e.name.toLowerCase()));if(!r)continue;let i=r.clone(),a=Math.round(r.duration*30/2);u.makeClipAdditive(i,a,r,30);let o=N.clipAction(i);o.blendMode=c,o.timeScale=0,o.weight=1,o.play(),n[e]=o}W.current=n;let r=new Map,i=d.animations.find(pe),a=i?Math.round(i.duration*30/2):0;for(let e of[`lookde`,`lookms`,`looksn`]){let t=d.animations.find(t=>t.name.toLowerCase()===e);if(!t)continue;let n=t.clone(),o=i??t;u.makeClipAdditive(n,a,o,30);let s=N.clipAction(n);s.blendMode=c,s.timeScale=0,s.weight=0,s.play(),r.set(e,s)}ge.current=r;let o=r.get(`lookde`);return o&&(o.weight=1,K.current=`lookde`),N.update(0),()=>{N.stopAllAction(),H.current=new Map,W.current={head:null,headside:null},ge.current=new Map,K.current=null}},xe=[N,d.animations,v],t[30]=d.animations,t[31]=N,t[32]=v,t[33]=be,t[34]=xe):(be=t[33],xe=t[34]),(0,j.useEffect)(be,xe);let Se,Ce;t[35]===L?(Se=t[36],Ce=t[37]):(Se=()=>{let e=[];for(let{mesh:t,initialize:n}of L)n(t,fe).then(t=>e.push(t)).catch(de);return()=>e.forEach(ue)},Ce=[L],t[35]=L,t[36]=Se,t[37]=Ce),(0,j.useEffect)(Se,Ce);let we=(0,j.useRef)(n.weaponShape),[Z,Te]=(0,j.useState)(n.weaponShape),Ee=(0,j.useRef)(n.packShape),[Q,De]=(0,j.useState)(n.packShape),Oe=(0,j.useRef)(n.flagShape),[$,ke]=(0,j.useState)(n.flagShape),Ae;t[38]!==ye||t[39]!==r||t[40]!==n.falling||t[41]!==n.flagShape||t[42]!==n.headPitch||t[43]!==n.headYaw||t[44]!==n.jetting||t[45]!==n.keyframes||t[46]!==n.packShape||t[47]!==n.weaponShape||t[48]!==N?(Ae=(e,t)=>{n.weaponShape!==we.current&&(we.current=n.weaponShape,Te(n.weaponShape)),n.packShape!==Ee.current&&(Ee.current=n.packShape,De(n.packShape)),n.flagShape!==Oe.current&&(Oe.current=n.flagShape,ke(n.flagShape));let i=r.getState().playback,a=i.status===`playing`,c=w.getState().time,l=re(n.keyframes??[],c),u=l?.damageState!=null&&l.damageState>=1,d=H.current;if(u&&!J.current){J.current=!0;let e=l.actionAnim==null?void 0:ye.get(l.actionAnim);if(e){let t=d.get(e.clipName);if(t){let n=d.get(q.current.name.toLowerCase());n&&n.fadeOut(C),t.setLoop(s,1),t.clampWhenFinished=!0,t.reset().fadeIn(C).play(),q.current={name:e.clipName,timeScale:1},Y.current=l.actionAnim}}}if(!u&&J.current){J.current=!1,Y.current=void 0;let e=d.get(q.current.name.toLowerCase());e&&(e.stop(),e.setLoop(o,1/0),e.clampWhenFinished=!1),q.current={name:`root`,timeScale:1};let t=d.get(`root`);t&&t.reset().play()}let f=l?.actionAnim,p=Y.current;if(!J.current&&f!==p){Y.current=f;let e=f!=null&&f>=V,t=p!=null&&p>=V;if(e){let e=ye.get(f);if(e){let t=d.get(e.clipName);if(t){let n=d.get(q.current.name.toLowerCase());n&&n.fadeOut(C),t.setLoop(s,1),t.clampWhenFinished=!0,t.reset().fadeIn(C).play(),q.current={name:e.clipName,timeScale:1}}}}else if(t){let e=ye.get(p);if(e){let t=d.get(e.clipName);t&&(t.fadeOut(C),t.setLoop(o,1/0),t.clampWhenFinished=!1)}q.current={name:`root`,timeScale:1};let t=d.get(`root`);t&&t.reset().fadeIn(C).play()}}if(f!=null&&f>=V&&l?.actionAtEnd){let e=ye.get(f);if(e){let t=d.get(e.clipName);t&&(t.paused=!0)}}let m=Y.current!=null&&Y.current>=V;if(!J.current&&!m){let e=oe(l?.velocity,l?.rotation??[0,0,0,1],n.falling,n.jetting),t=q.current;if(e.animation!==t.name||e.timeScale!==t.timeScale){let n=d.get(t.name.toLowerCase()),r=d.get(e.animation.toLowerCase());r&&(a&&n&&n!==r?(n.fadeOut(C),r.reset().fadeIn(C).play()):(n&&n!==r&&n.stop(),r.reset().play()),r.timeScale=e.timeScale,q.current={name:e.animation,timeScale:e.timeScale})}}let h=ce(n.weaponShape);if(h!==K.current){let e=ge.current,t=K.current?e.get(K.current):null,n=e.get(h);n&&(t&&(t.weight=0),n.weight=u?0:1,K.current=h)}let{head:g,headside:_}=W.current,v=K.current?ge.current.get(K.current):null,y=u?0:1,ee=n.headPitch??0,te=n.headYaw??0,b=(ee+1)/2,x=(te+1)/2;v&&(v.time=b*v.getClip().duration,v.weight=y),g&&(g.time=b*g.getClip().duration,g.weight=y),_&&(_.time=x*_.getClip().duration,_.weight=y),a?N.update(t*i.rate):N.update(0)},t[38]=ye,t[39]=r,t[40]=n.falling,t[41]=n.flagShape,t[42]=n.headPitch,t[43]=n.headYaw,t[44]=n.jetting,t[45]=n.keyframes,t[46]=n.packShape,t[47]=n.weaponShape,t[48]=N,t[49]=Ae):Ae=t[49],i(Ae);let je;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(je=[0,Math.PI/2,0],t[50]=je):je=t[50];let Me;t[51]===M?Me=t[52]:(Me=(0,B.jsx)(`group`,{rotation:je,children:(0,B.jsx)(`primitive`,{object:M})}),t[51]=M,t[52]=Me);let Ne;t[53]!==Z||t[54]!==n||t[55]!==P?(Ne=Z&&P&&(0,B.jsx)(S,{fallback:(0,B.jsx)(b,{color:`red`,label:Z}),children:(0,B.jsx)(ie,{name:`Weapon:${n.id}/${Z}`,fallback:(0,B.jsx)(b,{color:`cyan`,label:Z}),children:(0,B.jsx)(G,{entity:n,weaponShape:Z,mount0:P})})},Z),t[53]=Z,t[54]=n,t[55]=P,t[56]=Ne):Ne=t[56];let Pe;t[57]!==Q||t[58]!==n.id||t[59]!==F?(Pe=Q&&F&&(0,B.jsx)(S,{fallback:(0,B.jsx)(b,{color:`red`,label:Q}),children:(0,B.jsx)(ie,{name:`Pack:${n.id}/${Q}`,fallback:(0,B.jsx)(b,{color:`cyan`,label:Q}),children:(0,B.jsx)(ve,{packShape:Q,mountBone:F})})},Q),t[57]=Q,t[58]=n.id,t[59]=F,t[60]=Pe):Pe=t[60];let Fe;t[61]!==$||t[62]!==n.id||t[63]!==I?(Fe=$&&I&&(0,B.jsx)(S,{fallback:(0,B.jsx)(b,{color:`red`,label:$}),children:(0,B.jsx)(ie,{name:`Flag:${n.id}/${$}`,fallback:(0,B.jsx)(b,{color:`cyan`,label:$}),children:(0,B.jsx)(ve,{packShape:$,mountBone:I})})},$),t[61]=$,t[62]=n.id,t[63]=I,t[64]=Fe):Fe=t[64];let Ie;return t[65]!==Me||t[66]!==Ne||t[67]!==Pe||t[68]!==Fe?(Ie=(0,B.jsxs)(B.Fragment,{children:[Me,Ne,Pe,Fe]}),t[65]=Me,t[66]=Ne,t[67]=Pe,t[68]=Fe,t[69]=Ie):Ie=t[69],Ie}function ue(e){return e()}function de(){}function fe(){return w.getState().time}function pe(e){return e.name.toLowerCase()===`lookde`}function me(e){if(e.isMesh&&e.material){let t=Array.isArray(e.material)?e.material:[e.material];for(let e of t)e.side=0}}function he(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 G(e){let t=(0,ae.c)(43),{entity:n,weaponShape:r,mount0:s}=e,c=f(),u=ne(r),p=_(),m,y,b,S;if(t[0]!==p||t[1]!==u.animations||t[2]!==u.scene){m=h(u.scene),y=te(m,void 0,{anisotropy:p});let e=x(u.scene,u.animations,`Mountpoint`);if(e){let t=e.quaternion.clone().invert(),n=e.position.clone().negate().applyQuaternion(t);m.position.copy(n),m.quaternion.copy(t)}S=new Map,m.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)}),b=new l(m),t[0]=p,t[1]=u.animations,t[2]=u.scene,t[3]=m,t[4]=y,t[5]=b,t[6]=S}else m=t[3],y=t[4],b=t[5],S=t[6];let re=b,ie=u.scene,C;t[7]!==ie||t[8]!==u.animations?(C=he(ie,u.animations),t[7]=ie,t[8]=u.animations,t[9]=C):C=t[9];let w=C,A;t[10]!==m||t[11]!==y||t[12]!==re||t[13]!==w||t[14]!==S?(A={weaponClone:m,weaponMixer:re,seqIndexToName:w,visNodesBySequence:S,weaponIflInitializers:y},t[10]=m,t[11]=y,t[12]=re,t[13]=w,t[14]=S,t[15]=A):A=t[15];let{weaponClone:M,weaponMixer:N,seqIndexToName:oe,visNodesBySequence:P,weaponIflInitializers:F}=A,I,L;t[16]!==M||t[17]!==N?(I=()=>()=>{ee(M),N.uncacheRoot(M)},L=[M,N],t[16]=M,t[17]=N,t[18]=I,t[19]=L):(I=t[18],L=t[19]),(0,j.useEffect)(I,L);let R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=new Map,t[20]=R):R=t[20];let z=(0,j.useRef)(R),B=(0,j.useRef)(null),ce,V;t[21]!==u.animations||t[22]!==N?(ce=()=>{let e=new Map;for(let t of u.animations)e.set(t.name.toLowerCase(),N.clipAction(t));z.current=e;let t=e.get(`spin`);return t&&(t.setLoop(o,1/0),t.timeScale=0,t.play()),B.current=t??null,N.update(0),()=>{N.stopAllAction(),z.current=new Map,B.current=null,U(G,ve)}},V=[N,u.animations],t[21]=u.animations,t[22]=N,t[23]=ce,t[24]=V):(ce=t[23],V=t[24]),(0,j.useEffect)(ce,V);let H,le;t[25]===F?(H=t[26],le=t[27]):(H=()=>{let e=[];for(let{mesh:t,initialize:n}of F)n(t,_e).then(t=>e.push(t)).catch(K);return()=>e.forEach(ge)},le=[F],t[25]=F,t[26]=H,t[27]=le),(0,j.useEffect)(H,le);let{audioLoader:W,audioListener:ue}=g(),de=a()?.audioEnabled??!1,fe=(0,j.useRef)(null),pe=(0,j.useRef)(null),me=(0,j.useRef)(n.weaponImageStates),G=(0,j.useRef)(null),ve=(0,j.useRef)(-1),J,Y;t[28]!==s||t[29]!==M?(J=()=>(s.add(M),()=>{s.remove(M)}),Y=[M,s],t[28]=s,t[29]=M,t[30]=J,t[31]=Y):(J=t[30],Y=t[31]),(0,j.useEffect)(J,Y);let X;return t[32]!==de||t[33]!==ue||t[34]!==W||t[35]!==c||t[36]!==n.weaponImageState||t[37]!==n.weaponImageStates||t[38]!==oe||t[39]!==P||t[40]!==M||t[41]!==N?(X=(e,t)=>{let r=c.getState().playback,i=r.status===`playing`,a=z.current,o=n.weaponImageState,s=n.weaponImageStates;s!==me.current&&(me.current=s,s&&s.length>0?fe.current=new se(s,oe):fe.current=null,pe.current=null,U(G,ve,M)),!fe.current&&s&&s.length>0&&(fe.current=new se(s,oe));let l=fe.current;if(l&&o&&i){let e=t*r.rate,n=l.tick(e,o);if(q(n,a,pe,P),G.current&&n.stateIndex!==ve.current&&U(G,ve,M),de&&W&&ue&&n.soundDataBlockIds.length>0){let e=r.recording?.streamingPlayback.getDataBlockData.bind(r.recording.streamingPlayback);if(e)for(let t of n.soundDataBlockIds){let n=O(t,e);if(n)if(n.isLooping){if(!G.current)try{let e=v(n.filename),t=E();T(e,W,e=>{if(t!==E()||G.current)return;let i=l.stateIndex,a=new d(ue);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),k(a),a.play(),G.current=a,ve.current=i})}catch{}}else D(n,ue,W,void 0,M)}}B.current&&(B.current.timeScale=n.spinTimeScale)}i?N.update(t*r.rate):N.update(0)},t[32]=de,t[33]=ue,t[34]=W,t[35]=c,t[36]=n.weaponImageState,t[37]=n.weaponImageStates,t[38]=oe,t[39]=P,t[40]=M,t[41]=N,t[42]=X):X=t[42],i(X),null}function ge(e){return e()}function K(){}function _e(){return w.getState().time}function q(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(C),n.current=null}return}let c=t.get(i);if(c&&(e.transitioned||i!==a)){let r=a?t.get(a):null;if(e.isFiring||e.timeoutValue>0?(c.setLoop(s,1),c.clampWhenFinished=!0):(c.setLoop(o,1/0),c.clampWhenFinished=!1),e.scaleAnimation&&e.timeoutValue>0){let t=c.getClip().duration;c.timeScale=t>0?t/e.timeoutValue:1}else c.timeScale=e.reverse?-1:1;r&&r!==c?(r.fadeOut(C),c.reset().fadeIn(C).play()):c.reset().play(),n.current=i}}function ve(e){let t=(0,ae.c)(15),{packShape:n,mountBone:r}=e,i=ne(n),a=_(),o,s;if(t[0]!==a||t[1]!==i.animations||t[2]!==i.scene){o=h(i.scene),s=te(o,void 0,{anisotropy:a});let e=x(i.scene,i.animations,`Mountpoint`);if(e){let t=e.quaternion.clone().invert(),n=e.position.clone().negate().applyQuaternion(t);o.position.copy(n),o.quaternion.copy(t)}t[0]=a,t[1]=i.animations,t[2]=i.scene,t[3]=o,t[4]=s}else o=t[3],s=t[4];let c;t[5]!==o||t[6]!==s?(c={packClone:o,packIflInitializers:s},t[5]=o,t[6]=s,t[7]=c):c=t[7];let{packClone:l,packIflInitializers:u}=c,d,f;t[8]!==r||t[9]!==l?(d=()=>(r.add(l),()=>{r.remove(l),ee(l)}),f=[l,r],t[8]=r,t[9]=l,t[10]=d,t[11]=f):(d=t[10],f=t[11]),(0,j.useEffect)(d,f);let p,m;return t[12]===u?(p=t[13],m=t[14]):(p=()=>{let e=[];for(let{mesh:t,initialize:n}of u)n(t,X).then(t=>e.push(t)).catch(Y);return()=>e.forEach(J)},m=[u],t[12]=u,t[13]=p,t[14]=m),(0,j.useEffect)(p,m),null}function J(e){return e()}function Y(){}function X(){return w.getState().time}function ye(e){let t=(0,ae.c)(7),{shapeName:n,eyeOffsetRef:r}=e,i=ne(n),a;t[0]!==r||t[1]!==i.animations||t[2]!==i.scene?(a=()=>{let e=x(i.scene,i.animations,`Eye`);e?r.current.set(e.position.z,e.position.y,-e.position.x):r.current.set(0,y,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{ye as PlayerEyeOffset,W as PlayerModel}; |