@modlock/modlock 0.1.71 → 0.1.73

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/bystander.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /** bystanderStates are the modifier states that keep a hero out of play. */
2
+ export declare const bystanderStates: readonly string[];
3
+ /**
4
+ * holdBystander keeps the hero pawn entity out of play, or with active false
5
+ * gives it back. The states stay until released or the pawn is removed, so
6
+ * a mod releases them before the hero plays again. It returns false when a
7
+ * state did not take, such as on a pawn that is gone.
8
+ */
9
+ export declare function holdBystander(entity: number, active?: boolean): boolean;
package/cast.d.ts CHANGED
@@ -56,12 +56,23 @@ export declare class Cast<M> {
56
56
  * not show yet. seconds is the game clock.
57
57
  */
58
58
  frame(seconds: number): void;
59
- /** settle ends the members whose connection left and makes the new ones. */
59
+ /**
60
+ * settle ends the members whose connection left and makes the new ones,
61
+ * joined at now.
62
+ */
60
63
  private settle;
61
64
  /** kick asks the server to remove a bot, once per connection. */
62
65
  private kick;
63
66
  /** reconcile reads a member's hero and asks for the part of the want it lacks. */
64
67
  private reconcile;
68
+ /**
69
+ * stranded returns 'any' for a human whose hero is free when the game has
70
+ * left them on a team without one for changeSeconds since they joined, and
71
+ * otherwise leaves the hero free. Such a pawn never gets a hero on its own,
72
+ * while a player still choosing one has no pawn and a spectator stands on
73
+ * team 1. A bot is left to the game, which seats it.
74
+ */
75
+ private stranded;
65
76
  /** wantOf is what the member in seat wants now. */
66
77
  private wantOf;
67
78
  /** seated reports whether the member's hero shows the hero and team they want. */
package/hook.d.ts CHANGED
@@ -45,9 +45,10 @@ export declare class Hook {
45
45
  /**
46
46
  * update reads the thrower's hook at game time now, keeps it fully upgraded
47
47
  * and sets the length of any cooldown a throw started. It reports nothing
48
- * for a hero without the hook.
48
+ * for a hero without the hook. A caller that already read this frame's
49
+ * abilities passes them to avoid another read.
49
50
  */
50
- update(player: HookPlayer, now: number): HookRead | undefined;
51
+ update(player: HookPlayer, now: number, abilities?: readonly HookAbility[]): HookRead | undefined;
51
52
  /** victim is the hero the hook entity holds, or undefined while it holds none. */
52
53
  private victim;
53
54
  /** setCooldown ends the cooldown cooldownSeconds after the hook's throw. */
package/host.gen.d.ts CHANGED
@@ -31,6 +31,11 @@ export type Lane = 'none' | 'yellow' | 'green' | 'blue' | 'purple';
31
31
  export type TextAlign = 'left' | 'center' | 'right';
32
32
  /** TextVerticalAlign places text up and down its position. */
33
33
  export type TextVerticalAlign = 'bottom' | 'center' | 'top';
34
+ /**
35
+ * DisconnectReason is why the server dropped a connection, numbered as the
36
+ * game's ENetworkDisconnectionReason.
37
+ */
38
+ export type DisconnectReason = 'shutdown' | 'disconnectByUser' | 'disconnectByServer' | 'lost' | 'overflow' | 'steamBanned' | 'steamInuse' | 'steamTicket' | 'steamLogon' | 'steamAuthcancelled' | 'steamAuthalreadyused' | 'steamAuthinvalid' | 'steamVacbanstate' | 'steamLoggedInElsewhere' | 'steamVacCheckTimedout' | 'steamDropped' | 'steamOwnership' | 'serverinfoOverflow' | 'tickmsgOverflow' | 'stringtablemsgOverflow' | 'deltaentmsgOverflow' | 'tempentmsgOverflow' | 'soundsmsgOverflow' | 'snapshotoverflow' | 'snapshoterror' | 'reliableoverflow' | 'baddeltatick' | 'nomoresplits' | 'timedout' | 'disconnected' | 'leavingsplit' | 'differentclasstables' | 'badrelaypassword' | 'badspectatorpassword' | 'hltvrestricted' | 'nospectators' | 'hltvunavailable' | 'hltvstop' | 'kicked' | 'banadded' | 'kickbanadded' | 'hltvdirect' | 'pureserverClientextra' | 'pureserverMismatch' | 'usercmd' | 'rejectedByGame' | 'messageParseError' | 'invalidMessageError' | 'badServerPassword' | 'directConnectReservation' | 'connectionFailure' | 'noPeerGroupHandlers' | 'reconnection' | 'loopshutdown' | 'loopdeactivate' | 'hostEndgame' | 'loopLevelloadActivate' | 'createServerFailed' | 'exiting' | 'requestHoststateIdle' | 'requestHoststateHltvrelay' | 'clientConsistencyFail' | 'clientUnableToCrcMap' | 'clientNoMap' | 'clientDifferentMap' | 'serverRequiresSteam' | 'steamDenyMisc' | 'steamDenyBadAntiCheat' | 'serverShutdown' | 'replayIncompatible' | 'connectRequestTimedout' | 'serverIncompatible' | 'localproblemManyrelays' | 'localproblemHostedserverprimaryrelay' | 'localproblemNetworkconfig' | 'localproblemOther' | 'remoteTimeout' | 'remoteTimeoutConnecting' | 'remoteOther' | 'remoteBadcrypt' | 'remoteCertnottrusted' | 'unusual' | 'internalError' | 'rejectBadchallenge' | 'rejectNolobby' | 'rejectBackgroundMap' | 'rejectSinglePlayer' | 'rejectHiddenGame' | 'rejectLanrestrict' | 'rejectBadpassword' | 'rejectServerfull' | 'rejectInvalidreservation' | 'rejectFailedchannel' | 'rejectConnectFromLobby' | 'rejectReservedForLobby' | 'rejectInvalidkeylength' | 'rejectOldprotocol' | 'rejectNewprotocol' | 'rejectInvalidconnection' | 'rejectInvalidcertlen' | 'rejectInvalidsteamcertlen' | 'rejectSteam' | 'rejectServerauthdisabled' | 'rejectServercdkeyauthinvalid' | 'rejectBanned' | 'kickedTeamkilling' | 'kickedTkStart' | 'kickedUntrustedaccount' | 'kickedConvictedaccount' | 'kickedCompetitivecooldown' | 'kickedTeamhurting' | 'kickedHostagekilling' | 'kickedVotedoff' | 'kickedIdle' | 'kickedSuicide' | 'kickedNosteamlogin' | 'kickedNosteamticket' | 'kickedInputautomation' | 'kickedVacnetabnormalbehavior' | 'kickedInsecureclient';
34
39
  /** ModRole is what a player is to the running mods. */
35
40
  export type ModRole = 'unspecified' | 'developer' | 'tester';
36
41
  /**
@@ -243,6 +248,27 @@ export interface HitOptions {
243
248
  */
244
249
  ability?: number;
245
250
  }
251
+ /**
252
+ * KillOptions forces a hero or unit's death through the game's damage path.
253
+ */
254
+ export interface KillOptions {
255
+ /**
256
+ * victim is the hero or unit to kill. World entities, props and buildings
257
+ * are refused because their damage events crash clients.
258
+ */
259
+ victim: number;
260
+ /**
261
+ * attacker receives the game's kill credit and rewards. Without an attacker
262
+ * the death is environmental and grants neither credit nor rewards.
263
+ */
264
+ attacker?: number;
265
+ /** inflictor delivered the killing blow; the default is the attacker. */
266
+ inflictor?: number;
267
+ /**
268
+ * ability is the ability entity responsible for the kill, when applicable.
269
+ */
270
+ ability?: number;
271
+ }
246
272
  /**
247
273
  * TraceOptions describes a line to test against the world. Layers are bits
248
274
  * of the game's collision layers: bit 0 is solid, 2 trigger, 4 player clip,
@@ -794,6 +820,36 @@ export interface RestoredEvent {
794
820
  export interface PlayersChangedEvent {
795
821
  readonly players: Connection[];
796
822
  }
823
+ /**
824
+ * PlayerJoinedEvent reports a player who joined the mod: a human who finished
825
+ * joining the server, a bot once added, or a player already in the game when
826
+ * the mod starts or begins to serve them.
827
+ */
828
+ export interface PlayerJoinedEvent {
829
+ /** connection is the player as Players lists them. */
830
+ readonly connection: Connection;
831
+ }
832
+ /**
833
+ * PlayerLeftEvent reports a player leaving the mod, once for each
834
+ * PlayerJoinedEvent.
835
+ */
836
+ export interface PlayerLeftEvent {
837
+ /**
838
+ * connection is the player as the last PlayerJoinedEvent or PlayersChanged
839
+ * listed them.
840
+ */
841
+ readonly connection: Connection;
842
+ /**
843
+ * disconnected is true when the player leaves the server, and false when
844
+ * they stay but the mod stops serving them.
845
+ */
846
+ readonly disconnected: boolean;
847
+ /**
848
+ * reason is why the server dropped the connection, absent when the player
849
+ * stays or the engine gave no reason this schema names.
850
+ */
851
+ readonly reason?: DisconnectReason;
852
+ }
797
853
  /** Connection is one occupied player slot. */
798
854
  export interface Connection {
799
855
  /** player is the connection's server slot. */
@@ -1173,6 +1229,11 @@ export interface StartResult {
1173
1229
  damaged: boolean;
1174
1230
  /** chat asks for a chat event for each chat line. */
1175
1231
  chat: boolean;
1232
+ /**
1233
+ * joins asks for a PlayerJoined event as each player the mod serves joins,
1234
+ * and a PlayerLeft event as each leaves.
1235
+ */
1236
+ joins: boolean;
1176
1237
  }
1177
1238
  /** FrameEvent identifies one server frame. */
1178
1239
  export interface FrameEvent {
@@ -1267,6 +1328,15 @@ export declare class Player {
1267
1328
  /** slot identifies the player on the server. */
1268
1329
  readonly slot: number;
1269
1330
  constructor(slot: number);
1331
+ /**
1332
+ * of returns the Player for slot, the same object each time until release
1333
+ * forgets it, so === tells whether two values are the same player.
1334
+ */
1335
+ static of(slot: number): Player;
1336
+ /**
1337
+ * release forgets the Player for slot, so the next Player.of makes a new one.
1338
+ */
1339
+ static release(slot: number): void;
1270
1340
  /** chat sends a server chat line to the player. */
1271
1341
  chat(text: string): boolean;
1272
1342
  /**
@@ -1888,6 +1958,11 @@ export declare function clearMap(): boolean;
1888
1958
  * include its own hits.
1889
1959
  */
1890
1960
  export declare function damage(options: HitOptions): boolean;
1961
+ /**
1962
+ * killEntity forces a hero or unit to die, optionally crediting an attacker.
1963
+ * Already dead victims succeed without another death or reward.
1964
+ */
1965
+ export declare function killEntity(options: KillOptions): boolean;
1891
1966
  /**
1892
1967
  * trace returns where a line first hits something, or nothing when it hits
1893
1968
  * nothing or the world's collision is not ready.
@@ -2002,6 +2077,20 @@ export interface ModHandlers {
2002
2077
  * nothing.
2003
2078
  */
2004
2079
  settingChanged(event: SettingChangedEvent): void;
2080
+ /**
2081
+ * playerJoined reports each player the mod serves once they are ready: a
2082
+ * human who finished joining, a bot once added, and at start each player
2083
+ * already in the game. It follows the PlayersChanged that lists them.
2084
+ */
2085
+ playerJoined(event: PlayerJoinedEvent): void;
2086
+ /**
2087
+ * playerLeft reports each joined player leaving the mod, once. A player who
2088
+ * disconnects is reported before the engine removes them, so their slot
2089
+ * and hero still read, and before the PlayersChanged that drops them. A
2090
+ * disconnect the mod causes during its own event, such as removing a bot,
2091
+ * arrives after that event returns.
2092
+ */
2093
+ playerLeft(event: PlayerLeftEvent): void;
2005
2094
  /**
2006
2095
  * playersChanged reports the occupied player slots before the first event
2007
2096
  * after Start, and again before the next event whenever a player joins,
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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 } from './host.gen.js';
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';
3
3
  export * as vector from './vector.js';
4
4
  export { Buttons, Layers } from './bits.js';
5
5
  export { after, every, sequence, type Timer } from './timer.js';
@@ -17,11 +17,15 @@ export { Cast, type CastOptions, type Want } from './cast.js';
17
17
  export { frameClock } from './frameclock.js';
18
18
  export { ground, type GroundOptions } from './ground.js';
19
19
  export { players } from './players.js';
20
+ export { afterMatch, fewestPlayed, leaderboard, leastUsed, nextMatch, ratingChange, ratingStep, settle, type Standing, Standings, startingRating, } from './rotation.js';
21
+ export { bystanderStates, holdBystander } from './bystander.js';
22
+ export { Strays, strayGraceSeconds } from './strays.js';
20
23
  export { type Check, ProbeRun } from './probe.js';
21
24
  export { poseAt, type Pose, Puppet, type PuppetOptions, type PuppetState, ghostStates, ticksPerSecond, type Track, trackTicks, } from './puppet.js';
22
25
  export { type HeroSnapshot, restoreHero } from './restore.js';
23
26
  export { type ReplayedHit, replayDamage } from './replayed-damage.js';
24
27
  export { type CatalogEntry, Dropper, dropperButtons } from './dropper.js';
28
+ export { type BoardPage, type BoardRead, type BoardRow, type BoardWindow, type MatchPlace, readBoard, reportMatch, reportScore, type ScoreOptions, } from './scores.js';
25
29
  export { decodeSpot, encodeSpot, LoadedSpot, loadSpot, type Placed, type Spot, type SpotObject, triggers, } from './spot.js';
26
30
  export { type ButtonProps, type Child, type Component, type Edges, type ElementProps, Fragment, type Gradient, type HeroLookName, type HeroProps, hide, hideHud, cursorFree, freeCursor, 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';
27
31
  /** LogPart is a value log writes as text. */
@@ -58,6 +62,19 @@ export declare function onStart(handler: (args: readonly string[]) => void): voi
58
62
  * included, on the next server frame.
59
63
  */
60
64
  export declare function onChat(handler: (line: ChatEvent) => void): void;
65
+ /**
66
+ * onPlayerJoin calls handler once for each player the mod serves when they
67
+ * are ready: a human who finished joining, a bot once added, and at start
68
+ * each player already in the game.
69
+ */
70
+ export declare function onPlayerJoin(handler: (joined: PlayerJoinedEvent) => void): void;
71
+ /**
72
+ * onPlayerLeave calls handler once for each joined player who leaves the mod,
73
+ * with the reason the server dropped them when it gave one. A player who
74
+ * disconnects still has their slot and hero during the call. A player the
75
+ * mod stops serving leaves too, with disconnected false.
76
+ */
77
+ export declare function onPlayerLeave(handler: (left: PlayerLeftEvent) => void): void;
61
78
  /** onFrame calls handler once per server frame. */
62
79
  export declare function onFrame(handler: (frame: FrameEvent) => void): void;
63
80
  /**