mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-14 09:50:51 +00:00
1 line
No EOL
23 KiB
JavaScript
1 line
No EOL
23 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29055,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(15080),i=e.i(71753),r=e.i(90072),o=e.i(25645),l=e.i(12979),s=e.i(51434),c=e.i(79123),u=e.i(89887),m=e.i(58647);let f=(0,o.createLogger)("AudioEmitter"),d=new Map,p=new Map;function h(e,t=1){p.set(e,t)}function S(e){p.delete(e)}let g=0;function y(){return g}function T(){for(let[e]of(g++,p)){try{e.stop()}catch{}try{e.disconnect()}catch{}}p.clear()}function I(e,t){let n=t(e),a=n?.filename;if(!a)return null;let i=a.endsWith(".wav")?a:`${a}.wav`,r=n.description,o=null!=r?t(r):void 0,l=o?.is3D??!0,s=o?.isLooping??!1,c=o?.referenceDistance??20;return{filename:i,is3D:l,isLooping:s,refDist:c,maxDist:o?.maxDistance??100,volume:o?.volume??1}}function w(e,t,n,a,i){let o;try{o=(0,l.audioToUrl)(e.filename)}catch{return}let s=m.engineStore.getState().playback.rate,c=g;k(o,n,n=>{if(c===g)try{if(e.is3D&&i){let o=new r.PositionalAudio(t);o.setBuffer(n),o.setDistanceModel("inverse"),o.setRefDistance(e.refDist),o.setMaxDistance(e.maxDist),o.setRolloffFactor(1),o.setVolume(e.volume),o.setPlaybackRate(s),a&&o.position.copy(a),i.add(o),p.set(o,1),o.play(),o.source.onended=()=>{p.delete(o);try{o.disconnect()}catch{}i.remove(o)}}else{let a=new r.Audio(t);a.setBuffer(n),a.setVolume(e.volume),a.setPlaybackRate(s),p.set(a,1),a.play(),a.source.onended=()=>{p.delete(a);try{a.disconnect()}catch{}}}}catch{}})}function k(e,t,n){d.has(e)?n(d.get(e)):t.load(e,t=>{d.set(e,t),n(t)},void 0,t=>{f.error("Audio load error %s: %o",e,t)})}m.engineStore.subscribe(e=>e.playback.rate,e=>{for(let[t,n]of p)try{t.setPlaybackRate(n*e)}catch{}});let A=(0,n.memo)(function({entity:e}){let{debugMode:o}=(0,c.useDebug)(),m=e.audioFileName??"",f=e.audioVolume??1,d=e.audioMinDistance??1,p=e.audioMaxDistance??1,h=e.audioMinLoopGap??0,S=e.audioMaxLoopGap??0,g=e.audioIs3D??!0?1:0,y=e.audioIsLooping??!0,[T,I,w]=e.position??[0,0,0],A=(0,a.useThree)(e=>e.scene),M=(0,a.useThree)(e=>e.camera),{audioLoader:b,audioListener:x}=(0,s.useAudio)(),{audioEnabled:N}=(0,c.useSettings)(),v=(0,n.useRef)(null),R=(0,n.useRef)(null),_=(0,n.useRef)(null),E=(0,n.useRef)(!1),L=(0,n.useRef)(!1),C=(0,n.useRef)(new r.Vector3(T,I,w)),O=(0,n.useRef)(0),D=()=>{null!=R.current&&(clearTimeout(R.current),R.current=null),null!=_.current&&(clearTimeout(_.current),_.current=null)};(0,n.useEffect)(()=>{let e;if(b&&x){if(O.current++,g){let t=new r.PositionalAudio(x);t.position.copy(C.current),t.setDistanceModel("inverse"),t.setRefDistance(d),t.setMaxDistance(p),t.setRolloffFactor(1),t.setVolume(f),e=t,A.add(e)}else(e=new r.Audio(x)).setVolume(f);return v.current=e,()=>{D();try{e.stop()}catch{}try{e.disconnect()}catch{}g&&A.remove(e),v.current=null,E.current=!1,L.current=!1}}},[b,x,g,d,p,f,A]);let P=(e,t)=>{if(y)if(h>0||S>0){let n=Math.max(0,h),a=Math.max(n,S),i=n===a?n:Math.random()*(a-n)+n;e.loop=!1;let r=()=>{t===O.current&&(!1===e.isPlaying?R.current=setTimeout(()=>{if(t===O.current)try{e.play(),P(e,t)}catch{}},i):_.current=setTimeout(r,100))};_.current=setTimeout(r,100)}else e.setLoop(!0)},j=e=>{if(!b)return;let t=O.current;if(E.current)try{e.isPlaying||(e.play(),P(e,t))}catch{}else{let n;try{n=(0,l.audioToUrl)(m)}catch{return}k(n,b,n=>{if(t===O.current&&!e.buffer){e.setBuffer(n),E.current=!0;try{e.play(),P(e,t)}catch{}}})}};return(0,n.useEffect)(()=>{let e=v.current;e&&!g&&N&&m&&j(e)},[N,g,m,b,x]),(0,i.useFrame)(()=>{let e=v.current;if(!e||!g||!N||!m)return;let t=M.position.distanceTo(C.current),n=L.current,a=t<=p;if(a&&!n)L.current=!0,j(e);else if(!a&&n){L.current=!1,D();try{e.stop()}catch{}}}),(0,n.useEffect)(()=>{let e=v.current;if(e&&!N){D();try{e.stop()}catch{}L.current=!1}},[N]),o?(0,t.jsxs)("mesh",{position:C.current,children:[(0,t.jsx)("sphereGeometry",{args:[d,12,12]}),(0,t.jsx)("meshBasicMaterial",{color:"#00ff00",wireframe:!0,opacity:.05,transparent:!0,toneMapped:!1}),(0,t.jsx)(u.FloatingLabel,{color:"#00ff00",position:[0,d+1,0],children:m})]}):null});e.s(["AudioEmitter",0,A,"audioBufferCache",0,d,"getCachedAudioBuffer",()=>k,"getSoundGeneration",()=>y,"playOneShotSound",()=>w,"resolveAudioProfile",()=>I,"stopAllTrackedSounds",()=>T,"trackSound",()=>h,"untrackSound",()=>S])},9721,e=>{"use strict";var t=e.i(43476),n=e.i(932),a=e.i(71645),i=e.i(71753),r=e.i(90072),o=e.i(82816),l=e.i(85557);class s{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(0===this.states.length)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 a=[];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&&a.push(t)}}this.delayTime-=e;let i=n,r=this.evaluateTickTransitions(t),o=0;for(;r>=0&&o<32;){if(o++,i=!0,r===this.currentStateIndex){this.delayTime=this.states[r].timeoutValue??0;break}let e=this.states[this.currentStateIndex].spin,n=this.delayTime;this.currentStateIndex=r;let l=this.states[r].timeoutValue??0;this.delayTime=l;let s=this.states[r].soundDataBlockId;switch(s>=0&&a.push(s),this.states[r].spin){case 1:this.spinTimeScale=0;break;case 4:this.spinTimeScale=1;break;case 2:3===e&&l>0&&(this.delayTime*=1-n/l);break;case 3:2===e&&l>0&&(this.delayTime*=1-n/l)}r=this.evaluateEntryTransitions(t)}let l=this.states[this.currentStateIndex],s=l.timeoutValue??0;switch(l.spin){case 1:this.spinTimeScale=0;break;case 2:this.spinTimeScale=s>0?Math.max(0,1-this.delayTime/s):1;break;case 4:this.spinTimeScale=1;break;case 3:this.spinTimeScale=s>0?Math.max(0,this.delayTime/s):0}return{sequenceName:this.resolveSequenceName(l),isFiring:l.fire,spinTimeScale:this.spinTimeScale,reverse:!l.direction,scaleAnimation:l.scaleAnimation,timeoutValue:l.timeoutValue??0,transitioned:i,soundDataBlockIds:a,stateIndex:this.currentStateIndex}}evaluateTickTransitions(e){let t=this.states[this.currentStateIndex],n=this.delayTime<=0;if(!(n||!t.waitForTimeout))return -1;let a=this.evaluateConditions(t,e);if(-1!==a)return a;if(n){let e=t.transitionOnTimeout;if(-1!==e)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(-1!==n)return n;let a=t.ammo?e.transitionOnAmmo:e.transitionOnNoAmmo;if(-1!==a)return a;let i=t.target?e.transitionOnTarget:e.transitionOnNoTarget;if(-1!==i)return i;let r=t.wet?e.transitionOnWet:e.transitionOnNotWet;if(-1!==r)return r;let o=t.triggerDown?e.transitionOnTriggerDown:e.transitionOnTriggerUp;return -1!==o?o:-1}resolveSequenceName(e){return null==e.sequence||e.sequence<0?null:this.seqIndexToName[e.sequence]??null}}var c=e.i(43595),u=e.i(91907),m=e.i(31999),f=e.i(46325),d=e.i(51434),p=e.i(29055),h=e.i(12979),S=e.i(79123),g=e.i(58647),y=e.i(93784);let T=["root","run","back","side","fall","jet","jump","land"];function I(e,t,n){let a=e.current;if(a){(0,p.untrackSound)(a);try{a.stop()}catch{}try{a.disconnect()}catch{}n?.remove(a),e.current=null,t.current=-1}}function w(e){let s,d,p,h,S,I,w,v,R,_,L,C,O,D,P,j,F,B,q,V,W,U,$,G,z=(0,n.c)(65),{entity:Y}=e,K=(0,g.useEngineStoreApi)(),H=Y.shapeName??Y.dataBlock,Q=(0,u.useStaticShape)(H);z[0]!==H?(s=e=>{let t=H?.toLowerCase();return t?e.runtime.sequenceAliases.get(t):void 0},z[0]=H,z[1]=s):s=z[1];let J=(0,g.useEngineSelector)(s);z[2]!==Q.scene?(w=o.clone(Q.scene),d=(0,l.processShapeScene)(w),w.traverse(x),I=new r.AnimationMixer(w),p=null,h=null,S=null,w.traverse(e=>{p||"Mount0"!==e.name||(p=e),h||"Mount1"!==e.name||(h=e),S||"Mount2"!==e.name||(S=e)}),z[2]=Q.scene,z[3]=d,z[4]=p,z[5]=h,z[6]=S,z[7]=I,z[8]=w):(d=z[3],p=z[4],h=z[5],S=z[6],I=z[7],w=z[8]),z[9]!==d||z[10]!==p||z[11]!==h||z[12]!==S||z[13]!==I||z[14]!==w?(v={clonedScene:w,mixer:I,mount0:p,mount1:h,mount2:S,iflInitializers:d},z[9]=d,z[10]=p,z[11]=h,z[12]=S,z[13]=I,z[14]=w,z[15]=v):v=z[15];let{clonedScene:X,mixer:Z,mount0:ee,mount1:et,mount2:en,iflInitializers:ea}=v;z[16]===Symbol.for("react.memo_cache_sentinel")?(R=new Map,z[16]=R):R=z[16];let ei=(0,a.useRef)(R);z[17]===Symbol.for("react.memo_cache_sentinel")?(_={head:null,headside:null},z[17]=_):_=z[17];let er=(0,a.useRef)(_);z[18]===Symbol.for("react.memo_cache_sentinel")?(L=new Map,z[18]=L):L=z[18];let eo=(0,a.useRef)(L),el=(0,a.useRef)(null);z[19]===Symbol.for("react.memo_cache_sentinel")?(C={name:"root",timeScale:1},z[19]=C):C=z[19];let es=(0,a.useRef)(C),ec=(0,a.useRef)(!1),eu=(0,a.useRef)(void 0);if(z[20]!==K||z[21]!==H){e:{let e=K.getState().playback,t=e.recording?.streamingPlayback,n=H?.toLowerCase();if(!t||!n){let e;z[23]===Symbol.for("react.memo_cache_sentinel")?(e=new Map,z[23]=e):e=z[23],O=e;break e}let a=t.getShapeConstructorSequences(n);if(!a){let e;z[24]===Symbol.for("react.memo_cache_sentinel")?(e=new Map,z[24]=e):e=z[24],O=e;break e}O=function(e,t){let n=new Map,a=[];for(let n of e){let e=n.indexOf(" ");if(-1===e)continue;let i=n.slice(0,e).toLowerCase(),r=n.slice(e+1).trim().toLowerCase();if(!r||!i.startsWith(t)||!i.endsWith(".dsq"))continue;let o=i.slice(t.length,-4);o&&a.push({clipName:o,alias:r})}let i=new Set;for(let e=0;e<T.length;e++){let t=T[e];for(let r=0;r<a.length;r++)if(a[r].alias===t){i.add(r),n.set(e,a[r]);break}}let r=8;for(let e=0;e<a.length;e++)!i.has(e)&&(n.set(r,a[e]),r++);return n}(a,n.replace(/\.dts$/i,"")+"_")}z[20]=K,z[21]=H,z[22]=O}else O=z[22];let em=O;z[25]!==Q.animations||z[26]!==Z||z[27]!==J?(D=()=>{let e=(0,c.getAliasedActions)(Q.animations,Z,J);ei.current=e;let t=e.get("root");t&&t.play(),es.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 a=Q.animations.find(e=>t.includes(e.name.toLowerCase()));if(!a)continue;let i=a.clone(),o=Math.round(30*a.duration/2);r.AnimationUtils.makeClipAdditive(i,o,a,30);let l=Z.clipAction(i);l.blendMode=r.AdditiveAnimationBlendMode,l.timeScale=0,l.weight=1,l.play(),n[e]=l}er.current=n;let a=new Map,i=Q.animations.find(b),o=i?Math.round(30*i.duration/2):0;for(let e of["lookde","lookms","looksn"]){let t=Q.animations.find(t=>t.name.toLowerCase()===e);if(!t)continue;let n=t.clone(),l=i??t;r.AnimationUtils.makeClipAdditive(n,o,l,30);let s=Z.clipAction(n);s.blendMode=r.AdditiveAnimationBlendMode,s.timeScale=0,s.weight=0,s.play(),a.set(e,s)}eo.current=a;let l=a.get("lookde");return l&&(l.weight=1,el.current="lookde"),Z.update(0),()=>{Z.stopAllAction(),ei.current=new Map,er.current={head:null,headside:null},eo.current=new Map,el.current=null}},P=[Z,Q.animations,J],z[25]=Q.animations,z[26]=Z,z[27]=J,z[28]=D,z[29]=P):(D=z[28],P=z[29]),(0,a.useEffect)(D,P),z[30]!==ea?(j=()=>{let e=[];for(let{mesh:t,initialize:n}of ea)n(t,M).then(t=>e.push(t)).catch(A);return()=>e.forEach(k)},F=[ea],z[30]=ea,z[31]=j,z[32]=F):(j=z[31],F=z[32]),(0,a.useEffect)(j,F);let ef=(0,a.useRef)(Y.weaponShape),[ed,ep]=(0,a.useState)(Y.weaponShape),eh=(0,a.useRef)(Y.packShape),[eS,eg]=(0,a.useState)(Y.packShape),ey=(0,a.useRef)(Y.flagShape),[eT,eI]=(0,a.useState)(Y.flagShape);return z[33]!==em||z[34]!==K||z[35]!==Y.falling||z[36]!==Y.flagShape||z[37]!==Y.headPitch||z[38]!==Y.headYaw||z[39]!==Y.jetting||z[40]!==Y.keyframes||z[41]!==Y.packShape||z[42]!==Y.weaponShape||z[43]!==Z?(B=(e,t)=>{Y.weaponShape!==ef.current&&(ef.current=Y.weaponShape,ep(Y.weaponShape)),Y.packShape!==eh.current&&(eh.current=Y.packShape,eg(Y.packShape)),Y.flagShape!==ey.current&&(ey.current=Y.flagShape,eI(Y.flagShape));let n=K.getState().playback,a="playing"===n.status,i=y.streamPlaybackStore.getState().time,o=(0,l.getKeyframeAtTime)(Y.keyframes??[],i),s=o?.damageState!=null&&o.damageState>=1,c=ei.current;if(s&&!ec.current){ec.current=!0;let e=null!=o.actionAnim?em.get(o.actionAnim):void 0;if(e){let t=c.get(e.clipName);if(t){let n=c.get(es.current.name.toLowerCase());n&&n.fadeOut(l.ANIM_TRANSITION_TIME),t.setLoop(r.LoopOnce,1),t.clampWhenFinished=!0,t.reset().fadeIn(l.ANIM_TRANSITION_TIME).play(),es.current={name:e.clipName,timeScale:1},eu.current=o.actionAnim}}}if(!s&&ec.current){ec.current=!1,eu.current=void 0;let e=c.get(es.current.name.toLowerCase());e&&(e.stop(),e.setLoop(r.LoopRepeat,1/0),e.clampWhenFinished=!1),es.current={name:"root",timeScale:1};let t=c.get("root");t&&t.reset().play()}let u=o?.actionAnim,m=eu.current;if(!ec.current&&u!==m){eu.current=u;let e=null!=m&&m>=8;if(null!=u&&u>=8){let e=em.get(u);if(e){let t=c.get(e.clipName);if(t){let n=c.get(es.current.name.toLowerCase());n&&n.fadeOut(l.ANIM_TRANSITION_TIME),t.setLoop(r.LoopOnce,1),t.clampWhenFinished=!0,t.reset().fadeIn(l.ANIM_TRANSITION_TIME).play(),es.current={name:e.clipName,timeScale:1}}}}else if(e){let e=em.get(m);if(e){let t=c.get(e.clipName);t&&(t.fadeOut(l.ANIM_TRANSITION_TIME),t.setLoop(r.LoopRepeat,1/0),t.clampWhenFinished=!1)}es.current={name:"root",timeScale:1};let t=c.get("root");t&&t.reset().fadeIn(l.ANIM_TRANSITION_TIME).play()}}if(null!=u&&u>=8&&o?.actionAtEnd){let e=em.get(u);if(e){let t=c.get(e.clipName);t&&(t.paused=!0)}}let f=null!=eu.current&&eu.current>=8;if(!ec.current&&!f){let e=function(e,t,n,a){if(n)return{animation:"fall",timeScale:1};if(!e)return a?{animation:"jet",timeScale:1}:{animation:"root",timeScale:1};let[i,r,o]=e,l=-2*Math.atan2(t[1],t[3]),s=Math.cos(l),c=Math.sin(l),u=i*s+r*c,m=-i*c+r*s,f=-m,d=-u,p=Math.max(m,f,d,u);return p<.1?a?{animation:"jet",timeScale:1}:{animation:"root",timeScale:1}:p===m?{animation:"run",timeScale:1}:p===f?{animation:"back",timeScale:1}:p===d?{animation:"side",timeScale:1}:{animation:"side",timeScale:-1}}(o?.velocity,o?.rotation??[0,0,0,1],Y.falling,Y.jetting),t=es.current;if(e.animation!==t.name||e.timeScale!==t.timeScale){let n=c.get(t.name.toLowerCase()),i=c.get(e.animation.toLowerCase());i&&(a&&n&&n!==i?(n.fadeOut(l.ANIM_TRANSITION_TIME),i.reset().fadeIn(l.ANIM_TRANSITION_TIME).play()):(n&&n!==i&&n.stop(),i.reset().play()),i.timeScale=e.timeScale,es.current={name:e.animation,timeScale:e.timeScale})}}let d=function(e){if(!e)return"lookde";let t=e.toLowerCase();return t.includes("missile")?"lookms":t.includes("sniper")?"looksn":"lookde"}(Y.weaponShape);if(d!==el.current){let e=eo.current,t=el.current?e.get(el.current):null,n=e.get(d);n&&(t&&(t.weight=0),n.weight=+!s,el.current=d)}let{head:p,headside:h}=er.current,S=el.current?eo.current.get(el.current):null,g=+!s,T=Y.headPitch??0,I=Y.headYaw??0,w=(T+1)/2;S&&(S.time=w*S.getClip().duration,S.weight=g),p&&(p.time=w*p.getClip().duration,p.weight=g),h&&(h.time=(I+1)/2*h.getClip().duration,h.weight=g),a?Z.update(t*n.rate):Z.update(0)},z[33]=em,z[34]=K,z[35]=Y.falling,z[36]=Y.flagShape,z[37]=Y.headPitch,z[38]=Y.headYaw,z[39]=Y.jetting,z[40]=Y.keyframes,z[41]=Y.packShape,z[42]=Y.weaponShape,z[43]=Z,z[44]=B):B=z[44],(0,i.useFrame)(B),z[45]===Symbol.for("react.memo_cache_sentinel")?(q=[0,Math.PI/2,0],z[45]=q):q=z[45],z[46]!==X?(V=(0,t.jsx)("group",{rotation:q,children:(0,t.jsx)("primitive",{object:X})}),z[46]=X,z[47]=V):V=z[47],z[48]!==ed||z[49]!==Y||z[50]!==ee?(W=ed&&ee&&(0,t.jsx)(m.ShapeErrorBoundary,{fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"red",label:ed}),children:(0,t.jsx)(f.DebugSuspense,{name:`Weapon:${Y.id}/${ed}`,fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"cyan",label:ed}),children:(0,t.jsx)(N,{entity:Y,weaponShape:ed,mount0:ee})})},ed),z[48]=ed,z[49]=Y,z[50]=ee,z[51]=W):W=z[51],z[52]!==eS||z[53]!==Y.id||z[54]!==et?(U=eS&&et&&(0,t.jsx)(m.ShapeErrorBoundary,{fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"red",label:eS}),children:(0,t.jsx)(f.DebugSuspense,{name:`Pack:${Y.id}/${eS}`,fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"cyan",label:eS}),children:(0,t.jsx)(E,{packShape:eS,mountBone:et})})},eS),z[52]=eS,z[53]=Y.id,z[54]=et,z[55]=U):U=z[55],z[56]!==eT||z[57]!==Y.id||z[58]!==en?($=eT&&en&&(0,t.jsx)(m.ShapeErrorBoundary,{fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"red",label:eT}),children:(0,t.jsx)(f.DebugSuspense,{name:`Flag:${Y.id}/${eT}`,fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"cyan",label:eT}),children:(0,t.jsx)(E,{packShape:eT,mountBone:en})})},eT),z[56]=eT,z[57]=Y.id,z[58]=en,z[59]=$):$=z[59],z[60]!==V||z[61]!==W||z[62]!==U||z[63]!==$?(G=(0,t.jsxs)(t.Fragment,{children:[V,W,U,$]}),z[60]=V,z[61]=W,z[62]=U,z[63]=$,z[64]=G):G=z[64],G}function k(e){return e()}function A(){}function M(){return y.streamPlaybackStore.getState().time}function b(e){return"lookde"===e.name.toLowerCase()}function x(e){if(e.isMesh&&e.material)for(let t of Array.isArray(e.material)?e.material:[e.material])t.side=r.FrontSide}function N(e){let t,c,m,f,y,T,w,k,A,M,b,x,N,E,L=(0,n.c)(38),{entity:C,weaponShape:O,mount0:D}=e,P=(0,g.useEngineStoreApi)(),j=(0,u.useStaticShape)(O);if(L[0]!==j.animations||L[1]!==j.scene){t=o.clone(j.scene),c=(0,l.processShapeScene)(t);let e=(0,l.getPosedNodeTransform)(j.scene,j.animations,"Mountpoint");if(e){let n=e.quaternion.clone().invert(),a=e.position.clone().negate().applyQuaternion(n);t.position.copy(a),t.quaternion.copy(n)}f=new Map,t.traverse(e=>{if(!e.isMesh)return;let t=e.userData,n=(t?.vis_sequence??"").toLowerCase();if(!n)return;let a=f.get(n);a||(a=[],f.set(n,a)),a.push(e)}),m=new r.AnimationMixer(t),L[0]=j.animations,L[1]=j.scene,L[2]=t,L[3]=c,L[4]=m,L[5]=f}else t=L[2],c=L[3],m=L[4],f=L[5];let F=m,B=j.scene;L[6]!==B||L[7]!==j.animations?(y=function(e,t){let n=e.userData?.dts_sequence_names;if("string"==typeof n)try{return JSON.parse(n).map(e=>e.toLowerCase())}catch{}return t.map(e=>e.name.toLowerCase())}(B,j.animations),L[6]=B,L[7]=j.animations,L[8]=y):y=L[8];let q=y;L[9]!==t||L[10]!==c||L[11]!==F||L[12]!==q||L[13]!==f?(T={weaponClone:t,weaponMixer:F,seqIndexToName:q,visNodesBySequence:f,weaponIflInitializers:c},L[9]=t,L[10]=c,L[11]=F,L[12]=q,L[13]=f,L[14]=T):T=L[14];let{weaponClone:V,weaponMixer:W,seqIndexToName:U,visNodesBySequence:$,weaponIflInitializers:G}=T;L[15]===Symbol.for("react.memo_cache_sentinel")?(w=new Map,L[15]=w):w=L[15];let z=(0,a.useRef)(w),Y=(0,a.useRef)(null);L[16]!==j.animations||L[17]!==W?(k=()=>{let e=new Map;for(let t of j.animations)e.set(t.name.toLowerCase(),W.clipAction(t));z.current=e;let t=e.get("spin");return t&&(t.setLoop(r.LoopRepeat,1/0),t.timeScale=0,t.play()),Y.current=t??null,W.update(0),()=>{W.stopAllAction(),z.current=new Map,Y.current=null,I(et,en)}},A=[W,j.animations],L[16]=j.animations,L[17]=W,L[18]=k,L[19]=A):(k=L[18],A=L[19]),(0,a.useEffect)(k,A),L[20]!==G?(M=()=>{let e=[];for(let{mesh:t,initialize:n}of G)n(t,_).then(t=>e.push(t)).catch(R);return()=>e.forEach(v)},b=[G],L[20]=G,L[21]=M,L[22]=b):(M=L[21],b=L[22]),(0,a.useEffect)(M,b);let{audioLoader:K,audioListener:H}=(0,d.useAudio)(),Q=(0,S.useSettings)(),J=Q?.audioEnabled??!1,X=(0,a.useRef)(null),Z=(0,a.useRef)(null),ee=(0,a.useRef)(C.weaponImageStates),et=(0,a.useRef)(null),en=(0,a.useRef)(-1);return L[23]!==D||L[24]!==V?(x=()=>(D.add(V),()=>{D.remove(V)}),N=[V,D],L[23]=D,L[24]=V,L[25]=x,L[26]=N):(x=L[25],N=L[26]),(0,a.useEffect)(x,N),L[27]!==J||L[28]!==H||L[29]!==K||L[30]!==P||L[31]!==C.weaponImageState||L[32]!==C.weaponImageStates||L[33]!==U||L[34]!==$||L[35]!==V||L[36]!==W?(E=(e,t)=>{let n=P.getState().playback,a="playing"===n.status,i=z.current,o=C.weaponImageState,c=C.weaponImageStates;c!==ee.current&&(ee.current=c,c&&c.length>0?X.current=new s(c,U):X.current=null,Z.current=null,I(et,en,V)),!X.current&&c&&c.length>0&&(X.current=new s(c,U));let u=X.current;if(u&&o&&a){let e=t*n.rate,a=u.tick(e,o);if(function(e,t,n,a){let i=e.sequenceName,o=n.current;if(i===o&&!e.transitioned)return;if(i!==o){if(o){let e=a.get(o);if(e)for(let t of e)t.visible=!1}if(i){let e=a.get(i);if(e)for(let t of e)t.visible=!0}}if(!i){if(o){let e=t.get(o);e&&e.fadeOut(l.ANIM_TRANSITION_TIME),n.current=null}return}let s=t.get(i);if(s&&(e.transitioned||i!==o)){let a=o?t.get(o):null;if(e.isFiring||e.timeoutValue>0?(s.setLoop(r.LoopOnce,1),s.clampWhenFinished=!0):(s.setLoop(r.LoopRepeat,1/0),s.clampWhenFinished=!1),e.scaleAnimation&&e.timeoutValue>0){let t=s.getClip().duration;s.timeScale=t>0?t/e.timeoutValue:1}else s.timeScale=e.reverse?-1:1;a&&a!==s?(a.fadeOut(l.ANIM_TRANSITION_TIME),s.reset().fadeIn(l.ANIM_TRANSITION_TIME).play()):s.reset().play(),n.current=i}}(a,i,Z,$),et.current&&a.stateIndex!==en.current&&I(et,en,V),J&&K&&H&&a.soundDataBlockIds.length>0){let e=n.recording?.streamingPlayback.getDataBlockData.bind(n.recording.streamingPlayback);if(e)for(let t of a.soundDataBlockIds){let a=(0,p.resolveAudioProfile)(t,e);if(a)if(a.isLooping){if(!et.current)try{let e=(0,h.audioToUrl)(a.filename),t=(0,p.getSoundGeneration)();(0,p.getCachedAudioBuffer)(e,K,e=>{if(t!==(0,p.getSoundGeneration)()||et.current)return;let i=u.stateIndex,o=new r.PositionalAudio(H);o.setBuffer(e),o.setDistanceModel("inverse"),o.setRefDistance(a.refDist),o.setMaxDistance(a.maxDist),o.setRolloffFactor(1),o.setVolume(a.volume),o.setPlaybackRate(n.rate),o.setLoop(!0),V.add(o),(0,p.trackSound)(o),o.play(),et.current=o,en.current=i})}catch{}}else(0,p.playOneShotSound)(a,H,K,void 0,V)}}Y.current&&(Y.current.timeScale=a.spinTimeScale)}a?W.update(t*n.rate):W.update(0)},L[27]=J,L[28]=H,L[29]=K,L[30]=P,L[31]=C.weaponImageState,L[32]=C.weaponImageStates,L[33]=U,L[34]=$,L[35]=V,L[36]=W,L[37]=E):E=L[37],(0,i.useFrame)(E),null}function v(e){return e()}function R(){}function _(){return y.streamPlaybackStore.getState().time}function E(e){let t,i,r,s,c,m,f,d=(0,n.c)(14),{packShape:p,mountBone:h}=e,S=(0,u.useStaticShape)(p);if(d[0]!==S.animations||d[1]!==S.scene){t=o.clone(S.scene),i=(0,l.processShapeScene)(t);let e=(0,l.getPosedNodeTransform)(S.scene,S.animations,"Mountpoint");if(e){let n=e.quaternion.clone().invert(),a=e.position.clone().negate().applyQuaternion(n);t.position.copy(a),t.quaternion.copy(n)}d[0]=S.animations,d[1]=S.scene,d[2]=t,d[3]=i}else t=d[2],i=d[3];d[4]!==t||d[5]!==i?(r={packClone:t,packIflInitializers:i},d[4]=t,d[5]=i,d[6]=r):r=d[6];let{packClone:g,packIflInitializers:y}=r;return d[7]!==h||d[8]!==g?(s=()=>(h.add(g),()=>{h.remove(g)}),c=[g,h],d[7]=h,d[8]=g,d[9]=s,d[10]=c):(s=d[9],c=d[10]),(0,a.useEffect)(s,c),d[11]!==y?(m=()=>{let e=[];for(let{mesh:t,initialize:n}of y)n(t,O).then(t=>e.push(t)).catch(C);return()=>e.forEach(L)},f=[y],d[11]=y,d[12]=m,d[13]=f):(m=d[12],f=d[13]),(0,a.useEffect)(m,f),null}function L(e){return e()}function C(){}function O(){return y.streamPlaybackStore.getState().time}function D(e){let t,i,r=(0,n.c)(7),{shapeName:o,eyeOffsetRef:s}=e,c=(0,u.useStaticShape)(o);return r[0]!==s||r[1]!==c.animations||r[2]!==c.scene?(t=()=>{let e=(0,l.getPosedNodeTransform)(c.scene,c.animations,"Eye");e?s.current.set(e.position.z,e.position.y,-e.position.x):s.current.set(0,l.DEFAULT_EYE_HEIGHT,0)},r[0]=s,r[1]=c.animations,r[2]=c.scene,r[3]=t):t=r[3],r[4]!==s||r[5]!==c?(i=[c,s],r[4]=s,r[5]=c,r[6]=i):i=r[6],(0,a.useEffect)(t,i),null}e.s(["PlayerEyeOffset",()=>D,"PlayerModel",()=>w],9721)}]); |