@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/LICENSE +23 -0
- package/README.md +10 -2
- package/bin/modlock.js +32 -0
- package/bits.d.ts +52 -0
- package/camera.d.ts +101 -0
- package/cast.d.ts +73 -0
- package/console.d.ts +8920 -0
- package/console.js +40 -0
- package/curve.d.ts +149 -0
- package/dropper.d.ts +69 -0
- package/entities.d.ts +15638 -0
- package/entities.js +16178 -0
- package/format.d.ts +29 -0
- package/frameclock.d.ts +34 -0
- package/globals.d.ts +69 -0
- package/ground.d.ts +16 -0
- package/heroes.d.ts +21 -0
- package/hook.d.ts +55 -0
- package/host.d.ts +19 -0
- package/host.gen.d.ts +1927 -0
- package/hud.d.ts +168 -0
- package/index.d.ts +121 -0
- package/index.js +16396 -0
- package/jsx-runtime.d.ts +1 -0
- package/jsx-runtime.js +1 -0
- package/package.json +22 -4
- package/players.d.ts +13 -0
- package/probe.d.ts +31 -0
- package/puppet.d.ts +143 -0
- package/quickjs.d.ts +1 -0
- package/replayed-damage.d.ts +27 -0
- package/restore.d.ts +43 -0
- package/scriptc.d.ts +8 -0
- package/spot.d.ts +82 -0
- package/theme.d.ts +137 -0
- package/timer.d.ts +22 -0
- package/ui.d.ts +428 -0
- package/vector.d.ts +31 -0
package/jsx-runtime.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fragment, JSX, jsx, jsxs } from './index.js'
|
package/jsx-runtime.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fragment, jsx, jsxs } from './index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
+
"bin": {
|
|
3
|
+
"modlock": "bin/modlock.js"
|
|
4
|
+
},
|
|
5
|
+
"description": "Build, test and publish mods for Deadlock.",
|
|
6
|
+
"homepage": "https://github.com/paralin/modlock#readme",
|
|
7
|
+
"license": "MIT",
|
|
2
8
|
"name": "@modlock/modlock",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
"optionalDependencies": {
|
|
10
|
+
"@modlock/darwin-arm64": "0.1.64",
|
|
11
|
+
"@modlock/darwin-x64": "0.1.64",
|
|
12
|
+
"@modlock/linux-arm64": "0.1.64",
|
|
13
|
+
"@modlock/linux-x64": "0.1.64",
|
|
14
|
+
"@modlock/win32-x64": "0.1.64"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/paralin/modlock.git"
|
|
19
|
+
},
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
22
|
+
"types": "index.d.ts",
|
|
23
|
+
"version": "0.1.64"
|
|
24
|
+
}
|
package/players.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Connection } from './host.gen.js';
|
|
2
|
+
/** keepPlayers keeps the player list the host reported and tells the watchers. */
|
|
3
|
+
export declare function keepPlayers(players: Connection[]): void;
|
|
4
|
+
/**
|
|
5
|
+
* watchPlayers calls watcher with each player list the host reports, and at
|
|
6
|
+
* once with the last one when a report already arrived.
|
|
7
|
+
*/
|
|
8
|
+
export declare function watchPlayers(watcher: (players: readonly Connection[]) => void): void;
|
|
9
|
+
/**
|
|
10
|
+
* players lists the occupied player slots in slot order. It answers from the
|
|
11
|
+
* roster the host last reported, and asks the host until a report arrives.
|
|
12
|
+
*/
|
|
13
|
+
export declare function players(): Connection[];
|
package/probe.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check returns true when a probe passes, a failure message when it fails, or
|
|
3
|
+
* false to check again next frame.
|
|
4
|
+
*/
|
|
5
|
+
export type Check = () => boolean | string;
|
|
6
|
+
/**
|
|
7
|
+
* ProbeRun drives one probe to a verdict. It times the run from its first
|
|
8
|
+
* frame, logs each step the probe waits on once, fails a run that outlasts its
|
|
9
|
+
* timeout, and reports PASS or FAIL before quitting the server. A frame costs
|
|
10
|
+
* the check alone; the run makes host calls only when the step changes and at
|
|
11
|
+
* the verdict.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ProbeRun {
|
|
14
|
+
private readonly name;
|
|
15
|
+
private readonly timeout;
|
|
16
|
+
private started?;
|
|
17
|
+
private finished;
|
|
18
|
+
private logged?;
|
|
19
|
+
/**
|
|
20
|
+
* @param name is the name the verdict line reports, such as the mod's.
|
|
21
|
+
* @param timeout bounds the run in seconds.
|
|
22
|
+
*/
|
|
23
|
+
constructor(name: string, timeout: number);
|
|
24
|
+
/** elapsed returns the seconds since the run's first frame, starting it at now. */
|
|
25
|
+
elapsed(now: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* tick runs check for the frame at now until the run ends. step names what
|
|
28
|
+
* the probe waits on, and describe adds the probe's state to a timeout.
|
|
29
|
+
*/
|
|
30
|
+
tick(now: number, step: string, check: Check, describe?: () => string): void;
|
|
31
|
+
}
|
package/puppet.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { type Angles, type BotOptions, Player, type Vector } from './host.gen.js';
|
|
2
|
+
/** ticksPerSecond is the game's tick rate; a track's steps count ticks. */
|
|
3
|
+
export declare const ticksPerSecond = 64;
|
|
4
|
+
/**
|
|
5
|
+
* Track is a recorded hero path in columns: sample i was taken at tick
|
|
6
|
+
* i * stepTicks. The columns of x, y, z and yaw are as long as the track.
|
|
7
|
+
*/
|
|
8
|
+
export interface Track {
|
|
9
|
+
/** stepTicks is the ticks between two samples. */
|
|
10
|
+
stepTicks: number;
|
|
11
|
+
/** x, y and z are the hero's origin, at its feet. */
|
|
12
|
+
x: number[];
|
|
13
|
+
y: number[];
|
|
14
|
+
z: number[];
|
|
15
|
+
/** yaw is where the hero faces, in degrees. */
|
|
16
|
+
yaw: number[];
|
|
17
|
+
/** pitch is where the hero looks up or down, in degrees; level when absent. */
|
|
18
|
+
pitch?: number[];
|
|
19
|
+
/** health is the hero's health; the hero's own is kept when absent. */
|
|
20
|
+
health?: number[];
|
|
21
|
+
}
|
|
22
|
+
/** Pose is a track read at one tick. */
|
|
23
|
+
export interface Pose {
|
|
24
|
+
position: Vector;
|
|
25
|
+
facing: Angles;
|
|
26
|
+
/** velocity is the motion between the two samples the pose lies in. */
|
|
27
|
+
velocity: Vector;
|
|
28
|
+
/** health is absent when the track records none. */
|
|
29
|
+
health?: number;
|
|
30
|
+
}
|
|
31
|
+
/** trackTicks is the tick of the track's last sample. */
|
|
32
|
+
export declare function trackTicks(track: Track): number;
|
|
33
|
+
/**
|
|
34
|
+
* poseAt reads track at tick, blending the two samples around it: positions
|
|
35
|
+
* and health linearly, angles along the shorter arc. A tick past either end
|
|
36
|
+
* reads that end. It returns undefined for a track without samples.
|
|
37
|
+
*/
|
|
38
|
+
export declare function poseAt(track: Track, tick: number): Pose | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* PuppetState is where playback stands: paused holds the hero at the tick,
|
|
41
|
+
* playing advances it with the game clock, and ended is a play that reached
|
|
42
|
+
* the track's last tick, which seek or play from a lower tick restarts.
|
|
43
|
+
*/
|
|
44
|
+
export type PuppetState = 'paused' | 'playing' | 'ended';
|
|
45
|
+
/** PuppetOptions tunes a puppet. */
|
|
46
|
+
export interface PuppetOptions {
|
|
47
|
+
/**
|
|
48
|
+
* snapUnits is the distance, in world units, beyond which the hero
|
|
49
|
+
* teleports to the pose instead of gliding to it: after a seek, or across a
|
|
50
|
+
* gap in the recording. The default is 200.
|
|
51
|
+
*/
|
|
52
|
+
snapUnits?: number;
|
|
53
|
+
/** ghost starts the puppet as a ghost. */
|
|
54
|
+
ghost?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* ghostStates are the modifier states of a ghost: it takes no damage, enemies
|
|
58
|
+
* and units neither target nor count it, and its unit status stays hidden.
|
|
59
|
+
*/
|
|
60
|
+
export declare const ghostStates: string[];
|
|
61
|
+
/**
|
|
62
|
+
* advancePuppets moves every playing puppet to the game clock at seconds.
|
|
63
|
+
* The library calls it once per frame.
|
|
64
|
+
*/
|
|
65
|
+
export declare function advancePuppets(seconds: number): void;
|
|
66
|
+
/**
|
|
67
|
+
* Puppet plays a Track on a hero. Playback starts paused at tick 0; the hero
|
|
68
|
+
* moves only while the puppet is playing or after a seek.
|
|
69
|
+
*/
|
|
70
|
+
export declare class Puppet {
|
|
71
|
+
readonly player: Player;
|
|
72
|
+
readonly track: Track;
|
|
73
|
+
private tickAt;
|
|
74
|
+
private rateNow;
|
|
75
|
+
private current;
|
|
76
|
+
/** clock is the game time of the last frame, unset until one arrives. */
|
|
77
|
+
private clock;
|
|
78
|
+
/** drawn is whether the hero needs placing at the current tick. */
|
|
79
|
+
private drawn;
|
|
80
|
+
private ghostNow;
|
|
81
|
+
private dead;
|
|
82
|
+
/** looked is the entity and ghost setting syncLook last wrote. */
|
|
83
|
+
private looked?;
|
|
84
|
+
private lastHealth;
|
|
85
|
+
private readonly snapUnits;
|
|
86
|
+
/**
|
|
87
|
+
* The puppet drives player's hero along track. It owns the hero's placement
|
|
88
|
+
* and, when the track records health, its health.
|
|
89
|
+
*/
|
|
90
|
+
constructor(player: Player, track: Track, options?: PuppetOptions);
|
|
91
|
+
/**
|
|
92
|
+
* spawn adds a bot and returns a puppet for it, or undefined when no bot
|
|
93
|
+
* could join. The bot appears at the track's first pose.
|
|
94
|
+
*/
|
|
95
|
+
static spawn(bot: BotOptions, track: Track, options?: PuppetOptions): Puppet | undefined;
|
|
96
|
+
/** state is where playback stands. */
|
|
97
|
+
get state(): PuppetState;
|
|
98
|
+
/** tick is the playback position, in track ticks. */
|
|
99
|
+
get tick(): number;
|
|
100
|
+
/** rate is the playback speed: 1 is real time, 0.5 half speed, negative runs backward. */
|
|
101
|
+
get rate(): number;
|
|
102
|
+
set rate(rate: number);
|
|
103
|
+
/** isGhost reports whether the puppet is a ghost. */
|
|
104
|
+
get isGhost(): boolean;
|
|
105
|
+
/** play starts or resumes playback; from the end it restarts at tick 0. */
|
|
106
|
+
play(): void;
|
|
107
|
+
/** pause holds the hero where it stands. */
|
|
108
|
+
pause(): void;
|
|
109
|
+
/**
|
|
110
|
+
* seek moves playback to tick, clamped to the track, and places the hero
|
|
111
|
+
* there on the next frame. Playback keeps its state, except that an ended
|
|
112
|
+
* puppet paused at the new tick.
|
|
113
|
+
*/
|
|
114
|
+
seek(tick: number): void;
|
|
115
|
+
/**
|
|
116
|
+
* setGhost draws the hero translucent and holds the modifier states of
|
|
117
|
+
* ghostStates, so it takes no damage and is not targeted; off restores
|
|
118
|
+
* both. The hero's collision with other heroes is the game's own.
|
|
119
|
+
*/
|
|
120
|
+
setGhost(ghost: boolean): void;
|
|
121
|
+
/**
|
|
122
|
+
* syncLook writes the ghost look and states to the hero entity when the
|
|
123
|
+
* entity or the ghost setting differs from what it last wrote, so a hero
|
|
124
|
+
* that respawned takes them again.
|
|
125
|
+
*/
|
|
126
|
+
private syncLook;
|
|
127
|
+
/** stop ends the puppet and removes its bot; a hero that is not a bot stays. */
|
|
128
|
+
stop(): void;
|
|
129
|
+
/**
|
|
130
|
+
* advance moves playback to the game clock at seconds and places the hero.
|
|
131
|
+
* The library calls it each frame; a mod calls it only to step a puppet by
|
|
132
|
+
* hand.
|
|
133
|
+
*/
|
|
134
|
+
advance(seconds: number): void;
|
|
135
|
+
/** place puts the hero at the current tick; it retries next frame without a hero. */
|
|
136
|
+
private place;
|
|
137
|
+
/**
|
|
138
|
+
* setHealth gives the hero the recorded health. A recorded zero kills the
|
|
139
|
+
* hero once; the first health above zero after that respawns it, and the
|
|
140
|
+
* next frame places it.
|
|
141
|
+
*/
|
|
142
|
+
private setHealth;
|
|
143
|
+
}
|
package/quickjs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Player } from './host.gen.js';
|
|
2
|
+
/** ReplayedHit is one recorded hit. */
|
|
3
|
+
export interface ReplayedHit {
|
|
4
|
+
/** victim is the player whose hero takes the hit. */
|
|
5
|
+
victim: Player;
|
|
6
|
+
/**
|
|
7
|
+
* attacker is the player credited with the hit, usually a puppet. Without
|
|
8
|
+
* one the hit is a hazard that credits no one.
|
|
9
|
+
*/
|
|
10
|
+
attacker?: Player;
|
|
11
|
+
/** amount is the damage before resistances. */
|
|
12
|
+
amount: number;
|
|
13
|
+
/** headshot makes the hit land on the head. */
|
|
14
|
+
headshot?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* ability names the attacker's ability that dealt the hit, such as
|
|
17
|
+
* citadel_ability_hornet_snipe. It is left out of the hit when the attacker
|
|
18
|
+
* does not own it.
|
|
19
|
+
*/
|
|
20
|
+
ability?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* replayDamage deals hit through the game's own damage, so resistances,
|
|
24
|
+
* kill credit, hit effects and the Damage events apply. It returns false
|
|
25
|
+
* when either hero is not alive to take part; the host logs why.
|
|
26
|
+
*/
|
|
27
|
+
export declare function replayDamage(hit: ReplayedHit): boolean;
|
package/restore.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Angles, type EquipmentTarget, type Player, type TimerTarget, type Vector } from './host.gen.js';
|
|
2
|
+
/**
|
|
3
|
+
* HeroSnapshot is the state restoreHero gives a hero. Omitted parts keep the
|
|
4
|
+
* hero's own.
|
|
5
|
+
*/
|
|
6
|
+
export interface HeroSnapshot {
|
|
7
|
+
/** position is the hero's origin. */
|
|
8
|
+
position: Vector;
|
|
9
|
+
/** facing is where the hero and its camera face. */
|
|
10
|
+
facing: Angles;
|
|
11
|
+
/** health and maxHealth are the hero's health and its base maximum. */
|
|
12
|
+
health: number;
|
|
13
|
+
maxHealth: number;
|
|
14
|
+
/** level is the hero's level. */
|
|
15
|
+
level?: number;
|
|
16
|
+
/**
|
|
17
|
+
* souls is the souls the hero holds unspent, once the build is in place.
|
|
18
|
+
* The build a snapshot lists is not paid for from them.
|
|
19
|
+
*/
|
|
20
|
+
souls?: number;
|
|
21
|
+
/** upgradeBonuses are the three stat bonuses purchases add. */
|
|
22
|
+
upgradeBonuses?: readonly number[];
|
|
23
|
+
/** abilities are the hero's abilities in their slots, with their bought tiers. */
|
|
24
|
+
abilities?: readonly EquipmentTarget[];
|
|
25
|
+
/** items replace every item the hero owns; an empty list removes them. */
|
|
26
|
+
items?: readonly EquipmentTarget[];
|
|
27
|
+
/** timers are the charges and cooldowns of owned abilities and items. */
|
|
28
|
+
timers?: readonly TimerTarget[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* restoreHero gives player's live hero the snapshot over the next few
|
|
32
|
+
* seconds, and calls done with undefined once the state has held, or with
|
|
33
|
+
* the reason it did not. A new restore for the player replaces the running
|
|
34
|
+
* one, which never calls done. It returns false when the restore could not
|
|
35
|
+
* start. Shields are not restored.
|
|
36
|
+
*/
|
|
37
|
+
export declare function restoreHero(player: Player, snapshot: HeroSnapshot, done?: (error: string | undefined) => void): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* settleRestore finishes player's restore when the host reports its end: it
|
|
40
|
+
* sets the souls the snapshot holds and calls the restore's callback. The
|
|
41
|
+
* library calls it for each Restored event.
|
|
42
|
+
*/
|
|
43
|
+
export declare function settleRestore(player: Player, error: string | undefined): void;
|
package/scriptc.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* event answers the Call the host holds, size bytes long. call hands the
|
|
4
|
+
* host an encoded Call and returns the size of its Reply; read copies the
|
|
5
|
+
* bytes the host holds, the Call first and then each Reply, into its
|
|
6
|
+
* argument.
|
|
7
|
+
*/
|
|
8
|
+
export declare function event(size: number, call: (data: Uint8Array) => number, read: (data: Uint8Array) => void): Uint8Array;
|
package/spot.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type Angles, type MovementSample, type Vector, type WorldObject } from './host.gen.js';
|
|
2
|
+
/** SpotObject is one solid object placed in a spot. */
|
|
3
|
+
export interface SpotObject {
|
|
4
|
+
/** model is the model's path, which the mode precached. */
|
|
5
|
+
readonly model: string;
|
|
6
|
+
/** position is the model's origin. */
|
|
7
|
+
readonly position: Vector;
|
|
8
|
+
/** facing is the model's rotation. */
|
|
9
|
+
readonly facing: Angles;
|
|
10
|
+
/** scale multiplies the model's size. */
|
|
11
|
+
readonly scale: number;
|
|
12
|
+
/**
|
|
13
|
+
* bounce launches a hero who stands on the object upward at this speed, in
|
|
14
|
+
* units per second; zero makes an ordinary object.
|
|
15
|
+
*/
|
|
16
|
+
readonly bounce: number;
|
|
17
|
+
/** placedBy is the Steam ID of the player who placed the object, or zero. */
|
|
18
|
+
readonly placedBy: bigint;
|
|
19
|
+
}
|
|
20
|
+
/** Spot is a base map and the objects placed on it, in placement order. */
|
|
21
|
+
export interface Spot {
|
|
22
|
+
readonly map: string;
|
|
23
|
+
readonly objects: readonly SpotObject[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* encodeSpot returns the spot document. Equal spots encode to equal bytes.
|
|
27
|
+
* Positions and angles keep single precision.
|
|
28
|
+
*/
|
|
29
|
+
export declare function encodeSpot(spot: Spot): Uint8Array;
|
|
30
|
+
/** decodeSpot reads a spot document. */
|
|
31
|
+
export declare function decodeSpot(bytes: Uint8Array): Spot;
|
|
32
|
+
/** Placed is one spot object standing in the world. */
|
|
33
|
+
export interface Placed {
|
|
34
|
+
readonly object: SpotObject;
|
|
35
|
+
readonly world: WorldObject;
|
|
36
|
+
/** entity is the model's entity handle, as traces report it. */
|
|
37
|
+
readonly entity: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* triggers is the trigger collision layer. Traces that look for placed
|
|
41
|
+
* objects exclude it: spawn rooms and other volumes enclose the ground, and a
|
|
42
|
+
* line starting inside one stops there.
|
|
43
|
+
*/
|
|
44
|
+
export declare const triggers: bigint;
|
|
45
|
+
/**
|
|
46
|
+
* LoadedSpot is a spot standing in the world. It keeps the placed objects in
|
|
47
|
+
* placement order, so spot() returns what a player sees.
|
|
48
|
+
*/
|
|
49
|
+
export declare class LoadedSpot {
|
|
50
|
+
readonly map: string;
|
|
51
|
+
private placed;
|
|
52
|
+
private entities;
|
|
53
|
+
constructor(map: string);
|
|
54
|
+
/** objects returns the placed objects in placement order. */
|
|
55
|
+
objects(): readonly Placed[];
|
|
56
|
+
/**
|
|
57
|
+
* place spawns object as a solid model and adds it to the spot. A model
|
|
58
|
+
* the game cannot place logs why and returns nothing.
|
|
59
|
+
*/
|
|
60
|
+
place(object: SpotObject): Placed | undefined;
|
|
61
|
+
/** at returns the placed object whose entity a trace hit, if any. */
|
|
62
|
+
at(entity: number): Placed | undefined;
|
|
63
|
+
/** move puts a placed object at position and facing, keeping its order. */
|
|
64
|
+
move(placed: Placed, position: Vector, facing: Angles): Placed;
|
|
65
|
+
/** remove takes a placed object out of the world and the spot. */
|
|
66
|
+
remove(placed: Placed): void;
|
|
67
|
+
/** clear removes every placed object. */
|
|
68
|
+
clear(): void;
|
|
69
|
+
/** spot returns the spot as it stands. */
|
|
70
|
+
spot(): Spot;
|
|
71
|
+
/**
|
|
72
|
+
* bounce launches each sampled hero who stands on a bouncing object. A
|
|
73
|
+
* mode calls it with each frame's movement samples, for the heroes it
|
|
74
|
+
* watches.
|
|
75
|
+
*/
|
|
76
|
+
bounce(movement: readonly MovementSample[]): void;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* loadSpot places every object of spot and returns it standing. Objects the
|
|
80
|
+
* game cannot place are skipped with a log line; the rest load.
|
|
81
|
+
*/
|
|
82
|
+
export declare function loadSpot(spot: Spot): LoadedSpot;
|
package/theme.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/** Tone names the colors a surface may use for meaning. */
|
|
2
|
+
export type Tone = 'text' | 'muted' | 'accent' | 'onAccent' | 'amber' | 'sapphire' | 'gas' | 'success' | 'danger' | 'gold';
|
|
3
|
+
/**
|
|
4
|
+
* tones maps each meaning to one color. Text, team and danger colors are the
|
|
5
|
+
* stock HUD's offWhite, team1Color, team2Color and colorEnemy.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tones: Record<Tone, string>;
|
|
8
|
+
/**
|
|
9
|
+
* teamTones colors each game team, by its team number: 2 is the Hidden
|
|
10
|
+
* King's amber, 3 the Archmother's sapphire.
|
|
11
|
+
*/
|
|
12
|
+
export declare const teamTones: Readonly<Record<number, Tone>>;
|
|
13
|
+
/**
|
|
14
|
+
* shades are the neutrals a full screen draws with, from the stock main menu's
|
|
15
|
+
* base styles, so a full screen reads as part of the game's own menus. Fills are
|
|
16
|
+
* opaque offWhite tints of the offBlack backdrop: Panorama blends translucent
|
|
17
|
+
* fills far stronger than their alpha, which let the stock menu show through.
|
|
18
|
+
*/
|
|
19
|
+
export declare const shades: {
|
|
20
|
+
/** offWhite at about half strength: idle navigation and secondary text. */
|
|
21
|
+
readonly quiet: '#ffefd78c';
|
|
22
|
+
/** offWhite at the popup button's 44%: idle pill borders. */
|
|
23
|
+
readonly faint: '#ffefd770';
|
|
24
|
+
/** offWhite at about 40%: counts, placeholders and offline players. */
|
|
25
|
+
readonly dim: '#6b675d';
|
|
26
|
+
/** offWhite at 13%: hairlines between sections and plate edges. */
|
|
27
|
+
readonly hairline: '#2b2a24';
|
|
28
|
+
/** offBlack: text on light fills, and the backdrop's hue. */
|
|
29
|
+
readonly ink: '#10130d';
|
|
30
|
+
/** The menu backdrop: an opaque offBlack that hides the stock menu. */
|
|
31
|
+
readonly backdrop: '#0b0d09';
|
|
32
|
+
/** The backdrop at 95%, under a panel the player reads over the game. */
|
|
33
|
+
readonly veil: '#0b0d09f2';
|
|
34
|
+
/** offWhite at 4%: a plate on the backdrop. */
|
|
35
|
+
readonly plate: '#151611';
|
|
36
|
+
/** offWhite at 8%: a row or stat inside a plate. */
|
|
37
|
+
readonly raised: '#1e1f19';
|
|
38
|
+
/** offWhite at 13%: a hovered or joined row. */
|
|
39
|
+
readonly lit: '#2b2a24';
|
|
40
|
+
/** The full-strength fill of a lit primary button. */
|
|
41
|
+
readonly white: '#ffffff';
|
|
42
|
+
/** No fill or border, where a state turns one off. */
|
|
43
|
+
readonly clear: '#00000000';
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* sizes holds the shared sizes: panel buttons and fields share one height, row
|
|
47
|
+
* buttons a shorter one, and every control and tag one corner radius.
|
|
48
|
+
*/
|
|
49
|
+
export declare const sizes: {
|
|
50
|
+
/** control is the height of panel buttons and fields. */
|
|
51
|
+
readonly control: 32;
|
|
52
|
+
/** rowControl is the height of a button inside a list row. */
|
|
53
|
+
readonly rowControl: 28;
|
|
54
|
+
/** row is the height of one list row. */
|
|
55
|
+
readonly row: 32;
|
|
56
|
+
/** radius rounds buttons, fields and tags. */
|
|
57
|
+
readonly radius: 4;
|
|
58
|
+
/** panelRadius rounds panels. */
|
|
59
|
+
readonly panelRadius: 8;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Face is one of the game's typefaces: body is Retail Demo, its text; block is
|
|
63
|
+
* VALVEPulp, set in capitals for the stock clock, round titles and callouts;
|
|
64
|
+
* serif is Reaver, its menus.
|
|
65
|
+
*/
|
|
66
|
+
export type Face = 'body' | 'block' | 'serif';
|
|
67
|
+
/** TextRole names one step of the HUD type scale. */
|
|
68
|
+
export type TextRole = 'display' | 'title' | 'body' | 'label' | 'caption';
|
|
69
|
+
/** Type is one type role: its face, size in pixels, and whether in capitals. */
|
|
70
|
+
export interface Type {
|
|
71
|
+
readonly face: Face;
|
|
72
|
+
readonly size: number;
|
|
73
|
+
readonly uppercase: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** types gives every build the same typography. */
|
|
76
|
+
export declare const types: Record<TextRole, Type>;
|
|
77
|
+
/**
|
|
78
|
+
* plate is the translucent plate under HUD text. It stays dark enough for
|
|
79
|
+
* muted captions to read over a bright sky.
|
|
80
|
+
*/
|
|
81
|
+
export declare const plate: {
|
|
82
|
+
color: string;
|
|
83
|
+
radius: number;
|
|
84
|
+
/** padding is [vertical, horizontal] in pixels. */
|
|
85
|
+
padding: readonly [10, 18];
|
|
86
|
+
};
|
|
87
|
+
/** pillEdge is a pill's resting edge, a faint parchment line. */
|
|
88
|
+
export declare const pillEdge = "#ffefd71a";
|
|
89
|
+
/** PipShape is a round point, as in the stock round counter, or a narrow tick. */
|
|
90
|
+
export type PipShape = 'round' | 'tick';
|
|
91
|
+
/** pipShapes are each pip shape's size and corner radius, in pixels. */
|
|
92
|
+
export declare const pipShapes: Record<PipShape, {
|
|
93
|
+
readonly width: number;
|
|
94
|
+
readonly height: number;
|
|
95
|
+
readonly radius: number;
|
|
96
|
+
}>;
|
|
97
|
+
/** pipRings are the stock round counter's point borders, empty and filled. */
|
|
98
|
+
export declare const pipRings: {
|
|
99
|
+
readonly empty: '#ffefd72e';
|
|
100
|
+
readonly filled: '#10130de6';
|
|
101
|
+
};
|
|
102
|
+
/** emptyPip is an unearned pip's fill: clear, so only its faint ring shows. */
|
|
103
|
+
export declare const emptyPip = "#00000000";
|
|
104
|
+
/**
|
|
105
|
+
* teamBarBottom is where the stock team bar ends, in pixels on a 1080 high
|
|
106
|
+
* HUD; a strip that keeps the bar sits below it.
|
|
107
|
+
*/
|
|
108
|
+
export declare const teamBarBottom = 84;
|
|
109
|
+
/**
|
|
110
|
+
* objectiveBarBottom is where the stock objective bar under the team bar ends,
|
|
111
|
+
* its urn and Rift progress, in pixels on a 1080 high HUD; a strip's line goes
|
|
112
|
+
* below it so the bar's labels stay clear.
|
|
113
|
+
*/
|
|
114
|
+
export declare const objectiveBarBottom = 220;
|
|
115
|
+
/**
|
|
116
|
+
* fpsReadoutBottom is how far down the top right corner HUD starts, in pixels
|
|
117
|
+
* on a 1080 high HUD: under the game's FPS readout, whose third line, the red
|
|
118
|
+
* slow server frame warning, shows during server spikes and ends about 62px
|
|
119
|
+
* down.
|
|
120
|
+
*/
|
|
121
|
+
export declare const fpsReadoutBottom = 68;
|
|
122
|
+
/**
|
|
123
|
+
* sounds are the game's interface sound events for the kit's controls: the
|
|
124
|
+
* main menu's hover tick and press.
|
|
125
|
+
*/
|
|
126
|
+
export declare const sounds: {
|
|
127
|
+
readonly hover: 'UI.MainMenu.Hover';
|
|
128
|
+
readonly press: 'UI.MainMenu.Activate';
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* motion is how long the kit's controls take to answer the pointer and a
|
|
132
|
+
* meter to reach its value, in seconds: quick enough to feel immediate.
|
|
133
|
+
*/
|
|
134
|
+
export declare const motion: {
|
|
135
|
+
readonly hover: 0.15;
|
|
136
|
+
readonly meter: 0.25;
|
|
137
|
+
};
|
package/timer.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Timer is one scheduled callback. */
|
|
2
|
+
export interface Timer {
|
|
3
|
+
/** finished reports whether the timer ran its last time or was cancelled. */
|
|
4
|
+
readonly finished: boolean;
|
|
5
|
+
/** cancel stops the timer; it does nothing once the timer is finished. */
|
|
6
|
+
cancel(): void;
|
|
7
|
+
}
|
|
8
|
+
/** after runs fn once, seconds from now. */
|
|
9
|
+
export declare function after(seconds: number, fn: () => void): Timer;
|
|
10
|
+
/** every runs fn each seconds, keeping its cadence through a late frame. */
|
|
11
|
+
export declare function every(seconds: number, fn: () => void): Timer;
|
|
12
|
+
/**
|
|
13
|
+
* sequence calls fn on the next frame with the number of times it has run,
|
|
14
|
+
* starting at 1. fn returns the seconds to wait before it runs again, or
|
|
15
|
+
* nothing to end the sequence.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sequence(fn: (run: number) => number | void): Timer;
|
|
18
|
+
/**
|
|
19
|
+
* advance moves the clock to a frame and runs the timers that came due. A
|
|
20
|
+
* callback that throws ends only its own timer.
|
|
21
|
+
*/
|
|
22
|
+
export declare function advance(seconds: number): void;
|