@matchomag/cs2-replay 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FORMAT.md +350 -0
- package/README.md +453 -2
- package/bin/demo-replay-darwin-amd64 +0 -0
- package/bin/demo-replay-darwin-arm64 +0 -0
- package/bin/demo-replay-linux-amd64 +0 -0
- package/bin/demo-replay-linux-arm64 +0 -0
- package/bin/demo-replay-windows-amd64.exe +0 -0
- package/bin/demo-replay.js +22 -0
- package/dist/2d/index.js +1 -0
- package/dist/3d/index.js +11 -0
- package/dist/chunks/actors-EZRYEB4I.js +177 -0
- package/dist/chunks/chunk-5BFKVD63.js +1 -0
- package/dist/chunks/chunk-D5ST2XVO.js +106 -0
- package/dist/chunks/chunk-DQPOBPMK.js +1 -0
- package/dist/chunks/chunk-FBSLUYGT.js +1 -0
- package/dist/chunks/chunk-Q37CWKZX.js +12 -0
- package/dist/chunks/chunk-VSIECNZM.js +1 -0
- package/dist/chunks/chunk-YJG3LSSB.js +1 -0
- package/dist/chunks/chunk-YO73RW3Y.js +1 -0
- package/dist/chunks/look-2WBUGHMJ.js +669 -0
- package/dist/index.js +1 -0
- package/dist/maps/index.js +1 -0
- package/dist/parse/index.js +1 -0
- package/dist/parse/wasm/replay.wasm +0 -0
- package/dist/parse/worker.js +1 -0
- package/dist/types/2d/index.d.ts +17 -0
- package/dist/types/2d/radar.d.ts +35 -0
- package/dist/types/3d/actors.d.ts +90 -0
- package/dist/types/3d/characters/anim.d.ts +93 -0
- package/dist/types/3d/characters/ao.d.ts +3 -0
- package/dist/types/3d/characters/body.d.ts +37 -0
- package/dist/types/3d/characters/builder.d.ts +82 -0
- package/dist/types/3d/characters/index.d.ts +74 -0
- package/dist/types/3d/characters/rig.d.ts +73 -0
- package/dist/types/3d/characters/textures.d.ts +4 -0
- package/dist/types/3d/characters/viewmodel.d.ts +51 -0
- package/dist/types/3d/characters/weapons.d.ts +25 -0
- package/dist/types/3d/follow.d.ts +43 -0
- package/dist/types/3d/fx/batch.d.ts +87 -0
- package/dist/types/3d/fx/context.d.ts +34 -0
- package/dist/types/3d/fx/explosion.d.ts +14 -0
- package/dist/types/3d/fx/fire.d.ts +11 -0
- package/dist/types/3d/fx/index.d.ts +84 -0
- package/dist/types/3d/fx/lights.d.ts +25 -0
- package/dist/types/3d/fx/meshes.d.ts +18 -0
- package/dist/types/3d/fx/misc.d.ts +15 -0
- package/dist/types/3d/fx/random.d.ts +21 -0
- package/dist/types/3d/fx/smoke.d.ts +10 -0
- package/dist/types/3d/fx/textures.d.ts +29 -0
- package/dist/types/3d/fx/types.d.ts +117 -0
- package/dist/types/3d/greybox.d.ts +22 -0
- package/dist/types/3d/index.d.ts +127 -0
- package/dist/types/3d/look.d.ts +49 -0
- package/dist/types/3d/markers.d.ts +23 -0
- package/dist/types/3d/smoke/volume.d.ts +95 -0
- package/dist/types/3d/smoke/voxels.d.ts +87 -0
- package/dist/types/3d/world/index.d.ts +179 -0
- package/dist/types/3d/world/look.d.ts +16 -0
- package/dist/types/3d/world/material.d.ts +128 -0
- package/dist/types/3d/world/post.d.ts +75 -0
- package/dist/types/3d/world/probes.d.ts +39 -0
- package/dist/types/3d/world/release.d.ts +28 -0
- package/dist/types/3d/world/stage.d.ts +84 -0
- package/dist/types/core/format.d.ts +163 -0
- package/dist/types/core/live.d.ts +115 -0
- package/dist/types/core/model.d.ts +164 -0
- package/dist/types/core/playback.d.ts +82 -0
- package/dist/types/core/theme.d.ts +46 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/maps/index.d.ts +258 -0
- package/dist/types/parse/index.d.ts +108 -0
- package/dist/types/ui/shell.d.ts +131 -0
- package/dist/types/ui/styles.d.ts +1 -0
- package/package.json +68 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as x,b as y,c as z}from"./chunks/chunk-5BFKVD63.js";import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w}from"./chunks/chunk-FBSLUYGT.js";import{a as k,b as l,c as m,d as n,e as o}from"./chunks/chunk-VSIECNZM.js";import{a,b,c,d,e,f,g,h,i,j}from"./chunks/chunk-YJG3LSSB.js";export{q as DEFAULT_SPEEDS,p as Emitter,a as FLAG,b as FORMAT_VERSION,w as LiveReplay,r as Playback,c as ReplayFormatError,s as UPDATE_VERSION,o as createModel,x as defaultTheme,v as emptyReplay,n as formatClock,l as grenadeKind,h as gunzip,e as isDemoFile,f as isGzip,t as isLiveUpdate,d as isReplayFile,m as lerpAngle,j as loadReplay,g as readReplay,i as readSource,u as readUpdate,z as resolveTheme,k as roundEnd,y as themeVars};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"../chunks/chunk-YO73RW3Y.js";export{a as GAME_MAP_TIERS,i as GameMapStore,h as detectGameMapSupport,b as fetchGameMapIndex,f as fetchGameMapManifest,k as formatBytes,g as gameMapFiles,d as gameMapManifestUrl,e as greyboxMapUrl,c as pickMapBuild,j as readBody};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as w,h as f}from"../chunks/chunk-FBSLUYGT.js";import{e as g,f as u,g as b}from"../chunks/chunk-YJG3LSSB.js";async function E(a,r={}){let e=await h(a,r),t=new Uint8Array(await e.slice(0,8).arrayBuffer());return u(t)&&(e=await new Response(e.stream().pipeThrough(new DecompressionStream("gzip"))).blob()),P(e,r)}async function v(a,r={}){let e=a instanceof Response?await a.blob():await h(a,r),t=new Uint8Array(await e.slice(0,8).arrayBuffer()),n=e;return u(t)&&(n=await new Response(e.stream().pipeThrough(new DecompressionStream("gzip"))).blob(),t=new Uint8Array(await n.slice(0,8).arrayBuffer())),g(t)?(await P(n,r)).replay:b(new Uint8Array(await n.arrayBuffer()))}async function h(a,r){if(a instanceof Blob)return a;if(a instanceof ArrayBuffer||a instanceof Uint8Array)return new Blob([a]);let e=await fetch(a,{...r.fetch,signal:r.signal});if(!e.ok)throw new Error(`Couldn't download the demo: HTTP ${e.status}`);let t=Number(e.headers.get("content-length"))||null;if(!e.body||!r.onProgress)return e.blob();let n=[],s=0,m=e.body.getReader();for(;;){let{done:l,value:o}=await m.read();if(l)break;n.push(o),s+=o.byteLength,r.onProgress({phase:"download",loaded:s,total:t})}return new Blob(n)}function P(a,r){return new Promise((e,t)=>{if(r.signal?.aborted)return t(r.signal.reason??new DOMException("Aborted","AbortError"));let n=r.workerUrl?new Worker(r.workerUrl,{type:"module"}):new Worker(new URL("./worker.js",import.meta.url),{type:"module"}),s=()=>{n.terminate(),r.signal?.removeEventListener("abort",m)},m=()=>{s(),t(r.signal?.reason??new DOMException("Aborted","AbortError"))};r.signal?.addEventListener("abort",m),n.onmessage=l=>{let o=l.data;if(o.type==="progress")r.onProgress?.({phase:"parse",loaded:o.loaded,total:o.total});else if(o.type==="done"){s();try{let p=new Uint8Array(o.bytes);e({replay:b(p),bytes:p,summary:o.summary})}catch(p){t(p)}}else o.type==="error"&&(s(),t(new Error(o.message)))},n.onerror=l=>{s(),t(new Error(l.message||"The demo parser failed to start."))},n.postMessage({blob:a,hz:r.hz??16})})}var c=class extends f{constructor(e){super(w());this.url=e;this.endOnFinal=!1}url;sync=null;base="";nextMap=null;worker=null;attach(e){this.worker=e}close(){this.stop(),this.end("closed")}stop(){this.worker?.terminate(),this.worker=null}};function A(a,r={}){let e=new c(String(a));return new Promise((t,n)=>{let s=r.signal;if(s?.aborted)return n(s.reason??new DOMException("Aborted","AbortError"));let m=r.workerUrl?new Worker(r.workerUrl,{type:"module"}):new Worker(new URL("./worker.js",import.meta.url),{type:"module"});e.attach(m);let l=!1,o=y=>{e.stop(),l?e.end("error",y):n(y)},p=()=>{l?e.close():(e.stop(),n(s?.reason??new DOMException("Aborted","AbortError")))};s?.addEventListener("abort",p),e.on("end",()=>s?.removeEventListener("abort",p)),m.onmessage=y=>{let i=y.data;try{if(i.type==="sync")e.sync=i.sync,e.base=i.base,e.fragmentSeconds=Math.max(1,Number(i.sync.keyframe_interval)||3),i.sync.map&&(e.replay.map=i.sync.map);else if(i.type==="update")e.apply(new Uint8Array(i.bytes)),!l&&e.replay.frames>0&&(l=!0,t(e));else if(i.type==="end"){e.stop();let d=i.reason;if(d==="error")return o(new Error(i.message||"The broadcast couldn't be read."));if(d==="map"&&(e.nextMap=i.message??null),!l)return n(new Error(d==="map"?"The broadcast moved on to another map; open it again.":"The broadcast ended before anything arrived."));e.end(d)}}catch(d){o(d)}},m.onerror=y=>o(new Error(y.message||"The broadcast parser failed to start.")),m.postMessage({type:"live",url:String(a),from:r.from??"live",hz:r.hz??16,proxy:r.proxy,idle:(r.idleTimeout??30)*1e3,init:r.fetch})})}export{c as LivePlaycast,f as LiveReplay,A as openPlaycast,v as openReplay,E as parseDemo};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var O=new URL("./wasm/replay.wasm",import.meta.url);async function H(r){let o=fetch(O);try{return(await WebAssembly.instantiateStreaming(o,r.importObject)).instance}catch{let _=await(await fetch(O)).arrayBuffer();return(await WebAssembly.instantiate(_,r.importObject)).instance}}self.onmessage=async r=>{if(r.data?.type==="live")return J(r.data);let{blob:o,hz:_}=r.data;try{let i=new globalThis.Go,E=await H(i),M=new FileReaderSync,A=0,u=await new Promise(($,y)=>{globalThis.cs2Replay={size:o.size,hz:_,read(n,s){let h=new Uint8Array(M.readAsArrayBuffer(o.slice(n,n+s))),e=n+h.byteLength;return(e-A>=8<<20||e===o.size)&&(A=e,self.postMessage({type:"progress",loaded:e,total:o.size})),h},done(n,s,h){h?y(new Error(h)):$({bytes:n,summary:JSON.parse(s)})}},i.run(E).then(()=>y(new Error("The demo parser stopped without a result.")),y)});self.postMessage({type:"done",bytes:u.bytes.buffer,summary:u.summary},[u.bytes.buffer])}catch(i){self.postMessage({type:"error",message:String(i?.message??i)})}};var I=4,q=24,R=r=>new Promise(o=>setTimeout(o,r));async function J({url:r,from:o,hz:_,proxy:i,idle:E,init:M}){let A=e=>i?i.includes("{url}")?i.replace("{url}",encodeURIComponent(e)):i+encodeURIComponent(e):e,u=e=>fetch(A(e),{...M,cache:"no-store"}),$=(e,f,T)=>self.postMessage({type:"end",reason:e,message:f,summary:T}),y=r.replace(/\/+$/,""),n=y,s;try{let e=await u(`${y}/sync`);if(!e.ok)throw new Error(e.status===404||e.status===405?"The broadcast hasn't started yet.":`The playcast's /sync answered HTTP ${e.status}.`);s=await e.json(),s.token_redirect&&(n=`${y}/${s.token_redirect}`);let f=s.fragment;if(o==="start"){f=s.signup_fragment;let l=await u(`${n}/sync?fragment=${s.signup_fragment}`).catch(()=>null);l?.ok&&(f=(await l.json()).fragment??f)}let T=async(l,d)=>{let g=await u(`${n}/${l}/${d}`);if(!g.ok)throw new Error(`The playcast has no ${d} fragment ${l} (HTTP ${g.status}).`);return new Uint8Array(await g.arrayBuffer())},[P,p]=await Promise.all([T(s.signup_fragment,"start"),T(f,"full")]);self.postMessage({type:"sync",sync:s,base:n}),await h(s,f,P,p)}catch(e){$("error",String(e?.message??e))}async function h(e,f,T,P){let p=[T,P],l=null,d=!1,g=null,S=t=>{if(l){let a=l;l=null,a(t)}else p.push(t)},z=Math.max(1,e.keyframe_interval||3)*1e3,N=async()=>{let t=f,a=Date.now(),c=!1,b=0,k=0,v=new Map,D=m=>(v.has(m)||v.set(m,u(`${n}/${m}/delta`).then(async w=>({status:w.status,body:w.ok?new Uint8Array(await w.arrayBuffer()):null})).catch(w=>({status:0,error:w}))),v.get(m));try{for(;!d;){if(!c)for(let w=t;w<t+I&&p.length<q;w++)D(w);let m=await D(t);if(v.delete(t),k++,m.status===200){for(S(m.body),t++,a=Date.now(),b=k===1?b+1:0,k=0,b>=2&&(c=!1),c&&await R(z*.9);p.length>=q&&!d;)await R(200);continue}if(m.status===410){g="over";break}if(c=!0,b=0,v.clear(),Date.now()-a>E){g="idle";break}await R(z/3)}}finally{d=!0,S(null)}},B=new globalThis.Go,C=await H(B),U=await new Promise((t,a)=>{globalThis.cs2Replay={live:!0,hz:_,map:e.map??"",next:()=>p.length?Promise.resolve(p.shift()):d?Promise.resolve(null):new Promise(c=>l=c),ready:()=>p.length>0,update(c){self.postMessage({type:"update",bytes:c.buffer},[c.buffer])},done(c,b,k){k?a(new Error(k)):t(b?JSON.parse(b):null)}},B.run(C).then(()=>a(new Error("The broadcast parser stopped without a result.")),a),N()}).finally(()=>d=!0),G=g??"over";try{let t=await u(`${y}/sync`);if(t.ok){let a=await t.json();if(a.token_redirect&&a.token_redirect!==e.token_redirect)return $("map",a.map,U)}else if(t.status===405&&e.token_redirect)return $("map",void 0,U)}catch{}$(G,void 0,U)}}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Replay } from "../core/format";
|
|
2
|
+
import { type Viewer, type ViewerOptions } from "../ui/shell";
|
|
3
|
+
import { type RadarConfig } from "./radar";
|
|
4
|
+
export * from "../index";
|
|
5
|
+
export { radarPoint, radarUnits, type RadarConfig, type RadarPoint } from "./radar";
|
|
6
|
+
export interface RadarViewerOptions extends ViewerOptions {
|
|
7
|
+
/** The replay to play. */
|
|
8
|
+
replay: Replay;
|
|
9
|
+
/** The radar of the replay's map. */
|
|
10
|
+
radar: RadarConfig;
|
|
11
|
+
/** Draw player names next to their dots, true by default. */
|
|
12
|
+
names?: boolean;
|
|
13
|
+
/** Seconds a line from killer to victim stays, 3 by default; 0 for none. */
|
|
14
|
+
killLines?: number;
|
|
15
|
+
}
|
|
16
|
+
/** Mounts a 2D top-down replay on the game's radar inside `host`. */
|
|
17
|
+
export declare function createRadarViewer(host: HTMLElement, options: RadarViewerOptions): Viewer;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A map's radar: the game's overview image and the numbers from its
|
|
3
|
+
* resource/overviews/<map>.txt that place world coordinates on it.
|
|
4
|
+
*/
|
|
5
|
+
export interface RadarConfig {
|
|
6
|
+
/** pos_x and pos_y: the world coordinates of the image's top left corner. */
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
/** World units per image pixel. */
|
|
10
|
+
scale: number;
|
|
11
|
+
/** Width and height of the images in pixels, 1024 by default. */
|
|
12
|
+
size?: number;
|
|
13
|
+
/** URL of the radar image; the upper floor on maps with two. */
|
|
14
|
+
image: string;
|
|
15
|
+
/** A second floor: its image, and the z below which positions are drawn on it (e.g. Nuke). */
|
|
16
|
+
lower?: {
|
|
17
|
+
image: string;
|
|
18
|
+
below: number;
|
|
19
|
+
};
|
|
20
|
+
/** The part of the image to show, in percent: left, top, width, height. The whole image by default. */
|
|
21
|
+
crop?: [number, number, number, number];
|
|
22
|
+
/** Bomb site letters to draw, by name: world x, y, z. */
|
|
23
|
+
sites?: Record<string, [number, number, number]>;
|
|
24
|
+
}
|
|
25
|
+
export interface RadarPoint {
|
|
26
|
+
/** 0 for the upper (or only) floor, 1 for the lower floor. */
|
|
27
|
+
level: 0 | 1;
|
|
28
|
+
/** Position on the image from its top left corner, 0..1. */
|
|
29
|
+
u: number;
|
|
30
|
+
v: number;
|
|
31
|
+
}
|
|
32
|
+
/** Where a world position is on the radar. */
|
|
33
|
+
export declare function radarPoint(radar: RadarConfig, x: number, y: number, z: number): RadarPoint;
|
|
34
|
+
/** World units per image fraction (for drawing world-sized things like smokes). */
|
|
35
|
+
export declare const radarUnits: (radar: RadarConfig) => number;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { type ReplayModel, type Snapshot } from "../core/model";
|
|
3
|
+
import type { Theme } from "../core/theme";
|
|
4
|
+
import { Character, Viewmodel } from "./characters";
|
|
5
|
+
import { EffectsSystem } from "./fx";
|
|
6
|
+
import type { ActorsSetup } from "./look";
|
|
7
|
+
export interface ActorsOptions {
|
|
8
|
+
quality?: "low" | "high";
|
|
9
|
+
/** "models" (default): animated CT/T characters. "markers": team-coloured capsules. */
|
|
10
|
+
players?: "models" | "markers";
|
|
11
|
+
/** `create`: waited for before each piece of building, e.g. to let the map go first. */
|
|
12
|
+
wait?: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Animated players and effects for both looks: turns replay data into per-frame inputs
|
|
16
|
+
* for the characters (velocity, shots, hits, deaths, plants), the first-person weapon and
|
|
17
|
+
* the effects system (grenades, gunfire, the bomb). Everything is derived from the replay
|
|
18
|
+
* time, so seeking and pausing work. The look's stage lights them (`setStage`).
|
|
19
|
+
*/
|
|
20
|
+
export declare class GameActors {
|
|
21
|
+
private model;
|
|
22
|
+
/**
|
|
23
|
+
* Builds the characters' textures and bodies a piece per task first (about 0.7 s of
|
|
24
|
+
* work in all), so it can run while the map downloads without stalling the page.
|
|
25
|
+
*/
|
|
26
|
+
static create(model: ReplayModel, opts?: ActorsOptions): Promise<GameActors>;
|
|
27
|
+
readonly object: THREE.Group<THREE.Object3DEventMap>;
|
|
28
|
+
readonly fx: EffectsSystem;
|
|
29
|
+
/** Empty with `players: "markers"`. */
|
|
30
|
+
readonly characters: Character[];
|
|
31
|
+
private markers;
|
|
32
|
+
private blobs;
|
|
33
|
+
private blobMat;
|
|
34
|
+
private sides;
|
|
35
|
+
private shotsBy;
|
|
36
|
+
private hurtsBy;
|
|
37
|
+
private hurtAt;
|
|
38
|
+
private deathKill;
|
|
39
|
+
/** Shots, hurts and kills indexed so far (sync). */
|
|
40
|
+
private seen;
|
|
41
|
+
private lastTick;
|
|
42
|
+
private w;
|
|
43
|
+
private pool;
|
|
44
|
+
/** Smokes' voxel clouds, decoded on first use (again when a live replay's cloud grew). */
|
|
45
|
+
private voxels;
|
|
46
|
+
private inputPos;
|
|
47
|
+
private inputVel;
|
|
48
|
+
private deathDir;
|
|
49
|
+
private bomb;
|
|
50
|
+
private smokeColor;
|
|
51
|
+
private smokeKey;
|
|
52
|
+
private probes;
|
|
53
|
+
private lit;
|
|
54
|
+
private probe;
|
|
55
|
+
/** First person: the player seen through the camera, whose body is hidden and whose weapon is the viewmodel; -1 for none. */
|
|
56
|
+
private pov;
|
|
57
|
+
/** The first-person weapon. */
|
|
58
|
+
readonly viewmodel: Viewmodel;
|
|
59
|
+
private viewLit;
|
|
60
|
+
private viewInput;
|
|
61
|
+
private aim;
|
|
62
|
+
private eye;
|
|
63
|
+
constructor(model: ReplayModel, opts?: ActorsOptions);
|
|
64
|
+
/** Picks up what a live replay added: players (their characters), shots, hurts and kills. */
|
|
65
|
+
sync(): void;
|
|
66
|
+
private addBlob;
|
|
67
|
+
/** Lighting, probes, smoke and shadows from the look's stage, for the map on it. */
|
|
68
|
+
setStage(setup: ActorsSetup): void;
|
|
69
|
+
/** Fractional frame → in-game tick. */
|
|
70
|
+
private tickAt;
|
|
71
|
+
/** In-game tick → fractional frame. */
|
|
72
|
+
private frameAt;
|
|
73
|
+
/** Player position (game units) at a fractional frame. */
|
|
74
|
+
private posAt;
|
|
75
|
+
/** Velocity in world m/s at a fractional frame, from the samples around it. */
|
|
76
|
+
private velocityAt;
|
|
77
|
+
/** Index into `list` (of event indices sorted by tick) of the last event at or before `tick`. */
|
|
78
|
+
private lastBefore;
|
|
79
|
+
update(s: Snapshot, camera: THREE.Camera, theme: Theme, colorOf: (css: string) => THREE.Color): void;
|
|
80
|
+
/**
|
|
81
|
+
* First person through player `i`'s eyes (-1: none): hides their body and shows their
|
|
82
|
+
* weapon as the viewmodel while they're alive, with their own shots' muzzle flashes at it.
|
|
83
|
+
*/
|
|
84
|
+
setPov(i: number): void;
|
|
85
|
+
/** The viewmodel for the first-person player at the camera, which is at their eyes. */
|
|
86
|
+
private updateViewmodel;
|
|
87
|
+
/** Eases probe lighting towards the probe at `inputPos`. */
|
|
88
|
+
private relight;
|
|
89
|
+
dispose(): void;
|
|
90
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { WeaponClass, WeaponDef } from "./weapons";
|
|
3
|
+
export interface AnimInput {
|
|
4
|
+
dt: number;
|
|
5
|
+
yaw: number;
|
|
6
|
+
velocity: THREE.Vector3;
|
|
7
|
+
alive: boolean;
|
|
8
|
+
ducking: boolean;
|
|
9
|
+
cls: WeaponClass;
|
|
10
|
+
def: WeaponDef;
|
|
11
|
+
pitch: number;
|
|
12
|
+
planting: boolean;
|
|
13
|
+
defusing: boolean;
|
|
14
|
+
blind: boolean;
|
|
15
|
+
scoped: boolean;
|
|
16
|
+
shotAge?: number;
|
|
17
|
+
throwAge?: number;
|
|
18
|
+
hurtAge?: number;
|
|
19
|
+
deathAge?: number;
|
|
20
|
+
deathDir?: THREE.Vector3;
|
|
21
|
+
headshot: boolean;
|
|
22
|
+
reset: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface WeaponState {
|
|
25
|
+
/** Shown at all. */
|
|
26
|
+
visible: boolean;
|
|
27
|
+
/** Attached to the right hand (false: lying where `pos`/`quat` say, object space). */
|
|
28
|
+
inHand: boolean;
|
|
29
|
+
pos: THREE.Vector3;
|
|
30
|
+
quat: THREE.Quaternion;
|
|
31
|
+
}
|
|
32
|
+
/** Holder transform (relative to the right hand bone) that puts the weapon's grip in the fist. */
|
|
33
|
+
export declare function holderTransform(def: WeaponDef, pos: THREE.Vector3, quat: THREE.Quaternion): void;
|
|
34
|
+
export declare class Animator {
|
|
35
|
+
readonly bones: THREE.Bone[];
|
|
36
|
+
readonly weapon: WeaponState;
|
|
37
|
+
private seed;
|
|
38
|
+
private rnd;
|
|
39
|
+
private lq;
|
|
40
|
+
private mq;
|
|
41
|
+
private mp;
|
|
42
|
+
private hipsP;
|
|
43
|
+
private hipsQ;
|
|
44
|
+
private spine;
|
|
45
|
+
private feet;
|
|
46
|
+
private hands;
|
|
47
|
+
private rootP;
|
|
48
|
+
private rootQ;
|
|
49
|
+
private phase;
|
|
50
|
+
private clock;
|
|
51
|
+
private dirX;
|
|
52
|
+
private dirZ;
|
|
53
|
+
private s;
|
|
54
|
+
private airborne;
|
|
55
|
+
private airTime;
|
|
56
|
+
private landAge;
|
|
57
|
+
private lastVy;
|
|
58
|
+
private initialized;
|
|
59
|
+
constructor(bones: THREE.Bone[], seed: number);
|
|
60
|
+
update(inp: AnimInput): void;
|
|
61
|
+
private damp;
|
|
62
|
+
private locomotion;
|
|
63
|
+
private recoilCurve;
|
|
64
|
+
/** Ankle target from the ground point under the ankle, foot pitch (toes down > 0) and yaw. */
|
|
65
|
+
private footFromGround;
|
|
66
|
+
private fk;
|
|
67
|
+
private fkSpine;
|
|
68
|
+
private aimQ;
|
|
69
|
+
private arms;
|
|
70
|
+
private leftGripW;
|
|
71
|
+
private lookQ;
|
|
72
|
+
private wpos;
|
|
73
|
+
private wq;
|
|
74
|
+
private chestYawQ;
|
|
75
|
+
private freeArm;
|
|
76
|
+
private slash;
|
|
77
|
+
/** Overhand grenade throw; returns the blend weight and fills the left-hand pose. */
|
|
78
|
+
private throwPose;
|
|
79
|
+
private solveAll;
|
|
80
|
+
curDef: WeaponDef | null;
|
|
81
|
+
private solveArm;
|
|
82
|
+
private solveLeg;
|
|
83
|
+
private solveLimb;
|
|
84
|
+
private write;
|
|
85
|
+
private death;
|
|
86
|
+
/** Core of the body (bone, radius, offset): what rests on the floor. Limbs are placed separately. */
|
|
87
|
+
private static PROBES;
|
|
88
|
+
/** Shifts the root vertically: never into the floor; with `settle`, down onto it. */
|
|
89
|
+
private groundClamp;
|
|
90
|
+
/** Moves hand / foot targets onto the floor (object-space y = radius), in the body frame. */
|
|
91
|
+
private projectToGround;
|
|
92
|
+
private dropWeapon;
|
|
93
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export type Side = "T" | "CT";
|
|
3
|
+
export interface Look {
|
|
4
|
+
side: Side;
|
|
5
|
+
skin: string;
|
|
6
|
+
hair: string;
|
|
7
|
+
top: string;
|
|
8
|
+
/** A jacket hanging over the belt, or a tucked combat shirt. */
|
|
9
|
+
topCut: "jacket" | "shirt";
|
|
10
|
+
pants: string;
|
|
11
|
+
pantsCut: "jeans" | "cargo";
|
|
12
|
+
/** Tonal camo print on the shirt and trousers. */
|
|
13
|
+
camo: boolean;
|
|
14
|
+
/** Padding of clothing and armour over the body, metres. */
|
|
15
|
+
bulk: number;
|
|
16
|
+
gear: string;
|
|
17
|
+
gear2: string;
|
|
18
|
+
boots: string;
|
|
19
|
+
gloves: "none" | "full";
|
|
20
|
+
gloveColor: string;
|
|
21
|
+
head: "balaclava" | "helmet";
|
|
22
|
+
/** Helmet shell. */
|
|
23
|
+
headColor: string;
|
|
24
|
+
/** Balaclava (worn under the helmet too). */
|
|
25
|
+
maskColor: string;
|
|
26
|
+
eyewear: "none" | "glasses";
|
|
27
|
+
earpro: boolean;
|
|
28
|
+
kneepads: boolean;
|
|
29
|
+
torsoGear: "rig" | "carrier";
|
|
30
|
+
/** Shoulder pocket patch colour (null: none). */
|
|
31
|
+
patch: string | null;
|
|
32
|
+
}
|
|
33
|
+
export declare function lookFor(side: Side): Look;
|
|
34
|
+
/** Catmull-Rom through (x, y) keys, clamped at the ends. */
|
|
35
|
+
export declare function curve(keys: [number, number][]): (x: number) => number;
|
|
36
|
+
export declare function bodyGeometry(look: Look): THREE.BufferGeometry;
|
|
37
|
+
export declare function disposeBodies(): void;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export declare const MAT: {
|
|
3
|
+
readonly skin: 0;
|
|
4
|
+
readonly fabric: 1;
|
|
5
|
+
readonly gear: 2;
|
|
6
|
+
readonly hard: 3;
|
|
7
|
+
readonly camo: 4;
|
|
8
|
+
};
|
|
9
|
+
export type MatId = (typeof MAT)[keyof typeof MAT];
|
|
10
|
+
export declare const MAT_COUNT = 5;
|
|
11
|
+
/** (bone, weight) pairs; normalised and trimmed to four when stored. */
|
|
12
|
+
export type Weights = [number, number][];
|
|
13
|
+
export type WeightFn = (p: THREE.Vector3) => Weights;
|
|
14
|
+
export interface Paint {
|
|
15
|
+
mat: MatId;
|
|
16
|
+
color: THREE.Color;
|
|
17
|
+
/** Roughness multiplier, default 1. */
|
|
18
|
+
rough?: number;
|
|
19
|
+
/** Metalness, default 0. */
|
|
20
|
+
metal?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface GridOpts {
|
|
23
|
+
/** Segments around (u) and along (v). */
|
|
24
|
+
u: number;
|
|
25
|
+
v: number;
|
|
26
|
+
/** u wraps around (a tube or a sphere). */
|
|
27
|
+
wrapU?: boolean;
|
|
28
|
+
/** Surface point at (u, v) in [0, 1]². */
|
|
29
|
+
fn: (u: number, v: number, out: THREE.Vector3) => THREE.Vector3;
|
|
30
|
+
/** A point inside the surface near (u, v), to orient normals outward. */
|
|
31
|
+
inside?: (u: number, v: number, out: THREE.Vector3) => THREE.Vector3;
|
|
32
|
+
/** Paint per triangle (evaluated at the triangle centre in uv). */
|
|
33
|
+
paint: Paint | ((u: number, v: number, p: THREE.Vector3) => Paint | null);
|
|
34
|
+
weights: WeightFn | Weights;
|
|
35
|
+
/** Texture metres per uv unit along u and v (defaults: measured lengths). */
|
|
36
|
+
uvScale?: [number, number];
|
|
37
|
+
/** Per-vertex colour multiplier (shading detail, e.g. brows, crevices). */
|
|
38
|
+
tint?: (u: number, v: number, p: THREE.Vector3) => number;
|
|
39
|
+
}
|
|
40
|
+
export declare class MeshBuilder {
|
|
41
|
+
private pos;
|
|
42
|
+
private nrm;
|
|
43
|
+
private uv;
|
|
44
|
+
private col;
|
|
45
|
+
private pbr;
|
|
46
|
+
private si;
|
|
47
|
+
private sw;
|
|
48
|
+
private idx;
|
|
49
|
+
/** Mirror x (and left/right bones) for everything added while set. */
|
|
50
|
+
mirror: boolean;
|
|
51
|
+
/** Applied to positions/normals of everything added while set (before mirroring). */
|
|
52
|
+
transform: THREE.Matrix4 | null;
|
|
53
|
+
get vertexCount(): number;
|
|
54
|
+
vertex(p: THREE.Vector3, n: THREE.Vector3, u: number, v: number, paint: Paint, weights: Weights | WeightFn): number;
|
|
55
|
+
tri(mat: MatId, a: number, b: number, c: number): void;
|
|
56
|
+
/** A parametric surface on a (u, v) grid. */
|
|
57
|
+
grid(o: GridOpts): void;
|
|
58
|
+
/** Adds a three.js geometry (positions in the builder's space after `m`). */
|
|
59
|
+
geometry(g: THREE.BufferGeometry, m: THREE.Matrix4 | null, paint: Paint, weights: WeightFn | Weights, uvScale?: number): void;
|
|
60
|
+
build(): THREE.BufferGeometry;
|
|
61
|
+
get triangleCount(): number;
|
|
62
|
+
}
|
|
63
|
+
export declare const smooth: (e0: number, e1: number, x: number) => number;
|
|
64
|
+
export interface ChainKey {
|
|
65
|
+
s: number;
|
|
66
|
+
bone: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Weights along a polyline of joints: a point is projected onto the chain, and its
|
|
70
|
+
* arc length picks a blend between the bones of the surrounding keys.
|
|
71
|
+
*/
|
|
72
|
+
export declare function chainWeights(points: THREE.Vector3[], keys: ChainKey[]): WeightFn;
|
|
73
|
+
export declare function blendKeys(keys: ChainKey[], s: number): Weights;
|
|
74
|
+
/** Torso (and anything worn on it): blends up the spine, toward the clavicles/arms at the shoulders and the thighs at the hips. */
|
|
75
|
+
export declare const torsoWeights: WeightFn;
|
|
76
|
+
/** Left arm (mirror for the right). */
|
|
77
|
+
export declare const armWeights: WeightFn;
|
|
78
|
+
/** Left leg (mirror for the right). */
|
|
79
|
+
export declare const legWeights: WeightFn;
|
|
80
|
+
/** Neck and head. */
|
|
81
|
+
export declare const headWeights: WeightFn;
|
|
82
|
+
export declare const rigid: (bone: number) => Weights;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { type Side } from "./body";
|
|
3
|
+
import { type WeaponClass } from "./weapons";
|
|
4
|
+
export type { Side } from "./body";
|
|
5
|
+
export type { WeaponClass } from "./weapons";
|
|
6
|
+
export { weaponClass } from "./weapons";
|
|
7
|
+
export { Viewmodel, VIEWMODEL_SCALE, type ViewmodelInput } from "./viewmodel";
|
|
8
|
+
export interface CharacterInput {
|
|
9
|
+
/** Game seconds since the last update (0 when paused; may be large or negative after a seek). */
|
|
10
|
+
dt: number;
|
|
11
|
+
/** Feet, world metres. */
|
|
12
|
+
position: THREE.Vector3;
|
|
13
|
+
/** Radians, as used for rotation.y (local +Z is forward). */
|
|
14
|
+
yaw: number;
|
|
15
|
+
/** World metres/second. */
|
|
16
|
+
velocity: THREE.Vector3;
|
|
17
|
+
alive: boolean;
|
|
18
|
+
ducking: boolean;
|
|
19
|
+
/** Replay weapon display name, e.g. "AK-47". */
|
|
20
|
+
weapon: string;
|
|
21
|
+
/** Degrees, positive looks up (Source eye angles are positive down: negate them). Default 0. */
|
|
22
|
+
pitch?: number;
|
|
23
|
+
planting?: boolean;
|
|
24
|
+
defusing?: boolean;
|
|
25
|
+
blind?: boolean;
|
|
26
|
+
scoped?: boolean;
|
|
27
|
+
/** Seconds since the last shot / throw / hit; undefined if none recently. */
|
|
28
|
+
shotAge?: number;
|
|
29
|
+
throwAge?: number;
|
|
30
|
+
hurtAge?: number;
|
|
31
|
+
/** Seconds since death (dead players only). */
|
|
32
|
+
deathAge?: number;
|
|
33
|
+
/** Unit world XZ vector from the killer toward the victim. */
|
|
34
|
+
deathDir?: THREE.Vector3;
|
|
35
|
+
headshot?: boolean;
|
|
36
|
+
/** Snap all smoothing (after a seek or teleport). */
|
|
37
|
+
reset?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare class Character {
|
|
40
|
+
/** Add to the scene; update() sets its position and yaw. */
|
|
41
|
+
readonly object: THREE.Group<THREE.Object3DEventMap>;
|
|
42
|
+
private mesh;
|
|
43
|
+
private bones;
|
|
44
|
+
private skeleton;
|
|
45
|
+
private anim;
|
|
46
|
+
private seed;
|
|
47
|
+
private side;
|
|
48
|
+
private weaponMesh;
|
|
49
|
+
private holder;
|
|
50
|
+
private weaponName;
|
|
51
|
+
private def;
|
|
52
|
+
private alive;
|
|
53
|
+
constructor(opts: {
|
|
54
|
+
side: Side;
|
|
55
|
+
seed?: number;
|
|
56
|
+
});
|
|
57
|
+
/** Swaps the outfit (sides swap at halftime). */
|
|
58
|
+
setSide(side: Side): void;
|
|
59
|
+
update(input: CharacterInput): void;
|
|
60
|
+
/** World position of the weapon muzzle, for muzzle flashes/tracers (null for none/knife/grenade). */
|
|
61
|
+
muzzle(out: THREE.Vector3): THREE.Vector3 | null;
|
|
62
|
+
/** The weapon class currently held. */
|
|
63
|
+
get weaponClass(): WeaponClass;
|
|
64
|
+
dispose(): void;
|
|
65
|
+
private setWeapon;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Builds the shared textures and both sides' bodies ahead of time, a piece per task
|
|
69
|
+
* (`step` yields between them), so making characters later is quick and the page
|
|
70
|
+
* keeps responding (e.g. parsing the map) meanwhile.
|
|
71
|
+
*/
|
|
72
|
+
export declare function prepareCharacterAssets(step: () => Promise<void>): Promise<void>;
|
|
73
|
+
/** Frees the shared geometries, textures and materials (characters must not be used afterwards). */
|
|
74
|
+
export declare function disposeCharacterAssets(): void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export declare const B: {
|
|
3
|
+
readonly root: 0;
|
|
4
|
+
readonly hips: 1;
|
|
5
|
+
readonly spine1: 2;
|
|
6
|
+
readonly spine2: 3;
|
|
7
|
+
readonly spine3: 4;
|
|
8
|
+
readonly neck: 5;
|
|
9
|
+
readonly head: 6;
|
|
10
|
+
readonly clavL: 7;
|
|
11
|
+
readonly armL: 8;
|
|
12
|
+
readonly foreL: 9;
|
|
13
|
+
readonly handL: 10;
|
|
14
|
+
readonly clavR: 11;
|
|
15
|
+
readonly armR: 12;
|
|
16
|
+
readonly foreR: 13;
|
|
17
|
+
readonly handR: 14;
|
|
18
|
+
readonly thighL: 15;
|
|
19
|
+
readonly calfL: 16;
|
|
20
|
+
readonly footL: 17;
|
|
21
|
+
readonly thighR: 18;
|
|
22
|
+
readonly calfR: 19;
|
|
23
|
+
readonly footR: 20;
|
|
24
|
+
};
|
|
25
|
+
export declare const BONE_NAMES: string[];
|
|
26
|
+
export declare const BONE_COUNT: number;
|
|
27
|
+
export declare const PARENT: number[];
|
|
28
|
+
/** Left bone -> right bone (and back); identity for centre bones. */
|
|
29
|
+
export declare const MIRROR_BONE: number[];
|
|
30
|
+
export declare const UPPER_ARM = 0.285;
|
|
31
|
+
export declare const FOREARM = 0.262;
|
|
32
|
+
/** A-pose: arms 45° below horizontal. */
|
|
33
|
+
export declare const ARM_DIR_L: THREE.Vector3;
|
|
34
|
+
/** Bind-pose joint positions in model space, by bone index (right side mirrored from left). */
|
|
35
|
+
export declare const JOINT: THREE.Vector3[];
|
|
36
|
+
export declare const THIGH: number;
|
|
37
|
+
export declare const SHIN: number;
|
|
38
|
+
/** Rest offset of each bone from its parent (= bone.position in the bind pose). */
|
|
39
|
+
export declare const REST_OFFSET: THREE.Vector3[];
|
|
40
|
+
/** Foot contact points relative to the ankle (bind pose, model axes). */
|
|
41
|
+
export declare const FOOT: {
|
|
42
|
+
ankleHeight: number;
|
|
43
|
+
ball: THREE.Vector3;
|
|
44
|
+
heel: THREE.Vector3;
|
|
45
|
+
toe: THREE.Vector3;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Hand frame: `along` = wrist -> knuckles, `back` = back of the hand, `thumb` = pinky -> index side.
|
|
49
|
+
* In the bind pose the palms face down and the thumbs point forward.
|
|
50
|
+
* Left: thumb = along × back. Right: thumb = back × along (mirror image).
|
|
51
|
+
*/
|
|
52
|
+
export declare const HAND_REST: {
|
|
53
|
+
L: {
|
|
54
|
+
along: THREE.Vector3;
|
|
55
|
+
back: THREE.Vector3;
|
|
56
|
+
thumb: THREE.Vector3;
|
|
57
|
+
};
|
|
58
|
+
R: {
|
|
59
|
+
along: THREE.Vector3;
|
|
60
|
+
back: THREE.Vector3;
|
|
61
|
+
thumb: THREE.Vector3;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/** Centre of the gripping fist's hole in hand coordinates (along, back, thumb), metres. */
|
|
65
|
+
export declare const GRIP_HOLE: THREE.Vector3;
|
|
66
|
+
/** Palm centre in hand coordinates. */
|
|
67
|
+
export declare const PALM: THREE.Vector3;
|
|
68
|
+
/** Rotation whose columns are (x, y, x × y); x and y must be orthonormal. */
|
|
69
|
+
export declare function basisQuat(x: THREE.Vector3, y: THREE.Vector3, out?: THREE.Quaternion): THREE.Quaternion;
|
|
70
|
+
/** Orthonormalises `y` against unit `x` in place (falls back to any perpendicular). */
|
|
71
|
+
export declare function orthoTo(y: THREE.Vector3, x: THREE.Vector3): THREE.Vector3;
|
|
72
|
+
/** Rotation that maps a hand's rest frame onto (along, back) for side L or R. */
|
|
73
|
+
export declare function handQuat(side: "L" | "R", along: THREE.Vector3, back: THREE.Vector3, out?: THREE.Quaternion): THREE.Quaternion;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { type WeaponClass } from "./weapons";
|
|
3
|
+
/** How much smaller, and nearer the eye, the viewmodel is drawn than its true size. */
|
|
4
|
+
export declare const VIEWMODEL_SCALE = 0.25;
|
|
5
|
+
export interface ViewmodelInput {
|
|
6
|
+
/** Game seconds since the last update (0 while paused; large or negative after a seek). */
|
|
7
|
+
dt: number;
|
|
8
|
+
/** Replay seconds, for the walk bob. */
|
|
9
|
+
time: number;
|
|
10
|
+
/** Replay weapon display name, e.g. "AK-47"; "" for none. */
|
|
11
|
+
weapon: string;
|
|
12
|
+
/** Gunshot kick (ShotAim.recoil): 0 at rest, 1 at a shot's peak, up to 2 in a spray. */
|
|
13
|
+
recoil: number;
|
|
14
|
+
/** Horizontal speed, m/s. */
|
|
15
|
+
speed: number;
|
|
16
|
+
/** Seconds since the last grenade throw, and until the next one (the wind-up). */
|
|
17
|
+
throwAge?: number;
|
|
18
|
+
throwIn?: number;
|
|
19
|
+
/** The grenade last thrown: its throw plays out even when `weapon` has already moved on. */
|
|
20
|
+
thrown?: string;
|
|
21
|
+
/** Seconds since the last knife swing. */
|
|
22
|
+
swingAge?: number;
|
|
23
|
+
/** Scoped in: the weapon is hidden, as in the game. */
|
|
24
|
+
scoped?: boolean;
|
|
25
|
+
/** Planting or defusing: the weapon lowers out of view. */
|
|
26
|
+
busy?: boolean;
|
|
27
|
+
/** Snap all easing (after a seek or a respawn). */
|
|
28
|
+
reset?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare class Viewmodel {
|
|
31
|
+
/** Goes in the scene; update() puts it at the camera. */
|
|
32
|
+
readonly object: THREE.Group<THREE.Object3DEventMap>;
|
|
33
|
+
private weaponMesh;
|
|
34
|
+
private handsMesh;
|
|
35
|
+
private def;
|
|
36
|
+
private weaponName;
|
|
37
|
+
/** 0 → 1 while the weapon is raised after a switch. */
|
|
38
|
+
private draw;
|
|
39
|
+
private low;
|
|
40
|
+
constructor();
|
|
41
|
+
/** The weapon class shown. */
|
|
42
|
+
get weaponClass(): WeaponClass;
|
|
43
|
+
update(camera: THREE.Camera, input: ViewmodelInput): void;
|
|
44
|
+
/**
|
|
45
|
+
* World position of the muzzle as drawn (shrunk towards the eye like the viewmodel), or
|
|
46
|
+
* null without a gun in view. The true muzzle is eye + (this − eye) / VIEWMODEL_SCALE.
|
|
47
|
+
*/
|
|
48
|
+
muzzle(out: THREE.Vector3): THREE.Vector3 | null;
|
|
49
|
+
private setWeapon;
|
|
50
|
+
}
|
|
51
|
+
export declare function disposeViewmodels(): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export type WeaponClass = "rifle" | "smg" | "sniper" | "shotgun" | "lmg" | "pistol" | "knife" | "grenade" | "c4" | "taser" | "none";
|
|
3
|
+
/** Maps a replay weapon display name to a weapon class. */
|
|
4
|
+
export declare function weaponClass(name: string): WeaponClass;
|
|
5
|
+
export interface Grip {
|
|
6
|
+
/** Centre of the fist's hole, weapon space. */
|
|
7
|
+
pos: THREE.Vector3;
|
|
8
|
+
/** Hand frame in weapon space: wrist -> knuckles, and the back of the hand. */
|
|
9
|
+
along: THREE.Vector3;
|
|
10
|
+
back: THREE.Vector3;
|
|
11
|
+
}
|
|
12
|
+
export interface WeaponDef {
|
|
13
|
+
cls: WeaponClass;
|
|
14
|
+
geometry: THREE.BufferGeometry | null;
|
|
15
|
+
right: Grip;
|
|
16
|
+
/** Support hand grip, for two-handed holds. */
|
|
17
|
+
left: Grip | null;
|
|
18
|
+
muzzle: THREE.Vector3 | null;
|
|
19
|
+
/** Rear of the stock (shoulder contact), if any. */
|
|
20
|
+
stock: THREE.Vector3 | null;
|
|
21
|
+
/** Recoil: metres back, degrees of muzzle rise. */
|
|
22
|
+
kick: [number, number];
|
|
23
|
+
}
|
|
24
|
+
export declare function weaponDef(cls: WeaponClass): WeaponDef;
|
|
25
|
+
export declare function disposeWeapons(): void;
|