@korial29/tiny-fps 0.128.1 → 0.130.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.
@@ -30,8 +30,15 @@ export interface Tracer {
30
30
  }[]): void;
31
31
  /** A ball burst at `at`: a splash of light and a spray of sparks; a laser rifle's, `red`, bigger and fiercer. */
32
32
  burst(at: Vec3, red?: boolean): void;
33
- /** A grenade burst at `at`: a white-hot fireball in orange puffs that swells and shrinks away, a shower of embers, a strong light. */
34
- blast(at: Vec3): void;
33
+ /** A grenade burst at `at`: a white-hot fireball in orange puffs that swells and shrinks away, a shower of embers, a strong light. `size` times as wide for a vehicle blowing up. */
34
+ blast(at: Vec3, size?: number): void;
35
+ /** A shock wave from `at`: a ring of fire flat on the ground, out to `r` metres as it fades. */
36
+ ring(at: Vec3, r: number): void;
37
+ /**
38
+ * A short jagged bolt from `a` to `b` with a fork off its kink, gone in a twentieth of a second:
39
+ * an arc on a damaged hull, `wide` times as thick as the katana's bolts.
40
+ */
41
+ arc(a: Vec3, b: Vec3, wide?: number): void;
35
42
  /** The balls to draw this frame. */
36
43
  orbs(list: Orb[]): void;
37
44
  /** The katana's shock at `at`: a burst of sparks and bolts. */
@@ -1,4 +1,5 @@
1
1
  import type { Rover } from '../shared/types';
2
+ import { WING } from '../shared/ship';
2
3
  import type { Vec3 } from './mesh';
3
4
  /**
4
5
  * The ship's lines, metres ahead of the centre: the nose's tip and where its sensor starts, the
@@ -23,8 +24,8 @@ export declare const ENGINE: {
23
24
  };
24
25
  /** The engines' nozzles: right of the centre, above it, ahead of it. */
25
26
  export declare const NOZZLES: Vec3[];
26
- /** A wing's sections, at the hull, at the cannon and at the tip: right, the leading and the trailing edge ahead, the top and the bottom. */
27
- export declare const WING: number[][];
27
+ /** A wing's sections (ship.ts's: the wings collide as they are drawn). */
28
+ export { WING };
28
29
  /** The feet of the three legs it stands on: right of the centre, under it, ahead of it. */
29
30
  export declare const FEET: Vec3[];
30
31
  /** The navigation lights: red on the port tip, green on the starboard one, a strobe on the spine. */
@@ -36,9 +37,11 @@ export declare const burn: (r: Rover) => number;
36
37
  /** How far out the legs are, 0 folded to 1 down: down with nobody aboard and at a crawl, folded by 12 m/s. */
37
38
  export declare const legs: (r: Rover) => number;
38
39
  /**
39
- * Appends the ship as the state has it, unless it is gone (`wreck`), at the level of detail `lod`
40
- * (0 far to 2 near): the hull pitched and banked, the stripes and fins in `rgb` (the team's colour,
41
- * 0 to 1), its legs down or folding, the missiles it has left under the wings, the flames of its
42
- * engines and its navigation lights. `t` is the time in seconds, for the strobe.
40
+ * Appends the ship as the state has it, at the level of detail `lod` (0 far to 2 near): the hull
41
+ * pitched and banked, the stripes and fins in `rgb` (the team's colour, 0 to 1), its legs down or
42
+ * folding, the missiles it has left under the wings, the flames of its engines and its navigation
43
+ * lights. `t` is the time in seconds, for the strobe. Its damage shows (wreck.ts, `n` its index
44
+ * among the map's vehicles): scorched where it arcs; a wreck on its belly, its legs gone, charred,
45
+ * no light on it, falling apart at the end.
43
46
  */
44
- export declare const craft: (out: number[], r: Rover, rgb: number[], t: number, lod?: number) => void;
47
+ export declare const craft: (out: number[], state: Rover, rgb: number[], t: number, lod?: number, n?: number) => void;
@@ -11,6 +11,11 @@ export interface Foley {
11
11
  * call, and the keys he holds at its wheel (0 for the rider): the engine, the skid, the landings.
12
12
  */
13
13
  rover(r: Rover | undefined, dt: number, keys?: number): void;
14
+ /**
15
+ * The ship the own player flies, as drawn (undefined otherwise), `dt` seconds after the last
16
+ * call, and the keys he holds at its stick: the engines, and a crash.
17
+ */
18
+ ship(r: Rover | undefined, dt: number, keys?: number): void;
14
19
  /**
15
20
  * The own player's breath in his space helmet, `dt` seconds after the last call: in and out,
16
21
  * quicker and louder the harder he has been moving lately. None when down or without a player.
@@ -96,14 +96,21 @@ export interface Hud {
96
96
  rover(act: string, speed?: number): void;
97
97
  /** The rover's reticle, where its lasers cross: `at` on screen in [0, 1] from the top left; undefined hides it. */
98
98
  aim(at?: [number, number]): void;
99
- /** The ship flown: its armour, missiles and height, and how near its limits are (limits(), ship.ts); undefined hides it. */
99
+ /** The ship flown: its missiles and height, and how near its limits are (limits(), ship.ts); undefined hides it. */
100
100
  ship(s?: ShipPanel): void;
101
+ /**
102
+ * A vehicle's health, of VEHICLE.HP: `own` in pips for who is seated in it (undefined on foot),
103
+ * and `near` as a small bar over a vehicle close by, `at` on screen in [0, 1] from the top left.
104
+ */
105
+ hull(own?: number, near?: {
106
+ hp: number;
107
+ at: [number, number];
108
+ }): void;
101
109
  /** The end screen with the result and each player's captures and returns, `next` seconds before the next match; undefined hides it. */
102
110
  end(sum: Summary | undefined, next: number): void;
103
111
  }
104
112
  /** What the ship's panel shows. */
105
113
  export interface ShipPanel {
106
- hp: number;
107
114
  nades: number;
108
115
  /** Metres over the crater's floor. */
109
116
  alt: number;
@@ -51,7 +51,8 @@ export interface Predictor {
51
51
  /**
52
52
  * A rover the own player got out of is drawn as predicted, rolling on, until the snapshots' one is
53
53
  * within GHOST_NEAR m of it or GHOST_MS have passed. One that will not get there (the host took
54
- * him off the wheel, someone else drives it now) is eased to the snapshots' over ROVER_BLEND ms.
54
+ * him off the wheel, someone else drives it now, it blew up) is eased to the snapshots' over
55
+ * ROVER_BLEND ms.
55
56
  */
56
57
  export declare const ROVER_BLEND = 300;
57
58
  export declare const createPredictor: (world: World) => Predictor;
@@ -42,5 +42,7 @@ export declare const contacts: (r: Rover, w: World) => Vec3[];
42
42
  * world's floor, turned by `spin` radians (the distance driven over WR) and the front pair by
43
43
  * `steer`, the wishbones and the coil-overs following, the yoke turning with the wheels. `rgb` is
44
44
  * the team's colour (0 to 1): the fenders, the bonnet's stripe, the springs and the whip's light.
45
+ * Its damage shows (wreck.ts, `n` its index among the map's vehicles): scorched where it arcs; a
46
+ * wreck sagged on splayed wheels, charred, falling apart at the end.
45
47
  */
46
- export declare const rover: (out: number[], r: Rover, w: World, spin: number, rgb: number[], lod: number) => void;
48
+ export declare const rover: (out: number[], state: Rover, w: World, spin: number, rgb: number[], lod: number, n?: number) => void;
@@ -92,6 +92,17 @@ export declare const SOUND: {
92
92
  readonly DOOR: 45;
93
93
  /** And sliding shut: the servo whirs down and the panels meet with a thump. */
94
94
  readonly SHUT: 46;
95
+ /** A vehicle's damage (wreck.ts): a shot on its hull, a crackle of its arcs, its explosion, its wreck falling apart. */
96
+ readonly HULL: 47;
97
+ readonly ARC: 48;
98
+ readonly WRECK: 49;
99
+ readonly CRUMBLE: 50;
100
+ /** A vehicle's laser bolt (the user, 2026-11-12: a blaster of the films): a bright zing diving fast, metallic. */
101
+ readonly BLASTER: 51;
102
+ /** The combat ship's engines, looped: a turbine's whine over a jet's roar, played higher and louder with the thrust. */
103
+ readonly JET: 52;
104
+ /** The ship crashing into a wall, the ground or another vehicle: a crunch of metal over a deep thump. */
105
+ readonly CRASH: 53;
95
106
  };
96
107
  /**
97
108
  * The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
@@ -0,0 +1,61 @@
1
+ import type { Rover } from '../shared/types';
2
+ import type { World } from '../shared/world';
3
+ import type { Vec3 } from './mesh';
4
+ /**
5
+ * Where a hull arcs, right of the vehicle's centre, above it and ahead of it, each on the model: a
6
+ * rover's (the four wheels' arms, the nose, the rear deck, the two lasers, the dashboard, the roll
7
+ * bar's corners, behind the seats), then a ship's (the nose's tip and top, the cockpit's frame, the
8
+ * engines' intakes and nozzles, the wing tips, the spine, a cannon).
9
+ */
10
+ export declare const ANCHORS: [Vec3[], Vec3[]];
11
+ /** Ticks a vehicle parked afresh takes to shimmer in: a drawn vehicle's `wreck` counts them below 0. */
12
+ export declare const SHIMMER = 30;
13
+ /** How many places of the hull arc: by its health while it is whole, dying out on a wreck. */
14
+ export declare const arcs: (r: Pick<Rover, "hp" | "wreck">) => number;
15
+ /** The order vehicle `k` of the map's lights its places in: its own, the same on every client. */
16
+ export declare const order: (k: number) => number[];
17
+ /** The vehicle as it is drawn: a wreck sags on its wheels or its belly. */
18
+ export declare const pose: (r: Rover) => Rover;
19
+ /** The places of vehicle `k` that arc now, in the world: the first arcs() of its order(), on its pose(). */
20
+ export declare const spots: (r: Rover, k: number) => Vec3[];
21
+ /**
22
+ * The bolts of vehicle `k` in the time slot `slot` (SLOTS a second): each from a place of spots()
23
+ * to a point a short way off it, there in CHANCE of the slots. A function of the three alone.
24
+ */
25
+ export declare const sparking: (r: Rover, k: number, slot: number) => [Vec3, Vec3][];
26
+ /**
27
+ * The damage on the model of vehicle `k`, its vertices in `out` from `from` on. Hurt, its hull is
28
+ * scorched round the places that arc. A wreck is soot all over and nothing on it glows; over its
29
+ * last VEHICLE.FADE ticks it falls apart into embers. One just parked afresh (`wreck` below 0)
30
+ * shimmers in.
31
+ */
32
+ export declare const char: (out: number[], from: number, r: Rover, k?: number) => void;
33
+ /** What plays a vehicle's damage: the tracer's bolts, fireballs and sparks, the sounds, the camera's shake. */
34
+ export interface Stage {
35
+ tracer: {
36
+ arc(a: Vec3, b: Vec3, wide?: number): void;
37
+ blast(at: Vec3, size?: number): void;
38
+ ring(at: Vec3, r: number): void;
39
+ spit(at: Vec3): void;
40
+ };
41
+ audio: {
42
+ play(id: number, at?: Vec3, gain?: number, rate?: number): void;
43
+ };
44
+ fx: {
45
+ quake(k: number): void;
46
+ };
47
+ }
48
+ export interface Wrecks {
49
+ /**
50
+ * One frame over the map's vehicles as the predictor gives them: plays what happened since the
51
+ * last (a hull hit, an explosion, a wreck falling apart), lets the hurt ones arc and smoke, and
52
+ * returns them as they are drawn: a wreck's time eased between the wire's steps, a vehicle just
53
+ * parked afresh with its shimmer's ticks below 0. `eye` is where the shake is felt from.
54
+ */
55
+ frame(rovers: Rover[], dt: number, eye?: Vec3): Rover[];
56
+ /** Appends the debris and the smoke. */
57
+ draw(out: number[]): void;
58
+ /** Debris and puffs in flight. */
59
+ readonly count: number;
60
+ }
61
+ export declare const createWrecks: (world: World, { tracer, audio, fx }: Stage) => Wrecks;
@@ -370,3 +370,19 @@ export declare const END_SCREEN = 10;
370
370
  /** Longest player name, in characters (code points). */
371
371
  export declare const MAX_NAME = 16;
372
372
  export declare const RULES: Rules;
373
+ /**
374
+ * A vehicle's health (the user, 2026-11-12), a rover's and a ship's alike: HP when parked afresh;
375
+ * at 0 it blows up, its crew goes down with it and its wreck lies WRECK ticks (5 s), falling apart
376
+ * over the last FADE of them, before it is parked afresh. A plasma ball takes its power, a cut its
377
+ * hp, a blast what it takes from a body; of the laser bolts and the rifle's rounds every GRAZE that
378
+ * meet the hull take 1; the rail gun's bolt drains it as it does a player. The wire holds HP in 7
379
+ * bits and WRECK / 4 in a byte. A rover's wreck keeps SKID of its speed along the ground each tick:
380
+ * from top speed it skids under 5 m and lies there.
381
+ */
382
+ export declare const VEHICLE: {
383
+ readonly HP: 10;
384
+ readonly WRECK: 300;
385
+ readonly FADE: 60;
386
+ readonly GRAZE: 4;
387
+ readonly SKID: 0.92;
388
+ };
@@ -32,7 +32,7 @@ export declare const stepOf: (b: Ball) => number;
32
32
  * Distance at which the ray from `o` along the unit `d` enters the upright cylinder of radius `r`
33
33
  * on `c`'s feet, `h` tall; Infinity on a miss.
34
34
  */
35
- export declare const cylinder: (o: Vec3, d: Vec3, c: PlayerState, r: number, h: number) => number;
35
+ export declare const cylinder: (o: Vec3, d: Vec3, c: Pick<PlayerState, "x" | "y" | "z">, r: number, h: number) => number;
36
36
  /**
37
37
  * Flies `b` on by `m` metres (at most what it has left) as a sphere of PLASMA_R: it stops and
38
38
  * bursts on the first brush, or on the first of `foes` whose body (a cylinder PLASMA_R wider, ARC_R
@@ -45,7 +45,7 @@ export declare const MSG_SNAPSHOT = 2;
45
45
  export declare const INPUT_BYTES = 12;
46
46
  export declare const SNAP_HEAD = 4;
47
47
  export declare const SNAP_PLAYER = 62;
48
- /** Bytes of a rover: thirteen float32, the two seats and a ship's three bytes. */
48
+ /** Bytes of a rover: thirteen float32, the two seats, then the kind and health, the wreck's time and a ship's missiles. */
49
49
  export declare const SNAP_ROVER = 57;
50
50
  /** The rover count has three bits of the head's count byte, the players the other five. */
51
51
  export declare const MAX_ROVERS = 7;
@@ -4,7 +4,7 @@ export declare class Room {
4
4
  /** Every connected peer; null until it joins. */
5
5
  private peers;
6
6
  private ticks;
7
- /** The players as each snapshot of the last MAX_REWIND ticks sent them. */
7
+ /** The players and the vehicles as each snapshot of the last MAX_REWIND ticks sent them. */
8
8
  private history;
9
9
  private world;
10
10
  private ctf;
@@ -20,6 +20,8 @@ export declare class Room {
20
20
  private rovers;
21
21
  /** Ticks toward each ship's next missile, by index in `rovers`. */
22
22
  private rearm;
23
+ /** Each vehicle's damage short of a whole hp, by index in `rovers`. */
24
+ private wear;
23
25
  /** The key of the map being played, which the roster tells the clients. */
24
26
  private mapName;
25
27
  /** The map the host picked for the next match, when it is another one. */
@@ -28,6 +30,8 @@ export declare class Room {
28
30
  private joins;
29
31
  /** Missing rules fall back to RULES. The map is the rules' one, unless a definition is given. */
30
32
  constructor(rules?: Partial<Rules>, def?: WorldDef);
33
+ /** Every vehicle of the map parked afresh: whole, empty, on its spawn. */
34
+ private fresh;
31
35
  /** The health, ammo and cell packs of the map, all there (0 ticks before each is back). */
32
36
  private spots;
33
37
  /** The host: the player in the room the longest. */
@@ -67,6 +71,14 @@ export declare class Room {
67
71
  rewind(id: number, view?: number): PlayerState[];
68
72
  /** Every player as the snapshots around the view tick `view` showed him: rewind(), the asker included. */
69
73
  private past;
74
+ /** The two kept snapshots around the view tick `view`, and the mix between them; nothing with no history. */
75
+ private around;
76
+ /**
77
+ * The vehicles a shooter of `team` may hurt, each with its index, as he drew them at the view
78
+ * tick `view` (the place interpolated like a player's, the angles the later snapshot's); as
79
+ * they are now with no `view`. For the katana and the rail gun, which strike where he saw.
80
+ */
81
+ private hulls;
70
82
  /**
71
83
  * After a move of `p` at the view tick `view`: a dash or a slide that overlaps an enemy carrier
72
84
  * tackles him. The carrier is where `p` drew him (lag compensation), so a tackle that hit on
@@ -96,9 +108,9 @@ export declare class Room {
96
108
  * Flies the ball `b` on by `m` metres: one that bursts on an enemy who is up takes its power in hp
97
109
  * from him, and counts a hit to its shooter. An arc takes its cut's hp; one it does not put down
98
110
  * is floored (FLOOR_TICKS, `zap`), thrown ARC_KNOCK m/s the way it flies, and drops the flag.
99
- * A grenade flies one tick of its arc whatever `m`, and its burst is a blast: every enemy who is
100
- * up, and its owner, lose what blast() gives where they stand now; one hit for the shooter when
101
- * it hurt an enemy.
111
+ * A grenade flies one tick of its arc whatever `m`, and its burst is a blast (boom()); one hit
112
+ * for the shooter when it hurt an enemy or his vehicle. A ball an enemy vehicle's hull stops
113
+ * (ram()) hurts the hull, not the crew behind it.
102
114
  */
103
115
  private fly;
104
116
  /**
@@ -106,7 +118,8 @@ export declare class Room {
106
118
  * (`strike`), and the `hits` count goes up once. Each takes the cut's hp; one it does not put
107
119
  * down is shocked: a stumble of SHOCK_TICKS thrown SHOCK_KNOCK m/s the way the blade throws him, with
108
120
  * `zap`, and `by` the attacker. A shock drops no flag. One it puts down loses the limb the blade
109
- * crosses where `p` drew him (`limbOf`).
121
+ * crosses where `p` drew him (`limbOf`). An enemy vehicle's hull the cut meets (slashed(), where
122
+ * `p` drew it) takes the cut's hp, and its crew none of it.
110
123
  */
111
124
  private cut;
112
125
  /**
@@ -120,7 +133,7 @@ export declare class Room {
120
133
  /**
121
134
  * The rail gun's bolt of `p` at the view tick `view`: the first enemy it enters as `p` drew him is
122
135
  * drained for RAIL_TICKS more (`slow`). A first touch, when he was not drained, takes 1 hp at once
123
- * and counts a hit.
136
+ * and counts a hit. An enemy vehicle's hull is drained the same way, and shields who is behind it.
124
137
  */
125
138
  private rail;
126
139
  /** 1 hp of the bolt's drain to `foe`; if it puts him down he is disintegrated (`fried`). */
@@ -150,7 +163,7 @@ export declare class Room {
150
163
  * respawned or stumbled out is off the rover.
151
164
  */
152
165
  /**
153
- * The first enemy ship on the way the ball `b` flew this tick, from `o` to where it is now: the
166
+ * The first enemy vehicle on the way the ball `b` flew this tick, from `o` to where it is now: the
154
167
  * ball bursts on its hull, short of a body or a wall further on.
155
168
  */
156
169
  private ram;
@@ -167,6 +180,8 @@ export declare class Room {
167
180
  private carry;
168
181
  /** The rover fell under the kill floor: who was aboard is back at a spawn, it is parked again. */
169
182
  private sink;
183
+ /** Vehicle `k` parked afresh on its spawn: whole, empty. */
184
+ private renew;
170
185
  /**
171
186
  * After a step of the driver `p` at the view tick `view`: the rover's body (footprint()) over an
172
187
  * enemy on foot, as `p` drew him, runs him over. Closing on him at ROVER.SPLAT_KILL or more puts
@@ -184,17 +199,42 @@ export declare class Room {
184
199
  */
185
200
  private launch;
186
201
  /**
187
- * A ship's clock outside its pilot's inputs: one that is gone comes back on its pad, new, after
188
- * SHIP.WRECK ticks; one short of missiles loads one each SHIP.RELOAD ticks.
202
+ * What the look of the driver `p` meets for his guns' aim (aimOf()): a brush, an enemy vehicle's
203
+ * hull where it is, or an enemy on foot who is up as `p` drew him at the input's view tick.
204
+ */
205
+ private sight;
206
+ /**
207
+ * A vehicle's clock outside its driver's inputs: a wreck is parked afresh after VEHICLE.WRECK
208
+ * ticks; a hull the rail gun's bolt sears loses 1 hp each RAIL_DRAIN ticks after its first touch;
209
+ * a ship short of missiles loads one each SHIP.RELOAD ticks.
189
210
  */
190
211
  private dock;
191
- /** The ships an enemy of `team` pilots and that are there to hit. */
212
+ /** The team a vehicle is of: its driver's, else its rider's, else the one whose base it is parked at. */
213
+ private teamOf;
214
+ /** The vehicles a shooter of `team` hurts: whole, and not of his team. */
192
215
  private targets;
193
216
  /**
194
- * The ship `r` loses `hp` of armour to the shot of `by`; at 0 it blows up where it is: its pilot
195
- * goes down with it, and it is gone SHIP.WRECK ticks.
217
+ * A vehicle that crashed with a jolt of `jolt` m/s: a ship into a brush, the ground or another
218
+ * vehicle (pilot()), a rover into a wall or a vehicle (drive()). 1 hp each CRASH_HP past CRASH
219
+ * (SHIP's, ROVER's), nobody's shot; at 0 it blows up as its team's, so its blast spares its mates.
196
220
  */
221
+ private crash;
222
+ /** The vehicle `r` loses `hp` to player `by` of `team`; at 0 it blows up (wreck()). */
197
223
  private hurt;
224
+ /**
225
+ * The vehicle blows up where it is, by the hand of player `by` of `team`: who is aboard goes
226
+ * down on the spot, and it is a wreck for VEHICLE.WRECK ticks, with no seat, moved by the tick
227
+ * alone. Its blast is a grenade of `by` at its centre (boom()).
228
+ */
229
+ private wreck;
230
+ /**
231
+ * A blast at `c`, the grenade's rule, of player `by` of `team`: every enemy on foot who is up,
232
+ * and `by` himself, lose what blast() gives where they stand now; every enemy vehicle loses
233
+ * NADE_HP at its hull, less with the distance to it, nothing from NADE_R on or behind a brush.
234
+ * Who is seated is behind his hull: the blast takes nothing from him. True when it hurt an enemy
235
+ * or his vehicle.
236
+ */
237
+ private boom;
198
238
  private splat;
199
239
  /** The first spawn point of the team with none of `others` within SPAWN_CLEAR, else the next one round-robin. */
200
240
  private place;
@@ -53,6 +53,12 @@ export declare const ROVER: {
53
53
  readonly WHEEL_STEP: 0.6;
54
54
  /** The share of its speed into another rover a rover bounces back with. */
55
55
  readonly BOUNCE: 0.3;
56
+ /**
57
+ * A crash (the user, 2026-11-12): the speed on the level that a step's walls and vehicles take
58
+ * away (m/s) past CRASH costs 1 hp each CRASH_HP more. A landing is the springs': no crash.
59
+ */
60
+ readonly CRASH: 10;
61
+ readonly CRASH_HP: 3;
56
62
  /** A player this close to a rover's centre gets in; a rover this fast hurts an enemy, and this fast puts him down. */
57
63
  readonly ENTER_R: 3;
58
64
  readonly SPLAT_MIN: 6;
@@ -80,11 +86,46 @@ export declare const footprint: (r: Rover) => Vec3[];
80
86
  * rear circles of footprint(), RB wide and BODY_H tall. A player walks into it and stands on it.
81
87
  */
82
88
  export declare const hull: (r: Rover) => Body;
89
+ /** Every solid of the vehicle: a rover's hull(), a ship's hull and its two wings. */
90
+ export declare const hulls: (r: Rover) => Body[];
83
91
  /**
84
- * The map's rovers at rest on their spawns, nobody aboard, then its ships on their pads (ship.ts):
85
- * the order of the snapshot's.
92
+ * A rover's wreck skids to a stop where it blew up: before each of its steps with nobody at the
93
+ * wheel it keeps VEHICLE.SKID of its speed along the ground. A ship's wreck falls as it flew.
94
+ */
95
+ export declare const skid: (r: Rover) => void;
96
+ /**
97
+ * The vehicles' bodies as the step of `p` on foot meets them: every hull(), but for a player who
98
+ * is down the wrecks' (his own vehicle's among them: he lies where it blew up, and no wreck that
99
+ * moves under him bends his replay).
100
+ */
101
+ export declare const solid: (rovers: readonly Rover[], p: Pick<PlayerState, "down">) => Body[];
102
+ /**
103
+ * The map's rovers at rest on their spawns, whole, nobody aboard, then its ships on their pads
104
+ * (ship.ts): the order of the snapshot's.
86
105
  */
87
106
  export declare const park: (w: World) => Rover[];
107
+ /**
108
+ * The team whose base vehicle `k` of park() is parked at: of the rovers, then of the ships, the
109
+ * first half are red's (the renderer paints them so).
110
+ */
111
+ export declare const homeOf: (w: World, k: number) => number;
112
+ /**
113
+ * Where a shot from `o` along the unit `d` meets the vehicle's body within `m` metres: the
114
+ * distance, or Infinity. A rover's body is its footprint()'s circles, BODY_H tall; a ship's is
115
+ * ship.ts's spheres.
116
+ */
117
+ export declare const struck: (r: Rover, o: Vec3, d: Vec3, m: number) => number;
118
+ /** The distance from `c` to the nearest point of the vehicle's body (struck()'s), 0 inside. */
119
+ export declare const reach: (r: Rover, c: Vec3) => number;
120
+ /**
121
+ * Whether a cut of `p` with this reach and arc (blade.ts's strike(), for a hull) meets the
122
+ * vehicle: its hull() within reach of his centre on the floor plane, inside the arc round his look
123
+ * (the hull's own angular radius counts), the heights overlapping and no brush before it.
124
+ */
125
+ export declare const slashed: (w: World, r: Rover, p: PlayerState, { reach, arc }: {
126
+ reach: number;
127
+ arc: number;
128
+ }) => boolean;
88
129
  /**
89
130
  * One step of 1 / TICK_HZ s, in place. `i` is the driver's input as the wire rounds it (FORWARD and
90
131
  * BACK the throttle, JUMP the handbrake, its yaw where the nose is steered to), or undefined with
@@ -98,7 +139,7 @@ export declare const park: (w: World) => Rover[];
98
139
  * turns toward the look as fast as the speed allows, and the tyres' grip decides how much of the
99
140
  * speed follows it. The rest drifts.
100
141
  */
101
- export declare const drive: (r: Rover, i: Input | undefined, w: World, fleet?: readonly Rover[]) => boolean;
142
+ export declare const drive: (r: Rover, i: Input | undefined, w: World, fleet?: readonly Rover[], crash?: (jolt: number) => void) => boolean;
102
143
  /**
103
144
  * Puts the body of a player on seat `s` (0 the driver's, 1 the rider's) of the rover, with its
104
145
  * speed. The seat leans with the body: on a slope he is not left in the air.
@@ -122,7 +163,7 @@ export declare const leave: (p: PlayerState, r: Rover, s: 0 | 1, w: World) => vo
122
163
  * that takes him off his seat (move() puts a body under the kill floor back at a spawn) frees it.
123
164
  * `fleet` is drive()'s.
124
165
  */
125
- export declare const ride: (p: PlayerState, r: Rover, i: Input, w: World, team: number, fleet?: readonly Rover[]) => boolean;
166
+ export declare const ride: (p: PlayerState, r: Rover, i: Input, w: World, team: number, fleet?: readonly Rover[], crash?: (jolt: number) => void) => boolean;
126
167
  /** The squared distance on the floor plane from the vehicle's centre to the player. */
127
168
  export declare const gap2: (r: Rover, p: {
128
169
  x: number;
@@ -130,7 +171,7 @@ export declare const gap2: (r: Rover, p: {
130
171
  }) => number;
131
172
  /**
132
173
  * A player on foot near enough to get in: on the floor plane within ENTER_R of the centre, and
133
- * within the reach in height (a ship's ENTER_H). A ship that is gone has no seat.
174
+ * within the reach in height (a ship's ENTER_H). A wreck has no seat.
134
175
  */
135
176
  export declare const nearby: (r: Rover, p: {
136
177
  x: number;
@@ -144,18 +185,29 @@ export declare const nearby: (r: Rover, p: {
144
185
  export declare const free: (r: Rover, carrier: boolean) => 0 | 1 | -1;
145
186
  /** Metres from the centre to where the lasers cross along the look: a ship's or a rover's. */
146
187
  export declare const aimRange: (r: Rover) => number;
147
- /** Where the lasers cross: aimRange() metres from the centre along the driver's look. */
148
- export declare const aimOf: (r: Rover, yaw: number, pitch: number) => [number, number, number];
188
+ /**
189
+ * What the driver's look meets from the vehicle's centre along the unit `d`, within `max` metres:
190
+ * the distance, or Infinity. The room's sight(), the client's reticle.
191
+ */
192
+ export type Sight = (o: Vec3, d: Vec3, max: number) => number;
193
+ /** The lasers never cross nearer than this: the beams would fly sideways. */
194
+ export declare const AIM_MIN = 8;
195
+ /**
196
+ * Where the lasers cross: on what the driver's look meets within the guns' range (`sight`, the
197
+ * user, 2026-11-12: with a cross at a fixed distance the two beams went either side of a rover
198
+ * nearer than it), AIM_MIN at least; else aimRange() metres from the centre along the look.
199
+ */
200
+ export declare const aimOf: (r: Rover, yaw: number, pitch: number, sight?: Sight) => [number, number, number];
149
201
  /**
150
202
  * The two bolts of one salvo of the rover's lasers, left then right: each from its muzzle toward
151
203
  * the point GUN_AIM metres along the driver's look (the yaw and pitch of his input) from the rover's
152
204
  * centre, so the beams cross there, chest high on level ground with a level look. `id` names the first, `id + 1` the second.
153
205
  */
154
- export declare const bolts: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number) => Flying[];
206
+ export declare const bolts: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number, sight?: Sight) => Flying[];
155
207
  /**
156
208
  * A ship's missile from its pod `k` (0 left, 1 right) toward where its lasers cross: a grenade
157
209
  * (plasma.ts's toss() flies it, blast() is its burst) launched at MISSILE_SPEED plus the ship's own
158
210
  * speed along the way, 63 m/s at most (the wire's six bits).
159
211
  */
160
- export declare const missile: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number, k: number) => Flying;
212
+ export declare const missile: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number, k: number, sight?: Sight) => Flying;
161
213
  export {};
@@ -47,9 +47,6 @@ export declare const SHIP: {
47
47
  /** A player this close to the centre (on the floor plane) and within this height gets in. */
48
48
  readonly ENTER_R: 6;
49
49
  readonly ENTER_H: 4;
50
- /** Armour, and the ticks a destroyed ship is gone before it is back on its pad. */
51
- readonly HP: 60;
52
- readonly WRECK: 600;
53
50
  /** The lasers: ticks between two salvos, the bolts' reach, and where the beams cross ahead along the look. */
54
51
  readonly GUN_COOL: 6;
55
52
  readonly GUN_RANGE: 160;
@@ -59,16 +56,25 @@ export declare const SHIP: {
59
56
  readonly MISSILE_COOL: 30;
60
57
  readonly RELOAD: 300;
61
58
  readonly MISSILE_SPEED: 60;
62
- /** A missile's burst: the armour it takes at the hull, falling off to nothing this far from it. */
63
- readonly BLAST_HP: 14;
64
- readonly BLAST_R: 7;
65
- /** The armour a laser bolt or a rifle round takes, and a plasma ball per point of its power. */
66
- readonly BOLT_HP: 1;
67
- readonly BALL_HP: 2;
59
+ /**
60
+ * A crash (the user, 2026-11-12): the speed a step's collisions take away (m/s, the vertical
61
+ * part halved, so a sink onto a pad is no crash) past CRASH costs 1 hp each CRASH_HP more.
62
+ */
63
+ readonly CRASH: 12;
64
+ readonly CRASH_HP: 4;
65
+ /** How much of the speed into another vehicle comes back off it. */
66
+ readonly BOUNCE: 0.3;
68
67
  };
69
68
  /** The lasers' muzzles under the wings, the missiles' pods under the wings: right of the centre, above it, ahead of it. */
70
69
  export declare const SHIP_GUNS: number[][];
71
70
  export declare const PODS: number[][];
71
+ /**
72
+ * A wing's sections, at the hull, at the cannon and at the tip: right, the leading and the trailing
73
+ * edge ahead, the top and the bottom. craft.ts draws them; the shots, the players on foot, the
74
+ * other vehicles and the brushes meet them (the user, 2026-11-12: the wings went through all).
75
+ */
76
+ export declare const WING: number[][];
77
+ export declare const WING_BOXES: [number, number][][];
72
78
  /** The pilot's seat in the cockpit, behind the long nose: right of the centre, above it (the feet), ahead of it. */
73
79
  export declare const COCKPIT: number[];
74
80
  /** Where who gets out stands, beside the cockpit: clear of the hull, ahead of the wings. */
@@ -78,13 +84,17 @@ type Vec3 = [x: number, y: number, z: number];
78
84
  export declare const axes: (r: Rover) => [Vec3, Vec3, Vec3];
79
85
  /** A point of the ship, `b` m right of the centre, `u` m above it and `a` m ahead of it. */
80
86
  export declare const point: (r: Rover, b: number, u: number, a: number) => Vec3;
81
- /** The map's ships at rest on their pads: full armour and missiles, nobody aboard. */
87
+ /** The map's ships at rest on their pads: whole, full of missiles, nobody aboard. */
82
88
  export declare const dock: (ships?: readonly Spawn[]) => Rover[];
83
89
  /**
84
90
  * The hull as the players on foot and the rovers meet it: the stadium from the tail to the nose
85
91
  * along the floor plane, R wide, from the skids up H. A player walks into it and stands on it.
86
92
  */
87
93
  export declare const shipHull: (r: Rover) => Body;
94
+ /** The wings as solids (WING_BODY), the left one then the right one. */
95
+ export declare const wings: (r: Rover) => Body[];
96
+ /** Every solid of the ship: its hull, then its wings. */
97
+ export declare const shipBodies: (r: Rover) => Body[];
88
98
  /**
89
99
  * How near the ship is to its limits, each 0 inside and 1 at the limit (more past it): the ceiling
90
100
  * and the edge of the crater. For the HUD.
@@ -93,20 +103,20 @@ export declare const limits: (r: Pick<Rover, "x" | "y" | "z">, w: World) => [up:
93
103
  /**
94
104
  * One step of 1 / TICK_HZ s, in place. `i` is the pilot's input as the wire rounds it, or
95
105
  * undefined with nobody at the stick: the engines are off and it falls under the map's gravity to
96
- * a floor. A ship that is gone (`wreck`) does not move. Returns whether it fell under the kill
97
- * floor: the caller docks it again.
106
+ * a floor, a wreck as well. Returns whether it fell under the kill floor: the caller docks it
107
+ * again.
98
108
  *
99
109
  * The nose turns toward the look as fast as the rates allow and banks into the turn; the thrust
100
110
  * is along the nose, sideways and straight up, against a drag that sets the top speed. Piloted,
101
111
  * the engines hold it against gravity: it hovers with no key held. On a floor it rests on its
102
112
  * skids, level.
103
113
  */
104
- export declare const pilot: (r: Rover, i: Input | undefined, w: World) => boolean;
114
+ export declare const pilot: (r: Rover, i: Input | undefined, w: World, others?: readonly Body[], crash?: (jolt: number) => void) => boolean;
105
115
  /**
106
116
  * Where a shot from `o` along the unit `d` meets the hull within `m` metres: the distance, or
107
- * Infinity. The hull is the HITS spheres; a ship that is gone has none.
117
+ * Infinity. The hull is the HITS spheres.
108
118
  */
109
119
  export declare const struck: (r: Rover, o: Vec3, d: Vec3, m: number) => number;
110
- /** The distance from `c` to the nearest point of the hull's spheres, 0 inside. */
120
+ /** The distance from `c` to the nearest point of the hull's spheres and the wings, 0 inside. */
111
121
  export declare const reach: (r: Rover, c: Vec3) => number;
112
122
  export {};
@@ -375,9 +375,9 @@ export interface Rover {
375
375
  rider: number;
376
376
  /** A spaceship, not a rover. Absent: a rover. */
377
377
  ship?: boolean;
378
- /** A ship's armour, SHIP.HP when new. */
378
+ /** Its health, VEHICLE.HP when parked afresh (and when absent). The host's alone: no step reads it. */
379
379
  hp?: number;
380
- /** Ticks before a destroyed ship is back on its pad: 0 while it is there to fly. */
380
+ /** Ticks its wreck still lies there before it is parked afresh: 0 while it is whole. */
381
381
  wreck?: number;
382
382
  /** A ship's missiles left. */
383
383
  nades?: number;
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.128.1",
5
+ "version": "0.130.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"