@korial29/tiny-fps 0.219.0 → 0.220.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.
@@ -17,6 +17,8 @@ export declare const HEAD_PX = 112;
17
17
  /** The haircuts of each body, in HAIRS_N's order: the man's by length (LENGTHS, soldier.ts), the woman's STYLE (hair.ts). */
18
18
  export declare const HAIR_NAMES: string[][];
19
19
  export declare const ROLES: [name: string, pros: string, cons: string, where: string][];
20
+ /** A skin tone (TONES, linear) as a CSS colour. */
21
+ export declare const swatch: (t: number[]) => string;
20
22
  /** Capture the flag in a few lines, with the room's default rules. */
21
23
  export declare const GOAL: string[];
22
24
  /**
@@ -51,9 +53,10 @@ export interface Hud {
51
53
  title(status: string, name: string, tag?: string, lore?: string): void;
52
54
  /**
53
55
  * Whether the player has been in the game: then the title screen opens on the pause menu (PAUSE)
54
- * rather than the whole panel, until he plays again.
56
+ * rather than the whole panel, until he plays again. `fresh`: he has not played yet (he comes from
57
+ * the character screen), its first button reads Play.
55
58
  */
56
- paused(on: boolean): void;
59
+ paused(on: boolean, fresh?: boolean): void;
57
60
  /**
58
61
  * The character on the title screen: `pick` is told the whole choice (the body, the skin, the
59
62
  * haircut, the class) each time the player changes a part of it. Returns the canvas of his live
@@ -13,9 +13,17 @@ export interface TinyFpsOptions {
13
13
  map?: string;
14
14
  /** The character to play (BODY): the man (0, the default) or the woman (1). The look only. */
15
15
  body?: number;
16
+ /**
17
+ * Opens on the character screen (lobby.ts): the room is joined and the map loads only once its
18
+ * Start is pressed, with the character picked there. Without it, the room is joined at once.
19
+ */
20
+ cast?: boolean;
16
21
  }
17
- /** quit: the player left from the pause menu (Escape, then Quit); the page decides where he goes. */
18
- export type TinyFpsEvent = 'roster' | 'open' | 'close' | 'quit';
22
+ /**
23
+ * quit: the player left from the pause menu (Escape, then Quit); the page decides where he goes.
24
+ * start: the character screen's Start (TinyFpsOptions.cast), the map loading from then on.
25
+ */
26
+ export type TinyFpsEvent = 'roster' | 'open' | 'close' | 'quit' | 'start';
19
27
  export interface TinyFps {
20
28
  on(ev: TinyFpsEvent, cb: () => void): void;
21
29
  /** Everyone in the room, the own player included. */
@@ -0,0 +1,21 @@
1
+ import type { Choice } from '../shared/types';
2
+ import type { WorldDef } from '../shared/world';
3
+ /** A whole choice: the body, the skin, the haircut and the class. */
4
+ export type Cast = Choice & {
5
+ body: number;
6
+ };
7
+ /** Each class in ROLE's order: its name, a few words for its tile, and plain lists of what it is good and bad at. */
8
+ export declare const TRAITS: {
9
+ name: string;
10
+ tag: string;
11
+ pros: string[];
12
+ cons: string[];
13
+ }[];
14
+ export interface Lobby {
15
+ destroy(): void;
16
+ }
17
+ /**
18
+ * Shows the character screen in `container` for the map `def` (the classes it offers, its sky);
19
+ * `start` hears the whole choice on Start, after the screen is gone.
20
+ */
21
+ export declare const createLobby: (container: HTMLElement, def: WorldDef, start: (c: Cast) => void) => Lobby;
@@ -220,6 +220,10 @@ export declare const HEAD: {
220
220
  /** A picture's framing, and whether he grins in it. */
221
221
  export type Shot = typeof PORTRAIT & {
222
222
  grin?: boolean;
223
+ /** What he holds, over the empty hands of a picture (the character screen's weapon). */
224
+ hold?: Partial<PlayerState>;
225
+ /** Radians he is turned from his usual pose, towards his left: a weapon held ahead then shows across the picture. */
226
+ spin?: number;
223
227
  };
224
228
  /** An ally's face on the radio screen: the head nearly from the front, grinning. */
225
229
  export declare const FACE: Shot;
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.219.0",
5
+ "version": "0.220.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"