@modlock/modlock 0.1.94 → 0.1.95

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/chat.d.ts CHANGED
@@ -4,13 +4,36 @@ import type { Child } from './ui.js';
4
4
  export interface ChatLinesOptions {
5
5
  /** seconds is how long a line stays up; 6 unless set. */
6
6
  readonly seconds?: number;
7
- /** top is the lines' top margin, as Roster's, to clear the mod's own HUD. */
8
- readonly top?: number;
7
+ /** lines is the most lines shown at once, newest kept; 4 unless set. */
8
+ readonly lines?: number;
9
+ /**
10
+ * bottom is the lane's distance from the bottom of the screen, in pixels on
11
+ * a 1080 screen; unless set, it sits just above the ability bar.
12
+ */
13
+ readonly bottom?: number;
14
+ /**
15
+ * speaker says how viewer sees a line's speaker, for a mode whose sides are
16
+ * not the game's teams or that keeps a hero secret. Unset fields, and an
17
+ * unset speaker, keep the defaults: the speaker's hero, and their name in
18
+ * their game team's color.
19
+ */
20
+ readonly speaker?: (speaker: Player, viewer: Player) => ChatSpeaker;
21
+ }
22
+ /** ChatSpeaker is how one viewer sees a line's speaker. */
23
+ export interface ChatSpeaker {
24
+ /** color is the name's color, as a style's; a light color reads best. */
25
+ readonly color?: string;
26
+ /** hero is the portrait's hero, 0 for an empty square. */
27
+ readonly hero?: number;
28
+ /** note follows the name in brackets, such as 'found'. */
29
+ readonly note?: string;
30
+ /** out greys the portrait and the name, as for a player knocked out. */
31
+ readonly out?: boolean;
9
32
  }
10
33
  /**
11
- * showChatLines shows each player's chat lines beside their hero portrait at
12
- * the top right, for every player, for as long as the mod runs. Call it when
13
- * the mod loads, as with onChat, so the server sends the mod its chat.
34
+ * showChatLines shows chat lines as subtitles above the ability bar, for
35
+ * every player, for as long as the mod runs. Call it when the mod loads, as
36
+ * with onChat, so the server sends the mod its chat.
14
37
  */
15
38
  export declare function showChatLines(options?: ChatLinesOptions): void;
16
39
  /** chatShown reports whether the mod shows chat lines. */
@@ -24,5 +47,5 @@ export declare function hearChat(line: ChatEvent, now: number): boolean;
24
47
  export declare function expireChat(now: number): boolean;
25
48
  /** forgetChat drops the line of the player who left slot, reporting whether one went. */
26
49
  export declare function forgetChat(slot: number): boolean;
27
- /** chatLines draws the fresh lines viewer may read, newest at the top. */
50
+ /** chatLines draws the fresh lines viewer may read, newest at the bottom. */
28
51
  export declare function chatLines(viewer: Player): Child;
package/hud.d.ts CHANGED
@@ -100,15 +100,36 @@ export interface ScoreProps {
100
100
  export declare function Score(props: ScoreProps): UiElement;
101
101
  /** RosterRow is one player as the roster shows them. */
102
102
  export interface RosterRow {
103
+ /**
104
+ * key names the player across draws, such as their slot, so their row
105
+ * keeps its panels as others join, leave or change places; the row's index
106
+ * in its group otherwise.
107
+ */
108
+ key?: string | number;
103
109
  name: string;
104
110
  /** self marks the viewing player's own row. */
105
111
  self?: boolean;
106
- /** hero is the player's hero as Pawn.hero gives it, or 0 without one. */
112
+ /**
113
+ * hero is the player's hero as Pawn.hero gives it, or 0 to show none, as
114
+ * for a player without one or whose hero this viewer may not know.
115
+ */
107
116
  hero: number;
108
- /** activity is the line under the name, such as "Free roam". */
109
- activity: string;
110
- /** steamId badges the portrait's corner with the player's Steam avatar. */
117
+ /**
118
+ * activity is the line under the name, such as "Free roam". It shows only
119
+ * while the roster has room for it, so a row's state must not depend on it
120
+ * alone; out does that.
121
+ */
122
+ activity?: string;
123
+ /**
124
+ * steamId is the player's Steam account. Its avatar badges the corner of
125
+ * the hero's portrait, or fills the square when no hero shows.
126
+ */
111
127
  steamId?: bigint;
128
+ /**
129
+ * out marks a player who is out of play, such as eliminated or
130
+ * spectating: the row dims and its picture loses its color.
131
+ */
132
+ out?: boolean;
112
133
  /**
113
134
  * onPress makes the row a button the viewer presses while they have a
114
135
  * cursor, such as to open a card about that player.
@@ -117,22 +138,49 @@ export interface RosterRow {
117
138
  /** selected edges the portrait in the accent, as for the row a card shows. */
118
139
  selected?: boolean;
119
140
  }
120
- /** rosterRows is the most players the roster shows, above the minimap. */
121
- export declare const rosterRows = 6;
141
+ /** RosterGroup is one category of players under a heading, such as a team. */
142
+ export interface RosterGroup {
143
+ /** key names the group across draws, so it keeps its panels. */
144
+ key: string;
145
+ /** title heads the group, such as "Seekers"; without one the rows stand alone. */
146
+ title?: string;
147
+ /** tone colors the title, such as the team's color; muted by default. */
148
+ tone?: Tone;
149
+ /** note follows the title in muted text, such as a count. */
150
+ note?: string;
151
+ rows: readonly RosterRow[];
152
+ }
122
153
  /** rosterKey is what the roster shows, to redraw only when it changes. */
123
- export declare function rosterKey(rows: readonly RosterRow[]): string;
124
- /** RosterProps list the players and where the roster starts. */
154
+ export declare function rosterKey(groups: readonly RosterGroup[]): string;
155
+ /** RosterProps list the players and the band of the screen the roster fits in. */
125
156
  export interface RosterProps {
126
- rows: readonly RosterRow[];
157
+ /** rows are one group of players without a heading. */
158
+ rows?: readonly RosterRow[];
159
+ /** groups are categories of players, each under its heading, in order. */
160
+ groups?: readonly RosterGroup[];
127
161
  /** top is the roster's top margin, under the FPS readout unless set. */
128
162
  top?: number;
163
+ /**
164
+ * bottom is how far down the screen the roster must end, in pixels on a
165
+ * 1080 high HUD: above the minimap unless set. A mode with its own panel
166
+ * on the right passes that panel's top.
167
+ */
168
+ bottom?: number;
129
169
  }
130
170
  /**
131
- * Roster stacks up to rosterRows players down the top right corner, each
132
- * one's hero portrait at the edge with their name and a line, such as what
133
- * they are doing or their score, to its left. It shows nothing without rows.
134
- * A mode that hides the stock scoreboard's heroes shows who else is here with
135
- * it.
171
+ * rosterBottom is how far down the screen the roster of props ends, so a
172
+ * panel can sit under it; it is top when the roster draws nothing.
173
+ */
174
+ export declare function rosterBottom(props: RosterProps): number;
175
+ /**
176
+ * Roster lists the players down the right side of the screen, under the FPS
177
+ * readout and above the minimap, so a mode that hides the stock top bar still
178
+ * shows who is here. Each row is the player's hero portrait at the edge with
179
+ * their name and a line, such as what they are doing, to its left. Groups put
180
+ * the players under headings, such as one per team. Rows shrink as players
181
+ * join, then run in columns, so every player fits between top and bottom; if
182
+ * they still cannot, each group shows as many as fit and a count of the rest.
183
+ * It shows nothing without rows.
136
184
  */
137
185
  export declare function Roster(props: RosterProps): UiElement | null;
138
186
  /** ActionProps make a button in the game's menu look. */
package/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export * as format from './format.js';
11
11
  export { findHero, findTitled, type Hero, heroes, heroNamed, type Titled, } from './heroes.js';
12
12
  export { item, type Item, itemId, items, type Slot } from './items.js';
13
13
  export { Hook, type HookAbility, hookAbility, type HookPlayer, type HookRead, hookUpgrades, type ReadHandle, } from './hook.js';
14
- export { Banner, type BannerProps, type BoxProps, Pill, Pips, type PipsProps, Plate, Roster, type RosterProps, type RosterRow, rosterKey, rosterRows, Score, type ScoreProps, Tag, type TagProps, Text, type TextProps, TopStrip, type TopStripProps, Action, type ActionProps, Meter, type MeterProps, } from './hud.js';
14
+ export { Banner, type BannerProps, type BoxProps, Pill, Pips, type PipsProps, Plate, Roster, type RosterGroup, type RosterProps, type RosterRow, rosterBottom, rosterKey, Score, type ScoreProps, Tag, type TagProps, Text, type TextProps, TopStrip, type TopStripProps, Action, type ActionProps, Meter, type MeterProps, } from './hud.js';
15
15
  export * as theme from './theme.js';
16
16
  export type { Face, PipShape, TextRole, Tone } from './theme.js';
17
17
  export * from './host.gen.js';
@@ -24,7 +24,7 @@ export { afterMatch, fewestPlayed, leaderboard, leastUsed, nextMatch, ratingChan
24
24
  export { bystanderStates, holdBystander, parkedStates, parkHeight, spectateFrom, } from './bystander.js';
25
25
  export { Strays, strayGraceSeconds } from './strays.js';
26
26
  export { Stragglers, stragglerConnectSeconds, type StragglersOptions, } from './stragglers.js';
27
- export { type ChatLinesOptions, showChatLines } from './chat.js';
27
+ export { type ChatLinesOptions, type ChatSpeaker, showChatLines, } from './chat.js';
28
28
  export { type Check, ProbeRun } from './probe.js';
29
29
  export { poseAt, type Pose, Puppet, type PuppetOptions, type PuppetState, ghostStates, ticksPerSecond, type Track, trackTicks, } from './puppet.js';
30
30
  export { type HeroSnapshot, restoreHero } from './restore.js';