@korial29/tiny-fps 0.144.0 → 0.145.1
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/dist/index.js +16 -15
- package/dist/types/client/armor.d.ts +106 -9
- package/dist/types/client/beams.d.ts +2 -1
- package/dist/types/client/body.d.ts +4 -3
- package/dist/types/client/buckle.d.ts +9 -0
- package/dist/types/client/craft.d.ts +2 -1
- package/dist/types/client/doors.d.ts +3 -2
- package/dist/types/client/drops.d.ts +2 -1
- package/dist/types/client/dust.d.ts +2 -1
- package/dist/types/client/flag.d.ts +6 -5
- package/dist/types/client/gun.d.ts +3 -2
- package/dist/types/client/hair.d.ts +2 -1
- package/dist/types/client/helm.d.ts +2 -1
- package/dist/types/client/helmet.d.ts +5 -4
- package/dist/types/client/katana.d.ts +4 -3
- package/dist/types/client/limbs.d.ts +2 -1
- package/dist/types/client/mask.d.ts +10 -2
- package/dist/types/client/mesh.d.ts +10 -3
- package/dist/types/client/moonbase.d.ts +6 -5
- package/dist/types/client/pack.d.ts +4 -3
- package/dist/types/client/pads.d.ts +29 -4
- package/dist/types/client/pouch.d.ts +2 -1
- package/dist/types/client/props.d.ts +6 -5
- package/dist/types/client/render.d.ts +2 -1
- package/dist/types/client/rover.d.ts +3 -2
- package/dist/types/client/skin.d.ts +2 -1
- package/dist/types/client/soldier.d.ts +3 -2
- package/dist/types/client/traffic.d.ts +2 -1
- package/dist/types/client/trail.d.ts +2 -1
- package/dist/types/client/verts.d.ts +26 -0
- package/dist/types/client/vision.d.ts +2 -1
- package/dist/types/client/wreck.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Vec3 } from './mesh';
|
|
2
2
|
import type { Quat } from './rig';
|
|
3
|
+
import type { Out } from './verts';
|
|
3
4
|
/**
|
|
4
5
|
* A lame, from the arm's joint at rest (metres, +x out): where it starts and ends across, its half
|
|
5
6
|
* width fore and aft, and its height at its start.
|
|
@@ -20,12 +21,24 @@ export declare const COLLAR: {
|
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* The lames' front half (the user, 2026-11-13: wrap the front of the shoulders more): this much
|
|
23
|
-
* wider than their back half, and falling this much further, down over the front of the shoulder
|
|
24
|
+
* wider than their back half, and falling this much further, down over the front of the shoulder
|
|
25
|
+
* (1.6 plunged too steeply, the user, 2026-11-13), down onto the chest piece (the user: fill the
|
|
26
|
+
* gap between the pads and the plates).
|
|
24
27
|
*/
|
|
25
28
|
export declare const FORE: {
|
|
26
29
|
wide: number;
|
|
27
30
|
fall: number;
|
|
28
31
|
};
|
|
32
|
+
/** Their back half (the user, 2026-11-13: the pads go on behind too): as FORE, over the shoulder blade. */
|
|
33
|
+
export declare const AFT: {
|
|
34
|
+
wide: number;
|
|
35
|
+
fall: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* How a lame falls from its crease to its edges, as a power of the way across: round over the
|
|
39
|
+
* shoulder, not a roof's straight slope (the user, 2026-11-13: round the slope; it was 1.3).
|
|
40
|
+
*/
|
|
41
|
+
export declare const CROWN = 2;
|
|
29
42
|
/**
|
|
30
43
|
* The marine's shoulder bell (the user, 2026-11-13, on a picture of a trooper's armour: a big round
|
|
31
44
|
* shell over each shoulder, hanging over the top of the arm): from the arm's joint at rest, its
|
|
@@ -51,12 +64,24 @@ export declare const BAND: {
|
|
|
51
64
|
rows: number[];
|
|
52
65
|
shade: number;
|
|
53
66
|
};
|
|
67
|
+
/** A lame's quads: its top and underside, its inner end, its front and back edges. */
|
|
68
|
+
export declare const LAME_QUADS: number;
|
|
69
|
+
/**
|
|
70
|
+
* The ninja's colours (the user, 2026-11-13: vary them): gold shoulder pads that shine (GILT; a darker
|
|
71
|
+
* gold, the user), and a
|
|
72
|
+
* collar of brown cloth, matte.
|
|
73
|
+
*/
|
|
74
|
+
export declare const GOLD: number[];
|
|
75
|
+
export declare const COLLAR_CLOTH: number[];
|
|
54
76
|
/**
|
|
55
|
-
* Appends the ninja's shoulder pads and his collar on the solved pose `s`,
|
|
77
|
+
* Appends the ninja's shoulder pads and his collar on the solved pose `s`, the pads in `color` (GOLD
|
|
78
|
+
* for him), the collar in COLLAR_CLOTH;
|
|
56
79
|
* smaller on the woman (`build`). Or the `marine`'s shoulder bells, and no collar, with a band
|
|
57
80
|
* round them in `band` (the astronaut's team colour on his white bells).
|
|
58
81
|
*/
|
|
59
|
-
export declare const pads: (out:
|
|
82
|
+
export declare const pads: (out: Out, s: {
|
|
60
83
|
pos: Vec3[];
|
|
61
84
|
rot: Quat[];
|
|
62
|
-
}, build?: number, color?: number[], marine?: boolean, band?: number[]
|
|
85
|
+
}, build?: number, color?: number[], marine?: boolean, band?: number[],
|
|
86
|
+
/** A far runner's: fewer quads. */
|
|
87
|
+
far?: boolean) => void;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Vec3 } from './mesh';
|
|
2
2
|
import type { Quat } from './rig';
|
|
3
|
+
import type { Out } from './verts';
|
|
3
4
|
/**
|
|
4
5
|
* The pouch's mouth for a skeleton with its pelvis at `at` turned by `q`, and its axes: out of the
|
|
5
6
|
* hip, forward, and down into it.
|
|
6
7
|
*/
|
|
7
8
|
export declare const pouchAt: (at: Vec3, q: Quat) => [Vec3, Vec3[]];
|
|
8
9
|
/** Appends the pouch, and the spare's top 8 mm out of it, for the pelvis at `at` turned by `q`. */
|
|
9
|
-
export declare const pouch: (out:
|
|
10
|
+
export declare const pouch: (out: Out, at: Vec3, q: Quat) => void;
|
|
10
11
|
/**
|
|
11
12
|
* The left hand fetching a new battery from the pouch at `s` of a swap (the user, 2026-11-09): from
|
|
12
13
|
* `start` down over the pouch, into it, then up with the battery along an arc to `seat`, where the
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Vec3 } from './mesh';
|
|
2
|
+
import type { Out } from './verts';
|
|
2
3
|
/**
|
|
3
4
|
* The packs of `all` whose bit is set in `mask`, if any: the ones that are there to take. The bits
|
|
4
5
|
* count from `from`: the ammo packs come after the health packs.
|
|
@@ -9,12 +10,12 @@ export declare const packsOf: (all?: readonly Vec3[], mask?: number, from?: numb
|
|
|
9
10
|
* the weapon, and the weapon over it: the gun, or by `kind` the katana (1), crackling, the rail
|
|
10
11
|
* gun (2) or the laser rifle (3).
|
|
11
12
|
*/
|
|
12
|
-
export declare const rack: (out:
|
|
13
|
+
export declare const rack: (out: Out, at: Vec3, rgb: number[], t: number, kind?: number) => void;
|
|
13
14
|
/** Each team's gun rack, katana rack, rail gun rack and laser rifle rack, where it has them. */
|
|
14
|
-
export declare const racks: (out:
|
|
15
|
+
export declare const racks: (out: Out, guns?: readonly (Vec3 | undefined)[], blades?: readonly (Vec3 | undefined)[], t?: number, rails?: readonly (Vec3 | undefined)[], rifles?: readonly (Vec3 | undefined)[]) => void;
|
|
15
16
|
/** A health pack at `at`: a white box with a glowing green cross on each side. */
|
|
16
|
-
export declare const kit: (out:
|
|
17
|
+
export declare const kit: (out: Out, at: Vec3, t: number) => void;
|
|
17
18
|
/** An ammo pack at `at`: a violet box with a glowing cyan cartridge on each side, the gun's colours. */
|
|
18
|
-
export declare const cell: (out:
|
|
19
|
+
export declare const cell: (out: Out, at: Vec3, t: number) => void;
|
|
19
20
|
/** A rail cell at `at`: a gunmetal box with a glowing violet-white bolt on each side, the rail gun's colours. */
|
|
20
|
-
export declare const battery: (out:
|
|
21
|
+
export declare const battery: (out: Out, at: Vec3, t: number) => void;
|
|
@@ -6,6 +6,7 @@ import type { Effects } from './effects';
|
|
|
6
6
|
import type { CtfScene } from './flag';
|
|
7
7
|
import type { Light } from './lights';
|
|
8
8
|
import type { Vec3 } from './mesh';
|
|
9
|
+
import type { Out } from './verts';
|
|
9
10
|
/** Tints a world can use at once, white included (see palette). */
|
|
10
11
|
export declare const MAX_TINTS = 16;
|
|
11
12
|
/** Shadow map side in texels. */
|
|
@@ -134,7 +135,7 @@ export interface Renderer {
|
|
|
134
135
|
/** The own player when the camera is not in his head (seated in a rover): drawn whole, like the others. */
|
|
135
136
|
self?: PlayerState,
|
|
136
137
|
/** Adds what else moves in the map (the doors): drawn lit, casting shadows, with the other players. */
|
|
137
|
-
more?: (v:
|
|
138
|
+
more?: (v: Out) => void): void;
|
|
138
139
|
/** A world point on screen as of the last frame, in [0, 1] from the top left. */
|
|
139
140
|
project(x: number, y: number, z: number): [number, number] | undefined;
|
|
140
141
|
/** The footsteps of the player `id`'s runner so far (Gait.steps), undefined before it is drawn. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Rover } from '../shared/types';
|
|
2
2
|
import type { World } from '../shared/world';
|
|
3
3
|
import type { Vec3 } from './mesh';
|
|
4
|
+
import type { Out } from './verts';
|
|
4
5
|
/** A point of the body's frame: metres right, up and ahead of the centre. */
|
|
5
6
|
export declare const P: (x: number, y: number, a: number) => Vec3;
|
|
6
7
|
/** A flat polygon of three or four corners facing `to`; a fourth number of the colour is its layer. */
|
|
@@ -11,7 +12,7 @@ export declare const loft: (o: number[], a: Vec3[], b: Vec3[], cols: number[][],
|
|
|
11
12
|
export declare const LINK: number[];
|
|
12
13
|
export declare const TUBE: number[];
|
|
13
14
|
/** A tube from a to b, r thick. */
|
|
14
|
-
export declare const rod: (o:
|
|
15
|
+
export declare const rod: (o: Out, tube: number[], a: Vec3, b: Vec3, r: number, rgb: number[]) => void;
|
|
15
16
|
/**
|
|
16
17
|
* How far each wheel's spring is squeezed, metres in 0..CMAX, in AT's order: the simulation's own
|
|
17
18
|
* (wheels() in shared/rover.ts), from the state and the world alone. 0 is a wheel hanging in the air.
|
|
@@ -45,4 +46,4 @@ export declare const contacts: (r: Rover, w: World) => Vec3[];
|
|
|
45
46
|
* Its damage shows (wreck.ts, `n` its index among the map's vehicles): scorched where it arcs; a
|
|
46
47
|
* wreck sagged on splayed wheels, charred, falling apart at the end.
|
|
47
48
|
*/
|
|
48
|
-
export declare const rover: (out:
|
|
49
|
+
export declare const rover: (out: Out, state: Rover, w: World, spin: number, rgb: number[], lod: number, n?: number) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Choice } from '../shared/types';
|
|
2
2
|
import type { Quat } from './rig';
|
|
3
3
|
import type { Vec3 } from './mesh';
|
|
4
|
+
import type { Out } from './verts';
|
|
4
5
|
/** The regions a runner's outfit is recoloured or covered by: the skin, the trousers, the boots, the gloves, the stripes and the belt. */
|
|
5
6
|
export declare const REGION: {
|
|
6
7
|
FLESH: number;
|
|
@@ -106,7 +107,7 @@ export declare const bindOf: (build?: number) => Vec3[];
|
|
|
106
107
|
* carry it, their dual quaternions mixed by the weights (so a bent joint keeps its thickness), its
|
|
107
108
|
* normal turned the same way.
|
|
108
109
|
*/
|
|
109
|
-
export declare const skin: (out:
|
|
110
|
+
export declare const skin: (out: Out, s: Skin, { pos, rot }: {
|
|
110
111
|
pos: Vec3[];
|
|
111
112
|
rot: Quat[];
|
|
112
113
|
}, colors: number[][], face?: ArrayLike<number>) => void;
|
|
@@ -7,6 +7,7 @@ import type { Vec3 } from './mesh';
|
|
|
7
7
|
import type { Pose } from './rig';
|
|
8
8
|
import type { Face } from './expression';
|
|
9
9
|
import type { Trail } from './trail';
|
|
10
|
+
import type { Out } from './verts';
|
|
10
11
|
/** What a runner keeps between frames. */
|
|
11
12
|
export interface Runner {
|
|
12
13
|
/** The player as last seen. */
|
|
@@ -116,7 +117,7 @@ export declare const fried: (p: PlayerState) => number;
|
|
|
116
117
|
* at once, each drifts up and out on its own, and goes when `k` passes its own share, so the body
|
|
117
118
|
* thins to nothing.
|
|
118
119
|
*/
|
|
119
|
-
export declare const dissolve: (out:
|
|
120
|
+
export declare const dissolve: (out: Out, from: number, k: number) => void;
|
|
120
121
|
/**
|
|
121
122
|
* Appends a runner at level of detail `lod` (see body(): 0 far, 1 near, 3 close; its weapon is near
|
|
122
123
|
* when the runner is close): the jacket in `color` (r, g, b), dark
|
|
@@ -141,7 +142,7 @@ export declare const stance: (r: Runner) => {
|
|
|
141
142
|
carry: [Vec3, Vec3[]] | undefined;
|
|
142
143
|
};
|
|
143
144
|
/** Draws the runner and gives back its solved skeleton, or nothing once a bolt has burnt it away. */
|
|
144
|
-
export declare const soldier: (out:
|
|
145
|
+
export declare const soldier: (out: Out, r: Runner, color: number[], lod?: number, helmets?: boolean, armored?: boolean) => {
|
|
145
146
|
pos: Vec3[];
|
|
146
147
|
rot: import("./rig").Quat[];
|
|
147
148
|
} | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { WorldDef } from '../shared/world';
|
|
2
2
|
import type { Vec3 } from './mesh';
|
|
3
|
+
import type { Out } from './verts';
|
|
3
4
|
/** Cars on the roads round the play area, and on the rest of the grid out to MARKS, fewer to the kilometre. */
|
|
4
5
|
export declare const CARS = 64;
|
|
5
6
|
export declare const FAR_CARS = 160;
|
|
@@ -42,4 +43,4 @@ export declare const MODEL: {
|
|
|
42
43
|
* The drawer of a world's traffic: appends the cars in view (in front of the camera, within FAR) at
|
|
43
44
|
* time t, each BODY + CABIN + LAMPS vertices, the cabin only up to NEAR_CAR and the lamps up to LIT.
|
|
44
45
|
*/
|
|
45
|
-
export declare const traffic: (def: WorldDef) => (out:
|
|
46
|
+
export declare const traffic: (def: WorldDef) => (out: Out, eye: Vec3, fwd: Vec3, t: number) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Vec3 } from './mesh';
|
|
2
|
+
import type { Out } from './verts';
|
|
2
3
|
/** Seconds a sample of the trail lasts. */
|
|
3
4
|
export declare const LIFE = 0.15;
|
|
4
5
|
export interface Trail {
|
|
@@ -7,7 +8,7 @@ export interface Trail {
|
|
|
7
8
|
/** Ages the samples by dt seconds and drops the ones that are over. */
|
|
8
9
|
update(dt: number): void;
|
|
9
10
|
/** Appends the ribbon, in the vertex format of mesh.ts. */
|
|
10
|
-
draw(out:
|
|
11
|
+
draw(out: Out): void;
|
|
11
12
|
/** The samples alive now. */
|
|
12
13
|
readonly count: number;
|
|
13
14
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Where the vertices go: a plain array (the tests, the meshes built once) or the frame's Verts. */
|
|
2
|
+
export type Out = number[] | Verts;
|
|
3
|
+
/** Numbers written and read by index: a plain array or a Verts' store. */
|
|
4
|
+
export interface Floats {
|
|
5
|
+
[i: number]: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The frame's vertices in a store that only grows. Doubles, as a plain array holds them: what is
|
|
9
|
+
* read back (the armour off the skin) comes out the same, and the upload rounds them to floats.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Verts {
|
|
12
|
+
a: Float64Array<ArrayBuffer>;
|
|
13
|
+
/** The numbers written: the next goes there. Set it lower to drop the last ones. */
|
|
14
|
+
length: number;
|
|
15
|
+
/** Makes room for `n` numbers more and returns the store to write them in. */
|
|
16
|
+
room(n: number): Float64Array;
|
|
17
|
+
push(...v: number[]): void;
|
|
18
|
+
/** The numbers from `from` to `to` (at most the length), as an array. */
|
|
19
|
+
slice(from: number, to: number): number[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Makes room in `out` for `n` numbers more and returns where to write them by index, from
|
|
23
|
+
* `out.length` on. Set `out.length` to the end of what was written afterwards: a Verts does not
|
|
24
|
+
* count by itself (a plain array does, and the assignment is then a no-op).
|
|
25
|
+
*/
|
|
26
|
+
export declare const room: (out: Out, n: number) => Floats;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Brush, WorldDef } from '../shared/world';
|
|
2
2
|
import type { Vec3 } from './mesh';
|
|
3
|
+
import type { Out } from './verts';
|
|
3
4
|
/** A side of a brush: its axis (0 x, 2 z) and 1 for its max, 0 for its min. */
|
|
4
5
|
export type Side = [axis: number, up: number];
|
|
5
6
|
export interface Use {
|
|
@@ -13,7 +14,7 @@ export interface Use {
|
|
|
13
14
|
/** What a runner can use on brush `b` of the world `def`. */
|
|
14
15
|
export declare const uses: ({ brushes, floor }: WorldDef, b: Brush) => Use;
|
|
15
16
|
/** One face of the box min..max (flat on `axis` when min and max agree there) as two triangles, pushed in the map's vertex format. */
|
|
16
|
-
export declare const face: (out:
|
|
17
|
+
export declare const face: (out: Out, min: Vec3, max: Vec3, axis: number, up: number, layer: number, rgb: number[]) => void;
|
|
17
18
|
/** The red of every use in the world, in the map's vertex format (layer -2 glows, -1 is lit). Not on ghosts: nothing shows them. */
|
|
18
19
|
export declare const vision: (def: WorldDef) => number[];
|
|
19
20
|
/** A square on each team's roof around its base, lit paint of the team's colour: pale inside, a strong frame. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Rover } from '../shared/types';
|
|
2
2
|
import type { World } from '../shared/world';
|
|
3
3
|
import type { Vec3 } from './mesh';
|
|
4
|
+
import type { Out } from './verts';
|
|
4
5
|
/**
|
|
5
6
|
* Where a hull arcs, right of the vehicle's centre, above it and ahead of it, each on the model: a
|
|
6
7
|
* rover's (the four wheels' arms, the nose, the rear deck, the two lasers, the dashboard, the roll
|
|
@@ -29,7 +30,7 @@ export declare const sparking: (r: Rover, k: number, slot: number) => [Vec3, Vec
|
|
|
29
30
|
* last VEHICLE.FADE ticks it falls apart into embers. One just parked afresh (`wreck` below 0)
|
|
30
31
|
* shimmers in.
|
|
31
32
|
*/
|
|
32
|
-
export declare const char: (out:
|
|
33
|
+
export declare const char: (out: Out, from: number, r: Rover, k?: number) => void;
|
|
33
34
|
/** What plays a vehicle's damage: the tracer's bolts, fireballs and sparks, the sounds, the camera's shake. */
|
|
34
35
|
export interface Stage {
|
|
35
36
|
tracer: {
|
|
@@ -54,7 +55,7 @@ export interface Wrecks {
|
|
|
54
55
|
*/
|
|
55
56
|
frame(rovers: Rover[], dt: number, eye?: Vec3): Rover[];
|
|
56
57
|
/** Appends the debris and the smoke. */
|
|
57
|
-
draw(out:
|
|
58
|
+
draw(out: Out): void;
|
|
58
59
|
/** Debris and puffs in flight. */
|
|
59
60
|
readonly count: number;
|
|
60
61
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@korial29/tiny-fps",
|
|
3
3
|
"description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.145.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|