@korial29/tiny-fps 0.128.0 → 0.129.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/dist/index.js +15 -15
- package/dist/local.js +1 -1
- package/dist/server.js +300 -119
- package/dist/types/client/beams.d.ts +9 -2
- package/dist/types/client/craft.d.ts +7 -5
- package/dist/types/client/hud.d.ts +10 -2
- package/dist/types/client/predict.d.ts +2 -1
- package/dist/types/client/rover.d.ts +3 -1
- package/dist/types/client/sfx.d.ts +5 -0
- package/dist/types/client/soldier.d.ts +16 -0
- package/dist/types/client/wreck.d.ts +61 -0
- package/dist/types/shared/constants.d.ts +16 -0
- package/dist/types/shared/plasma.d.ts +1 -1
- package/dist/types/shared/protocol.d.ts +1 -1
- package/dist/types/shared/room.d.ts +42 -13
- package/dist/types/shared/rover.d.ts +36 -3
- package/dist/types/shared/ship.d.ts +4 -13
- package/dist/types/shared/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -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. */
|
|
@@ -36,9 +36,11 @@ export declare const burn: (r: Rover) => number;
|
|
|
36
36
|
/** 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
37
|
export declare const legs: (r: Rover) => number;
|
|
38
38
|
/**
|
|
39
|
-
* Appends the ship as the state has it,
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
39
|
+
* Appends the ship as the state has it, at the level of detail `lod` (0 far to 2 near): the hull
|
|
40
|
+
* pitched and banked, the stripes and fins in `rgb` (the team's colour, 0 to 1), its legs down or
|
|
41
|
+
* folding, the missiles it has left under the wings, the flames of its engines and its navigation
|
|
42
|
+
* lights. `t` is the time in seconds, for the strobe. Its damage shows (wreck.ts, `n` its index
|
|
43
|
+
* among the map's vehicles): scorched where it arcs; a wreck on its belly, its legs gone, charred,
|
|
44
|
+
* no light on it, falling apart at the end.
|
|
43
45
|
*/
|
|
44
|
-
export declare const craft: (out: number[],
|
|
46
|
+
export declare const craft: (out: number[], state: Rover, rgb: number[], t: number, lod?: number, n?: number) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Result } from '../shared/protocol';
|
|
2
2
|
import type { PlayerState, Rover, Snapshot } from '../shared/types';
|
|
3
3
|
import type { Mark } from './marks';
|
|
4
|
+
export declare const rim: () => [number, number][];
|
|
4
5
|
export declare const HUD_CSS: string;
|
|
5
6
|
/** The tabs of the title screen's menu, the first one shown first. */
|
|
6
7
|
export declare const TABS: string[];
|
|
@@ -95,14 +96,21 @@ export interface Hud {
|
|
|
95
96
|
rover(act: string, speed?: number): void;
|
|
96
97
|
/** The rover's reticle, where its lasers cross: `at` on screen in [0, 1] from the top left; undefined hides it. */
|
|
97
98
|
aim(at?: [number, number]): void;
|
|
98
|
-
/** The ship flown: its
|
|
99
|
+
/** The ship flown: its missiles and height, and how near its limits are (limits(), ship.ts); undefined hides it. */
|
|
99
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;
|
|
100
109
|
/** The end screen with the result and each player's captures and returns, `next` seconds before the next match; undefined hides it. */
|
|
101
110
|
end(sum: Summary | undefined, next: number): void;
|
|
102
111
|
}
|
|
103
112
|
/** What the ship's panel shows. */
|
|
104
113
|
export interface ShipPanel {
|
|
105
|
-
hp: number;
|
|
106
114
|
nades: number;
|
|
107
115
|
/** Metres over the crater's floor. */
|
|
108
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
|
|
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[],
|
|
48
|
+
export declare const rover: (out: number[], state: Rover, w: World, spin: number, rgb: number[], lod: number, n?: number) => void;
|
|
@@ -92,6 +92,11 @@ 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;
|
|
95
100
|
};
|
|
96
101
|
/**
|
|
97
102
|
* The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
|
|
@@ -35,6 +35,9 @@ export interface Runner {
|
|
|
35
35
|
dt: number;
|
|
36
36
|
/** The seat he rides in, when he does and his rover is known. */
|
|
37
37
|
seat?: Seat;
|
|
38
|
+
/** The head of the runner he looks at (watched()), and how far his own is turned to it, eased: to his right and up, radians. */
|
|
39
|
+
watch?: Vec3;
|
|
40
|
+
gaze?: number[];
|
|
38
41
|
/** The muzzle of the long gun in his hands as last drawn, from his feet: where its shots are seen to leave (combat.ts). */
|
|
39
42
|
tip?: Vec3;
|
|
40
43
|
/** The BUILD of the body (rig.ts, PlayerInfo.body): the man's when absent. */
|
|
@@ -59,6 +62,19 @@ export declare const createRunner: (p: PlayerState, seat?: Seat, build?: number)
|
|
|
59
62
|
* runner already in pose, one that left loses it. With a `world` the feet stand on the brushes
|
|
60
63
|
* under them. The `tracer` gets the sparks of a limb cut off.
|
|
61
64
|
*/
|
|
65
|
+
/**
|
|
66
|
+
* The head turns to the runner one looks at (the user, 2026-11-12): the nearest within `far`
|
|
67
|
+
* metres and `cone` radians of his aim. It turns no further than `turn` (to a side, up or down)
|
|
68
|
+
* from where it points, the eyes going the rest of their travel; `rate` is how fast, per second.
|
|
69
|
+
*/
|
|
70
|
+
export declare const WATCH: {
|
|
71
|
+
far: number;
|
|
72
|
+
cone: number;
|
|
73
|
+
turn: number[];
|
|
74
|
+
rate: number;
|
|
75
|
+
};
|
|
76
|
+
/** Where the head of the runner `p` looks at is, among `crowd`: nothing when he looks at no one, or is down. */
|
|
77
|
+
export declare const watched: (p: PlayerState, crowd: PlayerState[]) => Vec3 | undefined;
|
|
62
78
|
export declare const animate: (book: Map<number, Runner>, others: PlayerState[], dt: number, world?: World, tracer?: Pick<Tracer, "shock" | "spit">, rovers?: Rover[], builds?: ReadonlyMap<number, number>) => void;
|
|
63
79
|
/**
|
|
64
80
|
* A long gun's butt plate in the hollow of the right shoulder: from the shoulder joint, in the
|
|
@@ -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
|
|
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
|
|
100
|
-
*
|
|
101
|
-
*
|
|
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
|
|
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,31 @@ export declare class Room {
|
|
|
184
199
|
*/
|
|
185
200
|
private launch;
|
|
186
201
|
/**
|
|
187
|
-
* A
|
|
188
|
-
*
|
|
202
|
+
* A vehicle's clock outside its driver's inputs: a wreck is parked afresh after VEHICLE.WRECK
|
|
203
|
+
* ticks; a hull the rail gun's bolt sears loses 1 hp each RAIL_DRAIN ticks after its first touch;
|
|
204
|
+
* a ship short of missiles loads one each SHIP.RELOAD ticks.
|
|
189
205
|
*/
|
|
190
206
|
private dock;
|
|
191
|
-
/** The
|
|
207
|
+
/** The team a vehicle is of: its driver's, else its rider's, else the one whose base it is parked at. */
|
|
208
|
+
private teamOf;
|
|
209
|
+
/** The vehicles a shooter of `team` hurts: whole, and not of his team. */
|
|
192
210
|
private targets;
|
|
211
|
+
/** The vehicle `r` loses `hp` to player `by` of `team`; at 0 it blows up (wreck()). */
|
|
212
|
+
private hurt;
|
|
193
213
|
/**
|
|
194
|
-
* The
|
|
195
|
-
*
|
|
214
|
+
* The vehicle blows up where it is, by the hand of player `by` of `team`: who is aboard goes
|
|
215
|
+
* down on the spot, and it is a wreck for VEHICLE.WRECK ticks, with no seat, moved by the tick
|
|
216
|
+
* alone. Its blast is a grenade of `by` at its centre (boom()).
|
|
196
217
|
*/
|
|
197
|
-
private
|
|
218
|
+
private wreck;
|
|
219
|
+
/**
|
|
220
|
+
* A blast at `c`, the grenade's rule, of player `by` of `team`: every enemy on foot who is up,
|
|
221
|
+
* and `by` himself, lose what blast() gives where they stand now; every enemy vehicle loses
|
|
222
|
+
* NADE_HP at its hull, less with the distance to it, nothing from NADE_R on or behind a brush.
|
|
223
|
+
* Who is seated is behind his hull: the blast takes nothing from him. True when it hurt an enemy
|
|
224
|
+
* or his vehicle.
|
|
225
|
+
*/
|
|
226
|
+
private boom;
|
|
198
227
|
private splat;
|
|
199
228
|
/** The first spawn point of the team with none of `others` within SPAWN_CLEAR, else the next one round-robin. */
|
|
200
229
|
private place;
|
|
@@ -81,10 +81,43 @@ export declare const footprint: (r: Rover) => Vec3[];
|
|
|
81
81
|
*/
|
|
82
82
|
export declare const hull: (r: Rover) => Body;
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
84
|
+
* A rover's wreck skids to a stop where it blew up: before each of its steps with nobody at the
|
|
85
|
+
* wheel it keeps VEHICLE.SKID of its speed along the ground. A ship's wreck falls as it flew.
|
|
86
|
+
*/
|
|
87
|
+
export declare const skid: (r: Rover) => void;
|
|
88
|
+
/**
|
|
89
|
+
* The vehicles' bodies as the step of `p` on foot meets them: every hull(), but for a player who
|
|
90
|
+
* is down the wrecks' (his own vehicle's among them: he lies where it blew up, and no wreck that
|
|
91
|
+
* moves under him bends his replay).
|
|
92
|
+
*/
|
|
93
|
+
export declare const solid: (rovers: readonly Rover[], p: Pick<PlayerState, "down">) => Body[];
|
|
94
|
+
/**
|
|
95
|
+
* The map's rovers at rest on their spawns, whole, nobody aboard, then its ships on their pads
|
|
96
|
+
* (ship.ts): the order of the snapshot's.
|
|
86
97
|
*/
|
|
87
98
|
export declare const park: (w: World) => Rover[];
|
|
99
|
+
/**
|
|
100
|
+
* The team whose base vehicle `k` of park() is parked at: of the rovers, then of the ships, the
|
|
101
|
+
* first half are red's (the renderer paints them so).
|
|
102
|
+
*/
|
|
103
|
+
export declare const homeOf: (w: World, k: number) => number;
|
|
104
|
+
/**
|
|
105
|
+
* Where a shot from `o` along the unit `d` meets the vehicle's body within `m` metres: the
|
|
106
|
+
* distance, or Infinity. A rover's body is its footprint()'s circles, BODY_H tall; a ship's is
|
|
107
|
+
* ship.ts's spheres.
|
|
108
|
+
*/
|
|
109
|
+
export declare const struck: (r: Rover, o: Vec3, d: Vec3, m: number) => number;
|
|
110
|
+
/** The distance from `c` to the nearest point of the vehicle's body (struck()'s), 0 inside. */
|
|
111
|
+
export declare const reach: (r: Rover, c: Vec3) => number;
|
|
112
|
+
/**
|
|
113
|
+
* Whether a cut of `p` with this reach and arc (blade.ts's strike(), for a hull) meets the
|
|
114
|
+
* vehicle: its hull() within reach of his centre on the floor plane, inside the arc round his look
|
|
115
|
+
* (the hull's own angular radius counts), the heights overlapping and no brush before it.
|
|
116
|
+
*/
|
|
117
|
+
export declare const slashed: (w: World, r: Rover, p: PlayerState, { reach, arc }: {
|
|
118
|
+
reach: number;
|
|
119
|
+
arc: number;
|
|
120
|
+
}) => boolean;
|
|
88
121
|
/**
|
|
89
122
|
* One step of 1 / TICK_HZ s, in place. `i` is the driver's input as the wire rounds it (FORWARD and
|
|
90
123
|
* BACK the throttle, JUMP the handbrake, its yaw where the nose is steered to), or undefined with
|
|
@@ -130,7 +163,7 @@ export declare const gap2: (r: Rover, p: {
|
|
|
130
163
|
}) => number;
|
|
131
164
|
/**
|
|
132
165
|
* 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
|
|
166
|
+
* within the reach in height (a ship's ENTER_H). A wreck has no seat.
|
|
134
167
|
*/
|
|
135
168
|
export declare const nearby: (r: Rover, p: {
|
|
136
169
|
x: number;
|
|
@@ -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,12 +56,6 @@ 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;
|
|
68
59
|
};
|
|
69
60
|
/** The lasers' muzzles under the wings, the missiles' pods under the wings: right of the centre, above it, ahead of it. */
|
|
70
61
|
export declare const SHIP_GUNS: number[][];
|
|
@@ -78,7 +69,7 @@ type Vec3 = [x: number, y: number, z: number];
|
|
|
78
69
|
export declare const axes: (r: Rover) => [Vec3, Vec3, Vec3];
|
|
79
70
|
/** A point of the ship, `b` m right of the centre, `u` m above it and `a` m ahead of it. */
|
|
80
71
|
export declare const point: (r: Rover, b: number, u: number, a: number) => Vec3;
|
|
81
|
-
/** The map's ships at rest on their pads: full
|
|
72
|
+
/** The map's ships at rest on their pads: whole, full of missiles, nobody aboard. */
|
|
82
73
|
export declare const dock: (ships?: readonly Spawn[]) => Rover[];
|
|
83
74
|
/**
|
|
84
75
|
* The hull as the players on foot and the rovers meet it: the stadium from the tail to the nose
|
|
@@ -93,8 +84,8 @@ export declare const limits: (r: Pick<Rover, "x" | "y" | "z">, w: World) => [up:
|
|
|
93
84
|
/**
|
|
94
85
|
* One step of 1 / TICK_HZ s, in place. `i` is the pilot's input as the wire rounds it, or
|
|
95
86
|
* undefined with nobody at the stick: the engines are off and it falls under the map's gravity to
|
|
96
|
-
* a floor
|
|
97
|
-
*
|
|
87
|
+
* a floor, a wreck as well. Returns whether it fell under the kill floor: the caller docks it
|
|
88
|
+
* again.
|
|
98
89
|
*
|
|
99
90
|
* The nose turns toward the look as fast as the rates allow and banks into the turn; the thrust
|
|
100
91
|
* is along the nose, sideways and straight up, against a drag that sets the top speed. Piloted,
|
|
@@ -104,7 +95,7 @@ export declare const limits: (r: Pick<Rover, "x" | "y" | "z">, w: World) => [up:
|
|
|
104
95
|
export declare const pilot: (r: Rover, i: Input | undefined, w: World) => boolean;
|
|
105
96
|
/**
|
|
106
97
|
* 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
|
|
98
|
+
* Infinity. The hull is the HITS spheres.
|
|
108
99
|
*/
|
|
109
100
|
export declare const struck: (r: Rover, o: Vec3, d: Vec3, m: number) => number;
|
|
110
101
|
/** The distance from `c` to the nearest point of the hull's spheres, 0 inside. */
|
|
@@ -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
|
-
/**
|
|
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
|
|
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.
|
|
5
|
+
"version": "0.129.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|