@korial29/tiny-fps 0.221.1 → 0.223.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/server.js CHANGED
@@ -6832,7 +6832,7 @@ var STRIKE = {
6832
6832
  * One input: the move, then the weapons. Returns what struck on this step (STRIKE), for the host to
6833
6833
  * resolve it: a shot, or a cut, which is not a shot.
6834
6834
  * - Down: the keys are dropped, and when `down` runs out the player is back at a spawn.
6835
- * - The team's rack fills the gun when the player steps into its circle (`rack` tells he is in it),
6835
+ * - Either team's rack fills the gun when the player steps into its circle (`rack` tells he is in it),
6836
6836
  * and again each time he comes back; staying gives nothing. The katana rack gives the katana,
6837
6837
  * once and for good: it stays until he goes down.
6838
6838
  * - The rail rack fills the rail gun with RAIL_MAX ticks of lightning on arrival, as the gun's does.
@@ -6884,8 +6884,8 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6884
6884
  if (locked) return duel(p, i);
6885
6885
  const fresh = !!(i.keys & KEY.FIRE) && !p.pressed;
6886
6886
  p.pressed = !!(i.keys & KEY.FIRE);
6887
- const { rack, blade, rail, rifle } = w.def.teams[team];
6888
- const inside = !!rack && within(p, rack, 1.2);
6887
+ const near = (key) => w.def.teams.some((t) => !!t[key] && within(p, t[key], 1.2));
6888
+ const inside = near("rack");
6889
6889
  const gear = kit.gear;
6890
6890
  if (!gear) [p.ammo, p.rail, p.rifle, p.blade, p.nades] = [
6891
6891
  -1,
@@ -6915,11 +6915,11 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6915
6915
  }
6916
6916
  if (armed && gear && inside && !p.rack) [p.ammo, p.mag] = [kit.ammo, kit.mag];
6917
6917
  p.rack = inside;
6918
- p.blade = !!kit.katana || !!p.blade || armed && gear && !!blade && within(p, blade, 1.2);
6919
- const inRail = !!rail && within(p, rail, 1.2);
6918
+ p.blade = !!kit.katana || !!p.blade || armed && gear && near("blade");
6919
+ const inRail = near("rail");
6920
6920
  if (armed && gear && !own && inRail && !p.inRail) [p.rail, p.cap] = [kit.rail, kit.cap];
6921
6921
  p.inRail = inRail;
6922
- const inRifle = !!rifle && within(p, rifle, 1.2);
6922
+ const inRifle = near("rifle");
6923
6923
  if (armed && gear && !own && inRifle && !p.inRifle) [p.rifle, p.clip, p.nades] = [
6924
6924
  kit.rifle,
6925
6925
  kit.clip,
@@ -8,7 +8,7 @@ export interface Loop {
8
8
  export interface Audio {
9
9
  /**
10
10
  * Starts the AudioContext on a user gesture (browsers keep it suspended until one); the first
11
- * call also renders the sound buffers and starts the music. Later calls do nothing.
11
+ * call also renders the sound buffers and starts the menus' theme. Later calls do nothing.
12
12
  */
13
13
  unlock(): void;
14
14
  /** Where the listener is and looks, each frame (yaw as a player's: 0 looks toward -z). */
@@ -28,13 +28,19 @@ export interface Audio {
28
28
  * Says clip `id` of the players' voices (CAST): placed and fainter with distance as play() with
29
29
  * `at`, centred without; over the `radio`, clipped and thin as through a cheap headset, a burst
30
30
  * of squelch before and after it and a hiss under it. False, and silent, until the voices are
31
- * decoded.
31
+ * decoded. As a Hunter's `mimic` (the Predator's: he says back what he heard), deeper, through a
32
+ * ring modulator, its first syllable stuttered twice.
32
33
  */
33
- speak(id: number, at?: Vec3, db?: number, rate?: number, radio?: boolean): boolean;
34
+ speak(id: number, at?: Vec3, db?: number, rate?: number, radio?: boolean, mimic?: boolean): boolean;
34
35
  /** The sound `id` (one of LOOPED) as a loop, silent until its first set; the own player's, centred. */
35
36
  loop(id: number): Loop;
36
37
  /** Fades the music out (true) or back in (false), the other sounds untouched: the Hunter's visions. */
37
38
  hush(on: boolean): void;
39
+ /**
40
+ * The menus' theme (true, as at first) or the map's music (false), crossfaded; the map's is
41
+ * rendered on the first false, so the first click renders one song only.
42
+ */
43
+ menu(on: boolean): void;
38
44
  /** Mutes or unmutes everything, music included. */
39
45
  mute(on: boolean): void;
40
46
  readonly muted: boolean;
@@ -56,6 +62,17 @@ export declare const LOUD: Record<number, number>;
56
62
  export declare const GROUP: string;
57
63
  /** Sets bus `i` to `db` live, and keeps the mix for the next visit; none, the mix as made. */
58
64
  export declare const mix: (i?: number, db?: number) => void;
65
+ /**
66
+ * A Hunter's mimicry: the speed (and so the pitch) of the line, the ring modulator's Hz and its
67
+ * share of the mix, and the stutter: the seconds of the line's start said before it, and how often.
68
+ */
69
+ export declare const MIMIC: {
70
+ rate: number;
71
+ ring: number;
72
+ wet: number;
73
+ stutter: number;
74
+ times: number;
75
+ };
59
76
  /**
60
77
  * The announcer's sprite (voice/clips.ts), each as base64 and loaded only when asked for: Ogg Opus,
61
78
  * then MP3 where the browser cannot decode the first (older Safari).
@@ -63,7 +80,7 @@ export declare const mix: (i?: number, db?: number) => void;
63
80
  export declare const SPRITES: (() => Promise<string>)[];
64
81
  /** The players' voices (voice/cast.ts), loaded the same way after the announcer's. */
65
82
  export declare const VOICED: (() => Promise<string>)[];
66
- export declare const createAudio: (layers?: Voice[][], sprites?: (() => Promise<string>)[], song?: () => Float32Array, voiced?: (() => Promise<string>)[]) => Audio;
83
+ export declare const createAudio: (layers?: Voice[][], sprites?: (() => Promise<string>)[], song?: () => Float32Array, voiced?: (() => Promise<string>)[], theme?: () => Float32Array) => Audio;
67
84
  /** The mute choice of the last visit. Storage throws when blocked: no memory then. */
68
85
  export declare const savedMute: () => boolean;
69
86
  /** Flips mute, remembers it, and returns the new state. */
@@ -188,6 +188,12 @@ export declare const SOUND: {
188
188
  * the stock grinding out, a ratchet over them, and a heavy lock as they reach their stops.
189
189
  */
190
190
  readonly HARPOON_OPEN: 94;
191
+ /**
192
+ * The Hunter's radio (the user, 2026-11-24: sounds and radio voices of his own): CLICKS his
193
+ * rattle, a trill of throat clicks over a low gurgle; GROWL a deep rolling roar.
194
+ */
195
+ readonly HUNTER_CLICKS: 95;
196
+ readonly HUNTER_GROWL: 96;
191
197
  };
192
198
  /**
193
199
  * The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
@@ -268,3 +274,11 @@ export declare const music: () => Float32Array;
268
274
  export declare const moon: () => Float32Array;
269
275
  /** The music of each map by its key; the others play music(). */
270
276
  export declare const SONGS: Record<string, () => Float32Array>;
277
+ /**
278
+ * The menus' theme, 8-bit: thirty-two bars in E minor at 105 bpm, a chord every bar or half bar.
279
+ * The lead on the soft triangle, then on a pulse, then wide and with an echo at the climax, then
280
+ * back on the triangle with an echo over a thinner beat; under it a sixteenth arpeggio of the
281
+ * chord, an octave bass on the triangle and noise drums. Rhythmic, never shrill: the thin pulses
282
+ * stay quiet. Mono at MUSIC_RATE, deterministic, its end joining its start.
283
+ */
284
+ export declare const anthem: () => Float32Array;
@@ -1,4 +1,4 @@
1
- import type { Audio } from './audio';
1
+ import { type Audio } from './audio';
2
2
  import type { Vec3 } from './mesh';
3
3
  /** Seconds from a frag to its taunt: the victim's cry first. */
4
4
  export declare const TAUNT_DELAY = 0.6;
@@ -15,6 +15,14 @@ export declare const paceOf: (id: number) => number;
15
15
  * for the fists and the katana, else one of the taunts, a new one each frag.
16
16
  */
17
17
  export declare const tauntOf: (speaker: number, how: number, n: number) => number;
18
+ /**
19
+ * What a Hunter says after his `n`th frag, in turn (the user, 2026-11-24: sounds and radio voices
20
+ * of his own): -1 the victim's own voice mimicked (a taunt of his, as the Predator says back what
21
+ * he heard), else a sound of his. A victim with no voice (a xenomorph, a Hunter) gets the next.
22
+ */
23
+ export declare const HUNTER_CALLS: number[];
24
+ /** The seconds a Hunter's mimicry of clip `clip` lasts at `pace` (audio.ts, speak()). */
25
+ export declare const mimicSeconds: (clip: number, pace: number) => number;
18
26
  /** A line over the radio that began: who says it, and its seconds. */
19
27
  export interface Said {
20
28
  by: number;
@@ -23,7 +23,7 @@ export type Strike = (typeof STRIKE)[keyof typeof STRIKE];
23
23
  * One input: the move, then the weapons. Returns what struck on this step (STRIKE), for the host to
24
24
  * resolve it: a shot, or a cut, which is not a shot.
25
25
  * - Down: the keys are dropped, and when `down` runs out the player is back at a spawn.
26
- * - The team's rack fills the gun when the player steps into its circle (`rack` tells he is in it),
26
+ * - Either team's rack fills the gun when the player steps into its circle (`rack` tells he is in it),
27
27
  * and again each time he comes back; staying gives nothing. The katana rack gives the katana,
28
28
  * once and for good: it stays until he goes down.
29
29
  * - The rail rack fills the rail gun with RAIL_MAX ticks of lightning on arrival, as the gun's does.
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.221.1",
5
+ "version": "0.223.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"