t2-mapper/docs/assets/PlayerModel-CqOYdwZo.js

1 line
18 KiB
JavaScript
Raw Normal View History

2026-03-13 23:59:01 -07:00
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-C2tCa94d.js";import{getCachedAudioBuffer as T,getSoundGeneration as E,playOneShotSound as D,resolveAudioProfile as O,trackSound as k,untrackSound as A}from"./AudioEmitter-CIApS5vH.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}resolveS