@modlock/modlock 0.1.78 → 0.1.80

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/cast.d.ts CHANGED
@@ -2,8 +2,9 @@ import { type Connection, type Pawn, type Player } from './host.gen.js';
2
2
  /** Want is what a member's hero should be; each field it leaves out is free. */
3
3
  export interface Want {
4
4
  /**
5
- * hero seats the member on a hero: its name, such as 'hero_atlas', its id,
6
- * or 'any' for the hero they have or else a random one.
5
+ * hero seats the member on a hero: its name as players know it or as the
6
+ * game does, such as 'Calico' or 'hero_nano', its id, or 'any' for the
7
+ * hero they have or else a random one.
7
8
  */
8
9
  readonly hero?: string | number;
9
10
  /**
package/heroes.d.ts CHANGED
@@ -11,6 +11,14 @@ export interface Hero extends Titled {
11
11
  }
12
12
  /** heroes are the released heroes, by title. */
13
13
  export declare const heroes: readonly Hero[];
14
+ /**
15
+ * heroNamed returns the released hero that name names exactly: its game
16
+ * name, such as 'hero_nano', that name without 'hero_', such as 'nano', or
17
+ * its title in any case, with or without spaces and punctuation, such as
18
+ * 'Calico' or 'ladygeist'. Unlike findHero it matches no part of a name, so
19
+ * a misspelled name finds no hero rather than another one.
20
+ */
21
+ export declare function heroNamed(name: string): Hero | undefined;
14
22
  /** findHero matches what a player typed to a hero, as findTitled does. */
15
23
  export declare function findHero(typed: string): Hero | undefined;
16
24
  /**
package/host.gen.d.ts CHANGED
@@ -102,6 +102,44 @@ export interface AbilityOptions {
102
102
  */
103
103
  maxCharges?: number;
104
104
  }
105
+ /** Modifier is one modifier an entity holds, as the game keeps it. */
106
+ export interface Modifier {
107
+ /**
108
+ * name is the modifier's name, such as modifier_citadel_knockdown, as
109
+ * GiveModifier and ReadModifierField name it. It is empty when the game
110
+ * keeps no readable name.
111
+ */
112
+ readonly name: string;
113
+ /**
114
+ * className is the modifier's server class, such as
115
+ * CCitadel_Modifier_Knockdown, which ReadModifierField takes. Several
116
+ * names can share a class.
117
+ */
118
+ readonly className: string;
119
+ /**
120
+ * caster is the handle of the entity that applied it, such as the hero
121
+ * whose ability did, or 0 when none did.
122
+ */
123
+ readonly caster: number;
124
+ /**
125
+ * ability is the handle of the ability that applied it, or 0 when none did.
126
+ */
127
+ readonly ability: number;
128
+ /** age is how many seconds ago the game created it. */
129
+ readonly age: number;
130
+ /**
131
+ * remaining is how many seconds it has left since it was last applied. It
132
+ * is absent for a modifier that lasts until something removes it.
133
+ */
134
+ readonly remaining?: number;
135
+ /** stacks and maxStacks count its stacks, for a modifier that stacks. */
136
+ readonly stacks: number;
137
+ readonly maxStacks: number;
138
+ /** team is the team number it belongs to. */
139
+ readonly team: number;
140
+ /** disabled is true while the game keeps it without its effects. */
141
+ readonly disabled: boolean;
142
+ }
105
143
  /** BuildCategory is one named group of a build's items. */
106
144
  export interface BuildCategory {
107
145
  /** name is the category's title. */
@@ -1897,6 +1935,13 @@ export declare function entityPosition(entity: number): EntityPlacement | undefi
1897
1935
  * MODIFIER_STATE_PARRY_ACTIVE.
1898
1936
  */
1899
1937
  export declare function modifierState(entity: number, state: string): boolean;
1938
+ /**
1939
+ * modifiers lists every modifier an entity holds, such as the stun a
1940
+ * hero's ultimate keeps on its target, with its name, class, caster,
1941
+ * ability, age, time left and stacks. An entity that holds none answers an
1942
+ * empty list.
1943
+ */
1944
+ export declare function modifiers(entity: number): Modifier[];
1900
1945
  /**
1901
1946
  * holdModifierState holds a modifier state, such as
1902
1947
  * MODIFIER_STATE_FRIENDLY_FIRE_ENABLED, on an entity while the mod runs, or
package/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
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, type PlayerJoinedEvent, type PlayerLeftEvent } from './host.gen.js';
2
+ import { type DamageEvent, type ChatEvent, type Connection, type DamagedEvent, type DamageResult, type FrameEvent, type ImpactEvent, type LandedEvent, type LaunchEvent, type Pawn, Player, type PlayerJoinedEvent, type PlayerLeftEvent } from './host.gen.js';
3
+ import { Cast } from './cast.js';
3
4
  export * as vector from './vector.js';
4
5
  export { Buttons, Layers } from './bits.js';
5
6
  export { after, every, sequence, type Timer } from './timer.js';
6
7
  export { type CameraMove, type CameraPlayOptions, cameraPulse, type CameraPulseOptions, cameraShake, type CameraShakeOptions, playCamera, setOrbitCamera, } from './camera.js';
7
8
  export * as curve from './curve.js';
8
9
  export * as format from './format.js';
9
- export { findHero, findTitled, type Hero, heroes, type Titled, } from './heroes.js';
10
+ export { findHero, findTitled, type Hero, heroes, heroNamed, type Titled, } from './heroes.js';
10
11
  export { item, type Item, itemId, items, type Slot } from './items.js';
11
12
  export { Hook, type HookAbility, hookAbility, type HookPlayer, type HookRead, hookUpgrades, type ReadHandle, } from './hook.js';
12
13
  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';
@@ -17,7 +18,7 @@ export { Cast, type CastOptions, type Want } from './cast.js';
17
18
  export { frameClock } from './frameclock.js';
18
19
  export { ground, type GroundOptions } from './ground.js';
19
20
  export { RaceGate, type RaceGateOptions, raceGateResources, } from './racegate.js';
20
- export { players } from './players.js';
21
+ export { connection, players } from './players.js';
21
22
  export { afterMatch, fewestPlayed, leaderboard, leastUsed, nextMatch, ratingChange, ratingStep, settle, type Standing, Standings, startingRating, } from './rotation.js';
22
23
  export { bystanderStates, holdBystander } from './bystander.js';
23
24
  export { Strays, strayGraceSeconds } from './strays.js';
@@ -77,6 +78,43 @@ export declare function onPlayerJoin(handler: (joined: PlayerJoinedEvent) => voi
77
78
  * mod stops serving leaves too, with disconnected false.
78
79
  */
79
80
  export declare function onPlayerLeave(handler: (left: PlayerLeftEvent) => void): void;
81
+ /**
82
+ * onSpawn calls handler each time a player's hero enters play: their first
83
+ * hero after joining, each respawn, and each new hero after a change. The
84
+ * player has a hero to move, equip and read from then on, which onPlayerJoin
85
+ * does not promise. The library reads each player's pawn once a frame while a
86
+ * handler is registered.
87
+ */
88
+ export declare function onSpawn(handler: (player: Player, pawn: Pawn) => void): void;
89
+ /** Seating is where seatPlayers puts each player who joins. */
90
+ export interface Seating {
91
+ /**
92
+ * hero is each player's hero: its name as players know it or as the game
93
+ * does, such as 'haze' or 'hero_haze', its id, or 'any' for the hero they
94
+ * have or else a random one. 'any' is the default.
95
+ */
96
+ readonly hero?: string | number;
97
+ /**
98
+ * team is the team, 2 or 3, every player joins, or a function that picks
99
+ * the team for one player as they join. Without one each player joins the
100
+ * side with fewer heroes.
101
+ */
102
+ readonly team?: number | ((connection: Connection) => number);
103
+ /**
104
+ * respawn is the seconds a fallen hero waits before it comes back. Without
105
+ * one a fallen hero is left to the game.
106
+ */
107
+ readonly respawn?: number;
108
+ }
109
+ /**
110
+ * seatPlayers gives every player who joins a hero on a team, skipping the
111
+ * game's team and hero screens, and keeps them seated for the rest of the
112
+ * game: it brings a fallen hero back after the respawn delay and seats a
113
+ * player again after a hero change. It returns the Cast that does the
114
+ * seating, whose members are the players' connections, and runs it each
115
+ * frame itself.
116
+ */
117
+ export declare function seatPlayers(seating?: Seating): Cast<Connection>;
80
118
  /** onFrame calls handler once per server frame. */
81
119
  export declare function onFrame(handler: (frame: FrameEvent) => void): void;
82
120
  /**