t2-mapper/docs/_next/static/chunks/4fb9edf01fb5e4f5.js

1 line
14 KiB
JavaScript
Raw Normal View History

2026-03-13 18:04:02 -07:00
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,0,t=>{"use strict";t.i(50593);var e=t.i(17711),s=t.i(58281);t.i(70847);var a=t.i(47566),i=t.i(25311),o=t.i(89119),r=t.i(10244);class n extends r.StreamEngine{parser;initialBlock;moveTicks=0;absoluteYaw=0;absolutePitch=0;lastAbsYaw=0;lastAbsPitch=0;exhausted=!1;_teamScoresGen=0;_rosterGen=0;_weaponsHudGen=0;_inventoryHudGen=0;_cachedSnapshot=null;_cachedSnapshotTick=-1;_snap=null;constructor(t){super(),this.parser=t,this.registry=t.getRegistry(),this.ghostTracker=t.getGhostTracker();const e=t.initialBlock;this.initialBlock={dataBlocks:e.dataBlocks,initialGhosts:e.initialGhosts,controlObjectGhostIndex:e.controlObjectGhostIndex,controlObjectData:e.controlObjectData,targetEntries:e.targetEntries,sensorGroupColors:e.sensorGroupColors,taggedStrings:e.taggedStrings,initialEvents:e.initialEvents,demoValues:e.demoValues,firstPerson:e.firstPerson},this.reset()}getDataBlockData(t){let e=this.initialBlock.dataBlocks.get(t);if(e?.data)return e.data;let s=this.parser.getPacketParser();return s.dataBlockDataMap?.get(t)}_shapeConstructorCache=null;getShapeConstructorSequences(t){if(!this._shapeConstructorCache)for(let[,t]of(this._shapeConstructorCache=new Map,this.initialBlock.dataBlocks)){if("TSShapeConstructor"!==t.className||!t.data)continue;let e=t.data.shape,s=t.data.sequences;e&&s&&this._shapeConstructorCache.set(e.toLowerCase(),s)}return this._shapeConstructorCache.get(t.toLowerCase())}getTimeSec(){return this.moveTicks*(i.TICK_DURATION_MS/1e3)}getCameraYawPitch(t){let e="player"===this.lastControlType,s=e?this.absoluteYaw:this.lastAbsYaw,a=e?this.absolutePitch:this.lastAbsPitch;return e&&(this.lastAbsYaw=s,this.lastAbsPitch=a),{yaw:s,pitch:a}}getControlPlayerHeadPitch(t){return(0,o.clamp)(this.absolutePitch/o.MAX_PITCH,-1,1)}onTeamScoresChanged(){this._teamScoresGen++}onRosterChanged(){this._rosterGen++}onWeaponsHudChanged(){this._weaponsHudGen++}onInventoryHudChanged(){this._inventoryHudGen++}reset(){for(let[t,e]of(this.parser.reset(),this.ghostTracker=this.parser.getGhostTracker(),this._cachedSnapshot=null,this._cachedSnapshotTick=-1,this._snap=null,this.resetSharedState(),this.initialBlock.taggedStrings))this.netStrings.set(t,e);for(let t of this.initialBlock.targetEntries)t.name&&this.targetNames.set(t.targetId,(0,o.stripTaggedStringMarkup)(t.name)),this.targetTeams.set(t.targetId,t.sensorGroup),this.targetRenderFlags.set(t.targetId,t.targetData);for(let t of this.initialBlock.sensorGroupColors){let e=this.sensorGroupColors.get(t.group);e||(e=new Map,this.sensorGroupColors.set(t.group,e)),e.set(t.targetGroup,{r:t.r,g:t.g,b:t.b})}if(this.moveTicks=0,this.absoluteYaw=0,this.absolutePitch=0,this.lastAbsYaw=0,this.lastAbsPitch=0,this.firstPerson=this.initialBlock.firstPerson,this.lastControlType=(0,o.detectControlObjectType)(this.initialBlock.controlObjectData)??"player",this.isPiloting="player"===this.lastControlType&&!!(this.initialBlock.controlObjectData?.pilot||this.initialBlock.controlObjectData?.controlObjectGhost!=null),this.lastPilotGhostIndex=this.isPiloting&&"number"==typeof this.initialBlock.controlObjectData?.controlObjectGhost?this.initialBlock.controlObjectData.controlObjectGhost:void 0,this.isPiloting){let t=this.initialBlock.controlObjectData?.controlObjectData,e=t?.angPosition;if(e&&"number"==typeof e.w){this.lastVehicleHeading=(0,o.torqueQuatHeading)(e),this.lastVehiclePitch=(0,o.torqueQuatPitch)(e);let t=(0,o.torqueQuatToThreeJS)(e);if(t){let[e,s,a,i]=t;this.lastVehicleOrbitDir=[-(1-2*(s*s+a*a)),-(2*(e*s+a*i)),-(2*(e*a-s*i))]}}}if(this.lastCameraMode="camera"===this.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.cameraMode?this.initialBlock.controlObjectData.cameraMode:void 0,this.lastOrbitGhostIndex="camera"===this.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.orbitObjectGhostIndex?this.initialBlock.controlObjectData.orbitObjectGhostIndex:void 0,"camera"===this.lastControlType){let t=this.initialBlock.controlObjectData?.minOrbitDist,e=this.initialBlo