@modlock/modlock 0.0.0-stage → 0.1.64

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/hud.d.ts ADDED
@@ -0,0 +1,168 @@
1
+ import { type PipShape, type TextRole, type Tone } from './theme.js';
2
+ import type { Player } from './host.gen.js';
3
+ import type { Child, Style, UiElement } from './ui.js';
4
+ /** TextProps set one label in a type role and tone. */
5
+ export interface TextProps {
6
+ role: TextRole;
7
+ /** tone colors the text; a label is muted and the rest are text. */
8
+ tone?: Tone;
9
+ /**
10
+ * plated marks text on a plate or pill, which takes no shadow: on the dark
11
+ * plate a shadow only smears the glyphs.
12
+ */
13
+ plated?: boolean;
14
+ style?: Style;
15
+ children?: Child;
16
+ }
17
+ /** Text is one label in a type role, over the soft shadow unless plated. */
18
+ export declare function Text(props: TextProps): UiElement;
19
+ /** BoxProps lay out a plate's or pill's children. */
20
+ export interface BoxProps {
21
+ flow?: 'down' | 'right';
22
+ style?: Style;
23
+ children?: Child;
24
+ }
25
+ /** Plate is the dark plate under HUD text, readable over a bright sky. */
26
+ export declare function Plate(props: BoxProps): UiElement;
27
+ /**
28
+ * Pill is the plate rounded into a capsule with a faint
29
+ * parchment edge, flowing right: the counter under a top strip's heading.
30
+ */
31
+ export declare function Pill(props: BoxProps): UiElement;
32
+ /** PipsProps show a count out of a fixed total. */
33
+ export interface PipsProps {
34
+ filled: number;
35
+ total: number;
36
+ tone: Tone;
37
+ /** shape is a round point, as the stock round counter, or a narrow tick. */
38
+ shape?: PipShape;
39
+ /** mirror fills from the right, for the far side of a counter. */
40
+ mirror?: boolean;
41
+ style?: Style;
42
+ }
43
+ /** Pips shows a count as filled and empty pips, as the stock round counter. */
44
+ export declare function Pips(props: PipsProps): UiElement;
45
+ /** TagProps name a status or a result in small capitals. */
46
+ export interface TagProps {
47
+ tone: Tone;
48
+ /** fill outlines a status read in a list, or fills a result. */
49
+ fill?: 'outline' | 'filled';
50
+ style?: Style;
51
+ children?: Child;
52
+ }
53
+ /** Tag is small heading capitals in a 1px border of its tone. */
54
+ export declare function Tag(props: TagProps): UiElement;
55
+ /** BannerProps announce a moment: a title and a detail under it. */
56
+ export interface BannerProps {
57
+ title: string;
58
+ detail?: string;
59
+ tone?: Tone;
60
+ style?: Style;
61
+ }
62
+ /**
63
+ * Banner is a centered title in the heading face with a muted detail. It
64
+ * grows in as it appears and fades as it goes.
65
+ */
66
+ export declare function Banner(props: BannerProps): UiElement;
67
+ /** TopStripProps fill the top block of an arena HUD. */
68
+ export interface TopStripProps {
69
+ /** heading names the mode or round and the lane, over the counter. */
70
+ heading?: string;
71
+ /** line is a short line under the counter, such as a clock or the news. */
72
+ line?: string;
73
+ lineTone?: Tone;
74
+ /**
75
+ * keepTeamBar seats the strip under the stock team bar, which keeps its
76
+ * clock, heroes and player slots; unset, it takes the bar's place.
77
+ */
78
+ keepTeamBar?: boolean;
79
+ /** children are the counter's content, such as Score and Pips. */
80
+ children?: Child;
81
+ }
82
+ /**
83
+ * TopStrip is the top block of an arena HUD: a heading in spaced capitals, the
84
+ * counter pill, and a line under it. Under the kept team bar, the heading and
85
+ * pill fit above the stock objective bar and the line goes below that bar.
86
+ */
87
+ export declare function TopStrip(props: TopStripProps): UiElement;
88
+ /** ScoreProps are each side's points, the near side first. */
89
+ export interface ScoreProps {
90
+ points: readonly [number, number];
91
+ /** tones color each side; unset, the near side is the accent. */
92
+ tones?: readonly [Tone, Tone];
93
+ }
94
+ /**
95
+ * Score is a counter's points, each side in its tone, in the title face. It
96
+ * sits in a pill, so its text is plated.
97
+ */
98
+ export declare function Score(props: ScoreProps): UiElement;
99
+ /** RosterRow is one player as the roster shows them. */
100
+ export interface RosterRow {
101
+ name: string;
102
+ /** self marks the viewing player's own row. */
103
+ self?: boolean;
104
+ /** hero is the player's hero as Pawn.hero gives it, or 0 without one. */
105
+ hero: number;
106
+ /** activity is the line under the name, such as "Free roam". */
107
+ activity: string;
108
+ /** steamId badges the portrait's corner with the player's Steam avatar. */
109
+ steamId?: bigint;
110
+ /**
111
+ * onPress makes the row a button the viewer presses while they have a
112
+ * cursor, such as to open a card about that player.
113
+ */
114
+ onPress?: (player: Player) => void;
115
+ /** selected edges the portrait in the accent, as for the row a card shows. */
116
+ selected?: boolean;
117
+ }
118
+ /** rosterRows is the most players the roster shows, above the minimap. */
119
+ export declare const rosterRows = 6;
120
+ /** rosterKey is what the roster shows, to redraw only when it changes. */
121
+ export declare function rosterKey(rows: readonly RosterRow[]): string;
122
+ /** RosterProps list the players and where the roster starts. */
123
+ export interface RosterProps {
124
+ rows: readonly RosterRow[];
125
+ /** top is the roster's top margin, under the FPS readout unless set. */
126
+ top?: number;
127
+ }
128
+ /**
129
+ * Roster stacks up to rosterRows players down the top right corner, each
130
+ * one's hero portrait at the edge with their name and a line, such as what
131
+ * they are doing or their score, to its left. It shows nothing without rows.
132
+ * A mode that hides the stock scoreboard's heroes shows who else is here with
133
+ * it.
134
+ */
135
+ export declare function Roster(props: RosterProps): UiElement | null;
136
+ /** ActionProps make a button in the game's menu look. */
137
+ export interface ActionProps {
138
+ /**
139
+ * kind is 'primary' for the one action a screen leads with, 'secondary' for
140
+ * the rest, and 'quiet' for an action that should not draw the eye.
141
+ */
142
+ kind?: 'primary' | 'secondary' | 'quiet';
143
+ /** disabled dims the action and takes no presses. */
144
+ disabled?: boolean;
145
+ onPress?: (player: Player) => void;
146
+ style?: Style;
147
+ children?: Child;
148
+ }
149
+ /**
150
+ * Action is a button in the game's menu look: capitals on a fill that lights
151
+ * as the pointer enters, with the main menu's hover and press sounds.
152
+ */
153
+ export declare function Action(props: ActionProps): UiElement;
154
+ /** MeterProps show how full something is. */
155
+ export interface MeterProps {
156
+ /** value is how full the meter is, from 0 to 1. */
157
+ value: number;
158
+ tone?: Tone;
159
+ /** width and height size the meter, in pixels; 160 by 8 unless set. */
160
+ width?: number;
161
+ height?: number;
162
+ style?: Style;
163
+ }
164
+ /**
165
+ * Meter is a bar that fills from the left toward its value, easing to each new
166
+ * value: a charge, a capture or a timer.
167
+ */
168
+ export declare function Meter(props: MeterProps): UiElement;
package/index.d.ts ADDED
@@ -0,0 +1,121 @@
1
+ /// <reference path="./globals.d.ts" />
2
+ import { type DamageEvent, type ChatEvent, type DamagedEvent, type DamageResult, type FrameEvent, type ImpactEvent, type LandedEvent, type LaunchEvent, Player } from './host.gen.js';
3
+ export * as vector from './vector.js';
4
+ export { Buttons, Layers } from './bits.js';
5
+ export { after, every, sequence, type Timer } from './timer.js';
6
+ export { type CameraMove, type CameraPlayOptions, cameraPulse, type CameraPulseOptions, cameraShake, type CameraShakeOptions, playCamera, setOrbitCamera, } from './camera.js';
7
+ export * as curve from './curve.js';
8
+ export * as format from './format.js';
9
+ export { findHero, findTitled, type Hero, heroes, type Titled, } from './heroes.js';
10
+ export { Hook, type HookAbility, hookAbility, type HookPlayer, type HookRead, hookUpgrades, type ReadHandle, } from './hook.js';
11
+ 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';
12
+ export * as theme from './theme.js';
13
+ export type { Face, PipShape, TextRole, Tone } from './theme.js';
14
+ export * from './host.gen.js';
15
+ export { Cast, type CastOptions, type Want } from './cast.js';
16
+ export { frameClock } from './frameclock.js';
17
+ export { ground, type GroundOptions } from './ground.js';
18
+ export { players } from './players.js';
19
+ export { type Check, ProbeRun } from './probe.js';
20
+ export { poseAt, type Pose, Puppet, type PuppetOptions, type PuppetState, ghostStates, ticksPerSecond, type Track, trackTicks, } from './puppet.js';
21
+ export { type HeroSnapshot, restoreHero } from './restore.js';
22
+ export { type ReplayedHit, replayDamage } from './replayed-damage.js';
23
+ export { type CatalogEntry, Dropper, dropperButtons } from './dropper.js';
24
+ export { decodeSpot, encodeSpot, LoadedSpot, loadSpot, type Placed, type Spot, type SpotObject, triggers, } from './spot.js';
25
+ export { type ButtonProps, type Child, type Component, type Edges, type ElementProps, Fragment, type Gradient, type HeroLookName, type HeroProps, hide, hideHud, type HudPart, type ImageProps, type JSX, jsx, jsxs, type LabelProps, type LayoutProps, type Length, type Overflow, type PanelProps, route, type Scaling, type Shadow, sheet, show, type Style, toast, type Transition, type UiElement, } from './ui.js';
26
+ /** LogPart is a value log writes as text. */
27
+ export type LogPart = string | number | bigint | boolean | null | undefined;
28
+ /**
29
+ * log writes one line to the server log under the mod's name: its parts as
30
+ * text, separated by spaces.
31
+ */
32
+ export declare function log(...parts: LogPart[]): void;
33
+ /**
34
+ * Service answers the host's calls to one service the mod serves: the
35
+ * method's name and payload in, the answer out. A thrown error becomes the
36
+ * call's error.
37
+ */
38
+ export type Service = (method: string, payload: Uint8Array) => Uint8Array;
39
+ /** serve answers the host's calls to service with handler, replacing its earlier handler. */
40
+ export declare function serve(service: string, handler: Service): void;
41
+ /**
42
+ * command calls handler when a player types /name in chat or their client
43
+ * sends the console command name to the server. The handler runs with the
44
+ * next server frame, before the frame handlers, and receives the text after
45
+ * the name, trimmed of surrounding spaces. Registering a name again replaces
46
+ * its handler.
47
+ */
48
+ export declare function command(name: string, handler: (player: Player, args: string) => void): void;
49
+ /**
50
+ * onStart calls handler once when the server starts the mod, with the
51
+ * arguments that follow -- on the modlock-host command line. The mod starts
52
+ * before any world loads, so find the map's entities in onWorld.
53
+ */
54
+ export declare function onStart(handler: (args: readonly string[]) => void): void;
55
+ /**
56
+ * onChat calls handler with each chat line a player writes, commands
57
+ * included, on the next server frame.
58
+ */
59
+ export declare function onChat(handler: (line: ChatEvent) => void): void;
60
+ /** onFrame calls handler once per server frame. */
61
+ export declare function onFrame(handler: (frame: FrameEvent) => void): void;
62
+ /**
63
+ * onWorld calls handler with the map's name each time a world loads, and at
64
+ * start when one already has. Objects and bots from an earlier world are
65
+ * gone by then.
66
+ */
67
+ export declare function onWorld(handler: (map: string) => void): void;
68
+ /**
69
+ * onInput calls handler with the watched buttons a player pressed and
70
+ * released, as Buttons bits, before the next frame. A button is held from its
71
+ * press until its release.
72
+ */
73
+ export declare function onInput(handler: (player: Player, pressed: bigint, released: bigint) => void): void;
74
+ /**
75
+ * onRestored calls handler when a player's Player.restoreHero ends: error is
76
+ * undefined once the target held for a second, or says why it did not.
77
+ */
78
+ export declare function onRestored(handler: (player: Player, error: string | undefined) => void): void;
79
+ /**
80
+ * onNpcsRestored calls handler when restoreNpcs ends: error is undefined once
81
+ * the map holds every target, or says why it does not.
82
+ */
83
+ export declare function onNpcsRestored(handler: (error: string | undefined) => void): void;
84
+ /**
85
+ * onDamage calls handler before each hit lands, so it can block the hit or
86
+ * change its damage. Later handlers see the earlier ones' amount.
87
+ */
88
+ export declare function onDamage(handler: (hit: DamageEvent) => DamageResult | void): void;
89
+ /** onDamaged calls handler on the frame after each hit lands. */
90
+ export declare function onDamaged(handler: (hit: DamagedEvent) => void): void;
91
+ /**
92
+ * onLaunch calls handler with each watched projectile's first frame, before
93
+ * the next frame. watchProjectiles names the projectiles.
94
+ */
95
+ export declare function onLaunch(handler: (projectile: LaunchEvent) => void): void;
96
+ /**
97
+ * onImpact calls handler when a watched projectile strikes something, inside
98
+ * the game's impact: its calls apply before the game continues.
99
+ */
100
+ export declare function onImpact(handler: (impact: ImpactEvent) => void): void;
101
+ /**
102
+ * onLanded calls handler when a hero lands under the manifest's QuakeWorld
103
+ * movement, before the next frame.
104
+ */
105
+ export declare function onLanded(handler: (landing: LandedEvent) => void): void;
106
+ /**
107
+ * onSettingChanged calls handler when a player's setting changes outside the
108
+ * mod, such as on the player's profile. The mod's own player.setSetting calls
109
+ * do not reach it.
110
+ */
111
+ export declare function onSettingChanged(handler: (player: Player, key: string, value: string) => void): void;
112
+ /**
113
+ * settingOn returns the player's value of a switch setting the manifest
114
+ * declares, or undefined when the host refuses the read.
115
+ */
116
+ export declare function settingOn(player: Player, key: string): boolean | undefined;
117
+ /**
118
+ * settingNumber returns the player's value of a number setting the manifest
119
+ * declares, or undefined when the host refuses the read.
120
+ */
121
+ export declare function settingNumber(player: Player, key: string): number | undefined;