@korial29/tiny-fps 0.156.0 → 0.157.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.
|
@@ -26,9 +26,10 @@ export interface Audio {
|
|
|
26
26
|
say(id: number): void;
|
|
27
27
|
/**
|
|
28
28
|
* Says clip `id` of the players' voices (CAST): placed and fainter with distance as play() with
|
|
29
|
-
* `at`, centred without. False, and silent, until
|
|
29
|
+
* `at`, centred without; over the `radio`, thin as through a headset. False, and silent, until
|
|
30
|
+
* the voices are decoded.
|
|
30
31
|
*/
|
|
31
|
-
speak(id: number, at?: Vec3, gain?: number, rate?: number): boolean;
|
|
32
|
+
speak(id: number, at?: Vec3, gain?: number, rate?: number, radio?: boolean): boolean;
|
|
32
33
|
/** The sound `id` (one of LOOPED) as a loop, silent until its first set; the own player's, centred. */
|
|
33
34
|
loop(id: number): Loop;
|
|
34
35
|
/** Mutes or unmutes everything, music included. */
|
|
@@ -122,6 +122,12 @@ export interface Hud {
|
|
|
122
122
|
* colour. The newest at the bottom, FEED_MAX at most, each gone after FEED_MS.
|
|
123
123
|
*/
|
|
124
124
|
feed(by: [string, number], who: [string, number]): void;
|
|
125
|
+
/**
|
|
126
|
+
* An ally on the radio: the small screen with `name` in `team`'s colour opens for `s` seconds
|
|
127
|
+
* (and COMM_TAIL more), a newer one taking its place. Returns its canvas (COMM pixels square),
|
|
128
|
+
* cleared, for his face.
|
|
129
|
+
*/
|
|
130
|
+
comm(name: string, team: number, s: number): HTMLCanvasElement;
|
|
125
131
|
/**
|
|
126
132
|
* The rover: `act` is what E does now ('drive', 'ride', 'get out'; '' hides the prompt), and
|
|
127
133
|
* `speed` the km/h shown at the wheel, where the gun and the crosshair then hide; undefined off it.
|
|
@@ -160,6 +166,9 @@ export declare const BANNER_MS = 2800;
|
|
|
160
166
|
export declare const FRAG_MS = 2400;
|
|
161
167
|
export declare const FEED_MS = 6000;
|
|
162
168
|
export declare const FEED_MAX = 5;
|
|
169
|
+
/** The radio screen's canvas, pixels a side, and the seconds it stays after its line. */
|
|
170
|
+
export declare const COMM = 192;
|
|
171
|
+
export declare const COMM_TAIL = 0.5;
|
|
163
172
|
export declare const HIT_MS = 140;
|
|
164
173
|
/** m:ss. */
|
|
165
174
|
export declare const clock: (s: number) => string;
|
|
@@ -151,7 +151,7 @@ export interface Renderer {
|
|
|
151
151
|
* `look`, framed by `shot` (PORTRAIT, or HEAD for the head alone), into the 2D canvas `into`: a frame of him alone in the map's sky, which the next
|
|
152
152
|
* frame() replaces on the screen. False when nothing could be drawn yet.
|
|
153
153
|
*/
|
|
154
|
-
portrait(into: HTMLCanvasElement, p: PlayerState, build: number, color: string, look?: Choice, shot?:
|
|
154
|
+
portrait(into: HTMLCanvasElement, p: PlayerState, build: number, color: string, look?: Choice, shot?: Shot): boolean;
|
|
155
155
|
destroy(): void;
|
|
156
156
|
}
|
|
157
157
|
/** A character card's picture: how high over the map he stands (m), the camera's height over his feet and its distance (m), its angle off his front and his own off the sun (rad), its field of view (degrees), and how far it steps to its right (m). */
|
|
@@ -174,6 +174,12 @@ export declare const HEAD: {
|
|
|
174
174
|
y: number;
|
|
175
175
|
sun: number;
|
|
176
176
|
};
|
|
177
|
+
/** A picture's framing, and whether he grins in it. */
|
|
178
|
+
export type Shot = typeof PORTRAIT & {
|
|
179
|
+
grin?: boolean;
|
|
180
|
+
};
|
|
181
|
+
/** An ally's face on the radio screen: the head nearly from the front, grinning. */
|
|
182
|
+
export declare const FACE: Shot;
|
|
177
183
|
/** Pixels drawn at most (1080p): every one is lit per light and shadow map, so a 4K screen at a pixel ratio of 2 would pay for 8 million. */
|
|
178
184
|
export declare const MAX_PIXELS: number;
|
|
179
185
|
/** The canvas size in device pixels: the CSS size times the pixel ratio (2 at most), scaled down to MAX_PIXELS. */
|
|
@@ -17,6 +17,11 @@ export declare const paceOf: (id: number) => number;
|
|
|
17
17
|
export declare const tauntOf: (speaker: number, how: number, n: number) => number;
|
|
18
18
|
/** The clip (CAST) of `speaker`'s `k`th cry as he goes down. */
|
|
19
19
|
export declare const deathOf: (speaker: number, k: number) => number;
|
|
20
|
+
/** An ally's line that began: who says it, and its seconds. */
|
|
21
|
+
export interface Said {
|
|
22
|
+
by: number;
|
|
23
|
+
s: number;
|
|
24
|
+
}
|
|
20
25
|
export interface Taunts {
|
|
21
26
|
/**
|
|
22
27
|
* The host's frag message `m` at `now` (s), told to the own player `me`: its author taunts
|
|
@@ -29,11 +34,14 @@ export interface Taunts {
|
|
|
29
34
|
n: number;
|
|
30
35
|
}, me: number, now: number, wait?: number): void;
|
|
31
36
|
/**
|
|
32
|
-
* Says the taunts due at `now` (s): the own and the one aimed at the own player centred,
|
|
33
|
-
*
|
|
37
|
+
* Says the taunts due at `now` (s): the own and the one aimed at the own player centred, an
|
|
38
|
+
* ally's over the radio wherever he is, an enemy's from where `where` draws him (feet), unheard
|
|
39
|
+
* when it does not draw him. Returns the allies' lines that began.
|
|
34
40
|
*/
|
|
35
|
-
frame(now: number, where: (id: number) => Vec3 | undefined):
|
|
41
|
+
frame(now: number, where: (id: number) => Vec3 | undefined): Said[];
|
|
36
42
|
}
|
|
37
43
|
export declare const createTaunts: (audio: Pick<Audio, "speak">,
|
|
38
44
|
/** A player's build (BODY) from the roster. */
|
|
39
|
-
body: (id: number) => number | undefined
|
|
45
|
+
body: (id: number) => number | undefined,
|
|
46
|
+
/** A player's team from the roster. */
|
|
47
|
+
team?: (id: number) => number | undefined) => Taunts;
|
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.157.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|