mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-23 14:21:01 +00:00
1 line
No EOL
19 KiB
JavaScript
1 line
No EOL
19 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-dhSWjERg.js";import{a}from"./SettingsProvider-xrmxG700.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-C-0r5jzJ.js";import{t as h}from"./logger-z_EpIdIa.js";import"./traditional-BTL5qX2E.js";import{$ as g,Q as _,bt as v,i as y,o as b,s as x}from"./three.module-CwgFV8Kd.js";import"./mission-C2iDKeMo.js";import{a as S,i as C,o as ee}from"./engineStore-Cio8vU1L.js";import{r as te}from"./loaders-0nekNxyt.js";import{n as ne}from"./AudioContext-Dn9ry4KA.js";import"./FloatingLabel-D3hPNzZS.js";import{getCachedAudioBuffer as re,getSoundGeneration as w,playOneShotSound as ie,resolveAudioProfile as T,trackSound as ae,untrackSound as E}from"./AudioEmitter-_djhBYQd.js";import{t as D}from"./DebugSuspense-evFO3StN.js";import{n as O}from"./streamPlaybackStore-uClZ1maO.js";import{c as oe}from"./globalFogUniforms-CaAkHfiE.js";import{t as k}from"./ShapeErrorBoundary-ClcZWdMf.js";var se=t(),A=e(n(),1),j=.1,M=20;function N(e){return-2*Math.atan2(e[1],e[3])}function ce(e,t,n,r){if(n)return{animation:`fall`,timeScale:1};if(!e)return{animation:`root`,timeScale:1};let[i,a,o]=e,s=i*i+a*a;if(Math.abs(o)>2||s>M*M)return r?{animation:`jet`,timeScale:1}:{animation:`root`,timeScale:1};let c=N(t),l=Math.cos(c),u=Math.sin(c),d=i*l+a*u,f=-i*u+a*l,p=f,m=-f,h=-d,g=d,_=Math.max(p,m,h,g);return _<j?{animation:`root`,timeScale:1}:_===p?{animation:`run`,timeScale:1}:_===m?{animation:`back`,timeScale:1}:_===h?{animation:`side`,timeScale:1}:{animation:`side`,timeScale:-1}}var P=-1,F=32,I=1,L=2,R=3,z=4,B=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}},V=r();h(`PlayerModel`);function le(e){if(!e)return`lookde`;let t=e.toLowerCase();return t.includes(`missile`)?`lookms`:t.includes(`sniper`)?`looksn`:`lookde`}var H=8,U=[`root`,`run`,`back`,`side`,`fall`,`jet`,`jump`,`land`];function W(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<U.length;e++){let t=U[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=H+n;for(let e=0;e<i.length;e++)a.has(e)||(r.set(o,i[e]),o++);return r}var G=new Set(U);function ue(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;G.has(e.toLowerCase())||o++}return o}function K(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 de({entity:e}){let t=S(),n=e.shapeName??e.dataBlock,r=p(n),s=C(e=>{let t=n?.toLowerCase();return t?e.runtime.sequenceAliases.get(t):void 0}),l=oe(),{clonedScene:h,mixer:w,mount0:ie,mount1:se,mount2:j,iflInitializers:M}=(0,A.useMemo)(()=>{let e=o(r.scene),t=f(e,void 0,{anisotropy:l});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 b(e),i=null,a=null,s=null;return e.traverse(e=>{!i&&e.name===`Mount0`&&(i=e),!a&&e.name===`Mount1`&&(a=e),!s&&e.name===`Mount2`&&(s=e)}),{clonedScene:e,mixer:n,mount0:i,mount1:a,mount2:s,iflInitializers:t}},[r,l]);(0,A.useEffect)(()=>()=>{d(h),w.uncacheRoot(h)},[h,w]);let N=(0,A.useRef)(new Map),P=(0,A.useRef)({head:null,headside:null}),F=(0,A.useRef)(new Map),I=(0,A.useRef)(null),L=(0,A.useRef)({name:`root`,timeScale:1}),R=(0,A.useRef)(!1),z=(0,A.useRef)(void 0),B=(0,A.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 W(a,o,ue(r.scene,a,o))},[t,n,r.scene]),U=(0,A.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),a=new Map;for(let e=0;e<r.length;e++)a.set(r[e].toLowerCase(),i[e]??!0);if(s)for(let[t,n]of s){let r=a.get(n);r!=null&&e.set(t,r)}for(let[t,n]of a)e.has(t)||e.set(t,n)}catch{}return e},[r.scene,s]);(0,A.useEffect)(()=>{let e=ee(r.animations,w,s);N.current=e;let t=e.get(`root`);t&&t.play(),L.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);x.makeClipAdditive(a,o,i,30);let s=w.clipAction(a);s.blendMode=y,s.timeScale=0,s.weight=1,s.play(),n[e]=s}P.current=n;let i=new Map,a=r.animations.find(e=>e.name.toLowerCase()===`lookde`),o=a?Math.round(a.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(),s=a??t;x.makeClipAdditive(n,o,s,30);let c=w.clipAction(n);c.blendMode=y,c.timeScale=0,c.weight=0,c.play(),i.set(e,c)}F.current=i;let c=i.get(`lookde`);return c&&(c.weight=1,I.current=`lookde`),w.update(0),()=>{w.stopAllAction(),N.current=new Map,P.current={head:null,headside:null},F.current=new Map,I.current=null}},[w,r.animations,s]),(0,A.useEffect)(()=>{let e=[];for(let{mesh:t,initialize:n}of M)n(t,()=>O.getState().time).then(t=>e.push(t)).catch(()=>{});return()=>e.forEach(e=>e())},[M]);let G=(0,A.useRef)(e.weaponShape),[K,de]=(0,A.useState)(e.weaponShape),fe=(0,A.useRef)(e.packShape),[q,me]=(0,A.useState)(e.packShape),he=(0,A.useRef)(e.flagShape),[J,X]=(0,A.useState)(e.flagShape),{audioLoader:Z,audioListener:Q}=ne(),$=a()?.audioEnabled??!1,ge=(0,A.useRef)(null),_e=(0,A.useRef)(null),ve=(0,A.useRef)(null);return(0,A.useEffect)(()=>{if(!Z)return;let n=t.getState().playback.recording?.streamingPlayback;if(!n||!e.dataBlockId)return;let r=n.getDataBlockData.bind(n),i=r(e.dataBlockId)?.sounds?.[0];if(i==null)return;let a=T(i,r);if(a){ve.current=a;try{re(te(a.filename),Z,e=>{_e.current=e})}catch{}}},[Z,e.dataBlockId]),(0,A.useEffect)(()=>()=>{let e=ge.current;if(e){E(e);try{e.stop()}catch{}try{e.disconnect()}catch{}e.parent?.remove(e),ge.current=null}},[]),i((n,r)=>{e.weaponShape!==G.current&&(G.current=e.weaponShape,de(e.weaponShape)),e.packShape!==fe.current&&(fe.current=e.packShape,me(e.packShape)),e.flagShape!==he.current&&(he.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=N.current;if(l&&!R.current){R.current=!0;let e=s.actionAnim==null?void 0:B.get(s.actionAnim);if(e){let t=d.get(e.clipName);if(t){let n=d.get(L.current.name.toLowerCase());n&&n.fadeOut(u),t.setLoop(_,1),t.clampWhenFinished=!0,t.reset().fadeIn(u).play(),L.current={name:e.clipName,timeScale:1},z.current=s.actionAnim}}}if(!l&&R.current){R.current=!1,z.current=void 0;let e=d.get(L.current.name.toLowerCase());e&&(e.stop(),e.setLoop(g,1/0),e.clampWhenFinished=!1),L.current={name:`root`,timeScale:1};let t=d.get(`root`);t&&t.reset().play()}let f=s?.actionAnim,p=z.current;if(!R.current&&f!==p){z.current=f;let e=f!=null&&f>=H,t=p!=null&&p>=H;if(e){let e=B.get(f);if(e){let t=d.get(e.clipName);if(t){let n=d.get(L.current.name.toLowerCase());n&&n.fadeOut(u),t.setLoop(_,1),t.clampWhenFinished=!0,t.reset().fadeIn(u).play(),L.current={name:e.clipName,timeScale:1}}}}else if(t){let e=B.get(p);if(e){let t=d.get(e.clipName);t&&(t.fadeOut(u),t.setLoop(g,1/0),t.clampWhenFinished=!1)}L.current={name:`root`,timeScale:1};let t=d.get(`root`);t&&t.reset().fadeIn(u).play()}}if(f!=null&&f>=H&&s?.actionAtEnd){let e=B.get(f);if(e){let t=d.get(e.clipName);t&&(t.paused=!0)}}let m=z.current!=null&&z.current>=H;if(!R.current&&!m){let t=ce(s?.velocity,s?.rotation??[0,0,0,1],e.falling,e.jetting),n=L.current;if(t.animation!==n.name||t.timeScale!==n.timeScale){let e=d.get(n.name.toLowerCase()),r=d.get(t.animation.toLowerCase());r&&(U.get(t.animation)??!0?(r.setLoop(g,1/0),r.clampWhenFinished=!1):(r.setLoop(_,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,L.current={name:t.animation,timeScale:t.timeScale})}}let y=le(e.weaponShape);if(y!==I.current){let e=F.current,t=I.current?e.get(I.current):null,n=e.get(y);n&&(t&&(t.weight=0),n.weight=l?0:1,I.current=y)}let{head:b,headside:x}=P.current,S=I.current?F.current.get(I.current):null,C=l?0:1,ee=e.headPitch??0,te=e.headYaw??0,ne=(ee+1)/2,re=(te+1)/2;S&&(S.time=ne*S.getClip().duration,S.weight=C),b&&(b.time=ne*b.getClip().duration,b.weight=C),x&&(x.time=re*x.getClip().duration,x.weight=C);let ie=!!e.jetting&&!l,T=ve.current,D=ge.current,oe=D?.isPlaying??!1;if(ie&&!oe){if($&&Q&&_e.current&&T){let e=D;e||(e=new v(Q),e.setDistanceModel(`inverse`),e.setRefDistance(T.refDist),e.setMaxDistance(T.maxDist),e.setRolloffFactor(1),e.setVolume(T.volume),h.add(e),ge.current=e);try{e.setBuffer(_e.current),e.setLoop(!0),e.setPlaybackRate(i.rate),e.play(),ae(e,1)}catch{}}}else if(!ie&&oe&&D){E(D);try{D.stop()}catch{}}a?w.update(r*i.rate):w.update(0)}),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`group`,{rotation:[0,Math.PI/2,0],children:(0,V.jsx)(`primitive`,{object:h})}),K&&ie&&(0,V.jsx)(k,{fallback:(0,V.jsx)(m,{color:`red`,label:K}),children:(0,V.jsx)(D,{name:`Weapon:${e.id}/${K}`,fallback:(0,V.jsx)(m,{color:`cyan`,label:K}),children:(0,V.jsx)(pe,{entity:e,weaponShape:K,mount0:ie})})},K),q&&se&&(0,V.jsx)(k,{fallback:(0,V.jsx)(m,{color:`red`,label:q}),children:(0,V.jsx)(D,{name:`Pack:${e.id}/${q}`,fallback:(0,V.jsx)(m,{color:`cyan`,label:q}),children:(0,V.jsx)(Y,{packShape:q,mountBone:se})})},q),J&&j&&(0,V.jsx)(k,{fallback:(0,V.jsx)(m,{color:`red`,label:J}),children:(0,V.jsx)(D,{name:`Flag:${e.id}/${J}`,fallback:(0,V.jsx)(m,{color:`cyan`,label:J}),children:(0,V.jsx)(Y,{packShape:J,mountBone:j})})},J)]})}function fe(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 pe(e){let t=(0,se.c)(43),{entity:n,weaponShape:r,mount0:s}=e,c=S(),u=p(r),m=oe(),h,_,y,x;if(t[0]!==m||t[1]!==u.animations||t[2]!==u.scene){h=o(u.scene),_=f(h,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);h.position.copy(n),h.quaternion.copy(t)}x=new Map,h.traverse(e=>{if(!e.isMesh)return;let t=(e.userData?.vis_sequence??``).toLowerCase();if(!t)return;let n=x.get(t);n||(n=[],x.set(t,n)),n.push(e)}),y=new b(h),t[0]=m,t[1]=u.animations,t[2]=u.scene,t[3]=h,t[4]=_,t[5]=y,t[6]=x}else h=t[3],_=t[4],y=t[5],x=t[6];let C=y,ee=u.scene,E;t[7]!==ee||t[8]!==u.animations?(E=fe(ee,u.animations),t[7]=ee,t[8]=u.animations,t[9]=E):E=t[9];let D=E,O;t[10]!==h||t[11]!==_||t[12]!==C||t[13]!==D||t[14]!==x?(O={weaponClone:h,weaponMixer:C,seqIndexToName:D,visNodesBySequence:x,weaponIflInitializers:_},t[10]=h,t[11]=_,t[12]=C,t[13]=D,t[14]=x,t[15]=O):O=t[15];let{weaponClone:k,weaponMixer:j,seqIndexToName:M,visNodesBySequence:N,weaponIflInitializers:ce}=O,P,F;t[16]!==k||t[17]!==j?(P=()=>()=>{d(k),j.uncacheRoot(k)},F=[k,j],t[16]=k,t[17]=j,t[18]=P,t[19]=F):(P=t[18],F=t[19]),(0,A.useEffect)(P,F);let I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=new Map,t[20]=I):I=t[20];let L=(0,A.useRef)(I),R=(0,A.useRef)(null),z,V;t[21]!==u.animations||t[22]!==j?(z=()=>{let e=new Map;for(let t of u.animations)e.set(t.name.toLowerCase(),j.clipAction(t));L.current=e;let t=e.get(`spin`);return t&&(t.setLoop(g,1/0),t.timeScale=0,t.play()),R.current=t??null,j.update(0),()=>{j.stopAllAction(),L.current=new Map,R.current=null,K(Y,X)}},V=[j,u.animations],t[21]=u.animations,t[22]=j,t[23]=z,t[24]=V):(z=t[23],V=t[24]),(0,A.useEffect)(z,V);let le,H;t[25]===ce?(le=t[26],H=t[27]):(le=()=>{let e=[];for(let{mesh:t,initialize:n}of ce)n(t,he).then(t=>e.push(t)).catch(me);return()=>e.forEach(q)},H=[ce],t[25]=ce,t[26]=le,t[27]=H),(0,A.useEffect)(le,H);let{audioLoader:U,audioListener:W}=ne(),G=a()?.audioEnabled??!1,ue=(0,A.useRef)(null),de=(0,A.useRef)(null),pe=(0,A.useRef)(n.weaponImageStates),Y=(0,A.useRef)(null),X=(0,A.useRef)(-1),Z,Q;t[28]!==s||t[29]!==k?(Z=()=>(s.add(k),()=>{s.remove(k)}),Q=[k,s],t[28]=s,t[29]=k,t[30]=Z,t[31]=Q):(Z=t[30],Q=t[31]),(0,A.useEffect)(Z,Q);let $;return t[32]!==G||t[33]!==W||t[34]!==U||t[35]!==c||t[36]!==n.weaponImageState||t[37]!==n.weaponImageStates||t[38]!==M||t[39]!==N||t[40]!==k||t[41]!==j?($=(e,t)=>{let r=c.getState().playback,i=r.status===`playing`,a=L.current,o=n.weaponImageState,s=n.weaponImageStates;s!==pe.current&&(pe.current=s,s&&s.length>0?ue.current=new B(s,M):ue.current=null,de.current=null,K(Y,X,k)),!ue.current&&s&&s.length>0&&(ue.current=new B(s,M));let l=ue.current;if(l&&o&&i){let e=t*r.rate,n=l.tick(e,o);if(J(n,a,de,N),Y.current&&n.stateIndex!==X.current&&K(Y,X,k),G&&U&&W&&n.soundDataBlockIds.length>0){let e=r.recording?.streamingPlayback.getDataBlockData.bind(r.recording.streamingPlayback);if(e)for(let t of n.soundDataBlockIds){let n=T(t,e);if(n)if(n.isLooping){if(!Y.current)try{let e=te(n.filename),t=w();re(e,U,e=>{if(t!==w()||Y.current)return;let i=l.stateIndex,a=new v(W);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),k.add(a),ae(a),a.play(),Y.current=a,X.current=i})}catch{}}else ie(n,W,U,void 0,k)}}R.current&&(R.current.timeScale=n.spinTimeScale)}i?j.update(t*r.rate):j.update(0)},t[32]=G,t[33]=W,t[34]=U,t[35]=c,t[36]=n.weaponImageState,t[37]=n.weaponImageStates,t[38]=M,t[39]=N,t[40]=k,t[41]=j,t[42]=$):$=t[42],i($),null}function q(e){return e()}function me(){}function he(){return O.getState().time}function J(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(_,1),o.clampWhenFinished=!0):(o.setLoop(g,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 Y(e){let t=(0,se.c)(15),{packShape:n,mountBone:r}=e,i=p(n),a=oe(),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,A.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,Q).then(t=>e.push(t)).catch(Z);return()=>e.forEach(X)},y=[h],t[12]=h,t[13]=v,t[14]=y),(0,A.useEffect)(v,y),null}function X(e){return e()}function Z(){}function Q(){return O.getState().time}function $(e){let t=(0,se.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,A.useEffect)(a,o),null}export{$ as PlayerEyeOffset,de as PlayerModel}; |