@korial29/tiny-fps 0.154.0 → 0.156.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/README.md +8 -6
- package/dist/cast-mp3-D3WiTzsl.js +1 -0
- package/dist/cast-opus-Cb4aT9hu.js +1 -0
- package/dist/index.js +29 -29
- package/dist/types/client/audio.d.ts +8 -1
- package/dist/types/client/combat.d.ts +4 -2
- package/dist/types/client/loading.d.ts +20 -0
- package/dist/types/client/taunt.d.ts +39 -0
- package/dist/types/client/voice/cast-mp3.d.ts +3 -0
- package/dist/types/client/voice/cast-opus.d.ts +3 -0
- package/dist/types/client/voice/cast.d.ts +17 -0
- package/package.json +1 -1
|
@@ -24,6 +24,11 @@ export interface Audio {
|
|
|
24
24
|
* turn, two at most and each once; none before the voice is decoded, a moment after unlock.
|
|
25
25
|
*/
|
|
26
26
|
say(id: number): void;
|
|
27
|
+
/**
|
|
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 the voices are decoded.
|
|
30
|
+
*/
|
|
31
|
+
speak(id: number, at?: Vec3, gain?: number, rate?: number): boolean;
|
|
27
32
|
/** The sound `id` (one of LOOPED) as a loop, silent until its first set; the own player's, centred. */
|
|
28
33
|
loop(id: number): Loop;
|
|
29
34
|
/** Mutes or unmutes everything, music included. */
|
|
@@ -37,7 +42,9 @@ export interface Audio {
|
|
|
37
42
|
* then MP3 where the browser cannot decode the first (older Safari).
|
|
38
43
|
*/
|
|
39
44
|
export declare const SPRITES: (() => Promise<string>)[];
|
|
40
|
-
|
|
45
|
+
/** The players' voices (voice/cast.ts), loaded the same way after the announcer's. */
|
|
46
|
+
export declare const VOICED: (() => Promise<string>)[];
|
|
47
|
+
export declare const createAudio: (layers?: Voice[][], sprites?: (() => Promise<string>)[], song?: () => Float32Array, voiced?: (() => Promise<string>)[]) => Audio;
|
|
41
48
|
/** The mute choice of the last visit. Storage throws when blocked: no memory then. */
|
|
42
49
|
export declare const savedMute: () => boolean;
|
|
43
50
|
/** Flips mute, remembers it, and returns the new state. */
|
|
@@ -46,11 +46,13 @@ export declare const swung: (a?: Blade, b?: Blade) => number;
|
|
|
46
46
|
export declare const struck: (a?: Blade, b?: Blade) => boolean;
|
|
47
47
|
/** The pitch of a player's voice: the woman's higher, and each a little off the next by his id. */
|
|
48
48
|
export declare const voiceOf: (id: number, body?: number) => number;
|
|
49
|
-
export declare const createCombat: (world: World, audio: Pick<Audio, "play"> & Partial<Pick<Audio, "loop">>, hud: Pick<Hud, "vitals" | "hit" | "down">, fx: Pick<Effects, "fire" | "cut" | "wound" | "lie" | "quake" | "blow" | "punch">, tracer: Pick<Tracer, "flash" | "burst" | "blast" | "orbs" | "update" | "mount" | "crackle" | "charging" | "lightning">, ctl: {
|
|
49
|
+
export declare const createCombat: (world: World, audio: Pick<Audio, "play"> & Partial<Pick<Audio, "loop" | "speak">>, hud: Pick<Hud, "vitals" | "hit" | "down">, fx: Pick<Effects, "fire" | "cut" | "wound" | "lie" | "quake" | "blow" | "punch">, tracer: Pick<Tracer, "flash" | "burst" | "blast" | "orbs" | "update" | "mount" | "crackle" | "charging" | "lightning">, ctl: {
|
|
50
50
|
pitch: number;
|
|
51
51
|
}, balls: Pick<Balls, "fire" | "frame">,
|
|
52
52
|
/** The muzzle of a runner's long gun as last drawn, from his feet (Renderer.muzzle()). */
|
|
53
53
|
drawn?: (id: number) => Vec3 | undefined,
|
|
54
54
|
/** The pitch of a player's voice (voiceOf()). */
|
|
55
|
-
voice?: (id: number) => number
|
|
55
|
+
voice?: (id: number) => number,
|
|
56
|
+
/** A player's own voice in the players' sprite (speakerOf()). */
|
|
57
|
+
speaker?: (id: number) => number) => Combat;
|
|
56
58
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WorldDef } from '../shared/world';
|
|
2
|
+
/**
|
|
3
|
+
* The steps of a map's loading, in order: its label, the share of the bar done at its end, and
|
|
4
|
+
* about how long it takes (ms, measured on a laptop). The last is the first frame drawn.
|
|
5
|
+
*/
|
|
6
|
+
export declare const STEPS: readonly (readonly [string, number, number])[];
|
|
7
|
+
/** The share filled at `t` (ms) by the animation `[from, to, since, ms]`. */
|
|
8
|
+
export declare const fillAt: ([from, to, since, ms]: number[], t: number) => number;
|
|
9
|
+
/** The bar's goal while step `i` runs (`i` past the last: full), and how long it takes to get there. */
|
|
10
|
+
export declare const goal: (i: number) => [number, number];
|
|
11
|
+
export interface Loader {
|
|
12
|
+
/** The screen, last in the container so that it lies over the game. */
|
|
13
|
+
el: HTMLElement;
|
|
14
|
+
/** Step `i` of STEPS has started; STEPS.length or more: everything is done, the screen fades out. */
|
|
15
|
+
step(i: number): void;
|
|
16
|
+
/** Removed at once. */
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
19
|
+
/** The loading screen over `container` while the map `def` is built: its name, a bar and the step. */
|
|
20
|
+
export declare const createLoader: (container: HTMLElement, def: WorldDef) => Loader;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Audio } from './audio';
|
|
2
|
+
import type { Vec3 } from './mesh';
|
|
3
|
+
/** Seconds from a frag to its taunt: the victim's cry first. */
|
|
4
|
+
export declare const TAUNT_DELAY = 0.6;
|
|
5
|
+
/** Seconds from an own frag to its taunt when the announcer has a line for it: after the line. */
|
|
6
|
+
export declare const TAUNT_LATE = 1.3;
|
|
7
|
+
/** Seconds a player keeps quiet after a taunt: a quick run of frags gets one. */
|
|
8
|
+
export declare const TAUNT_GAP = 4;
|
|
9
|
+
/** The voice of player `id` in a build (BODY): one of the man's or one of the woman's. */
|
|
10
|
+
export declare const speakerOf: (id: number, body?: number) => number;
|
|
11
|
+
/** A player's speed of speech, a little off the next's by his id, so that two in a voice differ. */
|
|
12
|
+
export declare const paceOf: (id: number) => number;
|
|
13
|
+
/**
|
|
14
|
+
* The clip (CAST) of what `speaker` says after his `n`th frag made `how` (FRAG): a word of his own
|
|
15
|
+
* for the fists and the katana, else one of the taunts, a new one each frag.
|
|
16
|
+
*/
|
|
17
|
+
export declare const tauntOf: (speaker: number, how: number, n: number) => number;
|
|
18
|
+
/** The clip (CAST) of `speaker`'s `k`th cry as he goes down. */
|
|
19
|
+
export declare const deathOf: (speaker: number, k: number) => number;
|
|
20
|
+
export interface Taunts {
|
|
21
|
+
/**
|
|
22
|
+
* The host's frag message `m` at `now` (s), told to the own player `me`: its author taunts
|
|
23
|
+
* `wait` s later, unless he taunted less than TAUNT_GAP s before.
|
|
24
|
+
*/
|
|
25
|
+
frag(m: {
|
|
26
|
+
by: number;
|
|
27
|
+
who: number;
|
|
28
|
+
how: number;
|
|
29
|
+
n: number;
|
|
30
|
+
}, me: number, now: number, wait?: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Says the taunts due at `now` (s): the own and the one aimed at the own player centred, the
|
|
33
|
+
* others' from where `where` draws their author (feet), unheard when it does not draw him.
|
|
34
|
+
*/
|
|
35
|
+
frame(now: number, where: (id: number) => Vec3 | undefined): void;
|
|
36
|
+
}
|
|
37
|
+
export declare const createTaunts: (audio: Pick<Audio, "speak">,
|
|
38
|
+
/** A player's build (BODY) from the roster. */
|
|
39
|
+
body: (id: number) => number | undefined) => Taunts;
|