@modlock/modlock 0.1.64 → 0.1.68

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/host.gen.d.ts CHANGED
@@ -18,6 +18,15 @@ export type FieldType = 'bool' | 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16'
18
18
  export type PickupKind = 'urn' | 'movementBuff';
19
19
  /** MovementAction is a movement fact the game announced for a hero. */
20
20
  export type MovementAction = 'landed' | 'ziplineAttached' | 'groundDash' | 'slide' | 'bouncePad' | 'dashJump' | 'airJump' | 'wallJump' | 'airDash' | 'meleeStarted' | 'abilityExecuted';
21
+ /**
22
+ * InteractionKind names how a hero completed an interaction with a map object.
23
+ */
24
+ export type InteractionKind = 'pickupCollected' | 'propBroken';
25
+ /**
26
+ * Lane is one of the map's lanes, numbered as the game numbers them. The
27
+ * three-lane map has yellow, blue and purple ziplines and no green.
28
+ */
29
+ export type Lane = 'none' | 'yellow' | 'green' | 'blue' | 'purple';
21
30
  /** TextAlign places text across its position. */
22
31
  export type TextAlign = 'left' | 'center' | 'right';
23
32
  /** TextVerticalAlign places text up and down its position. */
@@ -62,6 +71,8 @@ export interface Ability {
62
71
  * one.
63
72
  */
64
73
  readonly rechargeEnd: number;
74
+ /** imbues names the abilities an imbuing item strengthens. */
75
+ readonly imbues: string[];
65
76
  }
66
77
  /** AbilityOptions changes one ability of a player's hero. */
67
78
  export interface AbilityOptions {
@@ -462,6 +473,44 @@ export interface MovementSample {
462
473
  * sample, absent before the game ran any of it.
463
474
  */
464
475
  readonly command?: MovementCommand;
476
+ /**
477
+ * interactions are the map objects the hero collected or broke since the
478
+ * last tick, as the game's own completion named the hero. A hero who stood
479
+ * by, or only benefited from another's pickup, has none.
480
+ */
481
+ readonly interactions: Interaction[];
482
+ }
483
+ /** Interaction is one completed interaction with a map object. */
484
+ export interface Interaction {
485
+ readonly kind?: InteractionKind;
486
+ /**
487
+ * entity is the object's entity handle, which names it within this world
488
+ * only; origin and the names identify it across sessions.
489
+ */
490
+ readonly entity: number;
491
+ /**
492
+ * designerName is the object's entity class, such as citadel_pickup_health,
493
+ * and subclassId the hash of its subclass, such as the healing bat's
494
+ * citadel_pickup_health_float_in_world.
495
+ */
496
+ readonly designerName: string;
497
+ readonly subclassId: number;
498
+ /**
499
+ * origin is where the object stood before the interaction moved it: a
500
+ * vacuumed pickup's position as its vacuum began, otherwise its origin.
501
+ */
502
+ readonly origin: Vector;
503
+ /**
504
+ * vacuumStart is the game time the pickup began flying to the hero, absent
505
+ * for a pickup collected on touch and for a prop. The interaction itself
506
+ * completed on the sample's tick.
507
+ */
508
+ readonly vacuumStart?: number;
509
+ /**
510
+ * inflictor is the entity that broke a prop, such as the hero's projectile,
511
+ * or zero.
512
+ */
513
+ readonly inflictor: number;
465
514
  }
466
515
  /**
467
516
  * MovementCommand is the movement a player commanded over one tick. The
@@ -1059,6 +1108,17 @@ export interface SettingChangedEvent {
1059
1108
  /** value is the new value. */
1060
1109
  readonly value: string;
1061
1110
  }
1111
+ /**
1112
+ * Wheel reports one wheel step over a slider, anchored to its pointer position.
1113
+ */
1114
+ export interface Wheel {
1115
+ /**
1116
+ * delta is 1 for up and -1 for down. It never changes the slider's value.
1117
+ */
1118
+ readonly delta: number;
1119
+ /** fraction is the pointer's horizontal position, bounded from 0 to 1. */
1120
+ readonly fraction: number;
1121
+ }
1062
1122
  /** UiPressEvent reports a press on a button in a player's interface. */
1063
1123
  export interface UiPressEvent {
1064
1124
  /** player is the player who pressed. */
@@ -1076,7 +1136,7 @@ export interface UiInputEvent {
1076
1136
  /** node is the id of the input. */
1077
1137
  readonly node: string;
1078
1138
  /** value is the input's new value, in the kind its control holds. */
1079
- readonly value?: string | number | boolean | number;
1139
+ readonly value?: string | number | boolean | number | Wheel;
1080
1140
  }
1081
1141
  /** StartEvent describes the server the mod starts in. */
1082
1142
  export interface StartEvent {
@@ -1117,6 +1177,12 @@ export interface FrameEvent {
1117
1177
  * new tick, and is empty otherwise.
1118
1178
  */
1119
1179
  readonly movement: MovementSample[];
1180
+ /**
1181
+ * interactions names the interaction kinds the host observes, sent with
1182
+ * movement. A kind it lacks, such as on a game build whose completion it
1183
+ * cannot find, is unknown rather than absent from the samples.
1184
+ */
1185
+ readonly interactions: InteractionKind[];
1120
1186
  }
1121
1187
  /**
1122
1188
  * CommandEvent carries one command line from a player: a chat line that
@@ -1316,9 +1382,11 @@ export declare class Player {
1316
1382
  setAbility(options: AbilityOptions): boolean;
1317
1383
  /**
1318
1384
  * giveItem gives the hero an item, enabled and free. A hero that owns it
1319
- * keeps its one copy.
1385
+ * keeps its one copy. With imbue, an imbuing item strengthens the hero's
1386
+ * ability in that slot, 0 to 3, as the shop asks when one is bought; the
1387
+ * call fails, granting nothing, when the ability does not accept it.
1320
1388
  */
1321
- giveItem(item: string): boolean;
1389
+ giveItem(item: string, imbue?: number): boolean;
1322
1390
  /**
1323
1391
  * replaceAbility puts the ability named ability, untrained, in the hero's
1324
1392
  * ability slot index, as Ability.slot, removing the ability there. An
@@ -1329,18 +1397,21 @@ export declare class Player {
1329
1397
  */
1330
1398
  replaceAbility(index: number, ability: string): boolean;
1331
1399
  /**
1332
- * holdModifier keeps an ability's modifier, named "<ability>/<modifier>",
1333
- * on the hero with no expiry, giving it back whenever the game removes it
1334
- * or the hero returns. The hero must own the ability or item. Every hero
1335
- * that gains the modifier from the same ability keeps it until the hold
1336
- * ends. Releasing leaves the hero's current modifier until it dies.
1400
+ * holdModifier keeps a modifier, named as GiveModifier names it, on the
1401
+ * hero with no expiry, giving it back whenever the game removes it or the
1402
+ * hero returns. Every hero that gains the modifier from the same ability
1403
+ * keeps it until the hold ends. Releasing leaves the hero's current
1404
+ * modifier until it dies.
1337
1405
  */
1338
1406
  holdModifier(modifier: string, active?: boolean): boolean;
1339
1407
  /**
1340
- * giveModifier gives the hero an ability's modifier, named
1341
- * "<ability>/<modifier>", for seconds, as if the hero's own ability applied
1342
- * it; a hero without that ability applies it with its first ability. The
1343
- * game may end it sooner, as invisibility ends on a shot.
1408
+ * giveModifier gives the hero a modifier for seconds. An ability's
1409
+ * modifier, named "<ability>/<modifier>", comes as if the hero's own
1410
+ * ability applied it; a hero without that ability, or a modifier named on
1411
+ * its own, such as Street Brawl's zipline boost
1412
+ * modifier_street_brawl_round_start_zipline_boost, applies it with the
1413
+ * hero's first ability. The game may end it sooner, as invisibility ends on
1414
+ * a shot.
1344
1415
  */
1345
1416
  giveModifier(modifier: string, seconds: number): boolean;
1346
1417
  /**
@@ -1349,6 +1420,14 @@ export declare class Player {
1349
1420
  * follows the hero.
1350
1421
  */
1351
1422
  teleport(position: Vector, facing: Angles, velocity?: Vector): boolean;
1423
+ /**
1424
+ * zipline puts the player's hero on a lane's zipline near the hero, riding
1425
+ * it as from the zipline key, with the zipline's intro. It never picks
1426
+ * another lane: it fails when the lane has no zipline the hero's team rides
1427
+ * on this map, or the hero has no zipline ability. For Street Brawl's fast
1428
+ * ride, give the hero modifier_street_brawl_round_start_zipline_boost too.
1429
+ */
1430
+ zipline(lane: Lane): boolean;
1352
1431
  /**
1353
1432
  * move carries the player's hero to a position as continuous motion,
1354
1433
  * as a recording plays back. Unlike Teleport it keeps the hero's animated
@@ -1491,7 +1570,9 @@ export declare class Npc {
1491
1570
  read(): NpcState | undefined;
1492
1571
  /**
1493
1572
  * move places the unit and sets its velocity, which drives its walk
1494
- * animation. It reports false once the unit is gone.
1573
+ * animation. It sets the pose without a teleport, which would reset the
1574
+ * unit's animation, so a mode can steer its units every frame. It reports
1575
+ * false once the unit is gone.
1495
1576
  */
1496
1577
  move(position: Vector, facing?: Angles, velocity?: Vector): boolean;
1497
1578
  /**
@@ -1544,7 +1625,7 @@ export declare function precache(options: PrecacheOptions): boolean;
1544
1625
  * data/. A file in neither reads as unset. Names that leave the mod's
1545
1626
  * directories are refused.
1546
1627
  */
1547
- export declare function readFile(name: string): string | undefined;
1628
+ export declare function readFile(path: string): string | undefined;
1548
1629
  /**
1549
1630
  * writeFile replaces one of the mod's files in the host's copy, which
1550
1631
  * outlives a restart and an update of the mod; the files the mod ships stay
@@ -1552,7 +1633,7 @@ export declare function readFile(name: string): string | undefined;
1552
1633
  * past its quota of 4 MiB per mod. A host that keeps no files refuses every
1553
1634
  * write.
1554
1635
  */
1555
- export declare function writeFile(name: string, text: string): boolean;
1636
+ export declare function writeFile(path: string, text: string): boolean;
1556
1637
  /**
1557
1638
  * holdReload keeps the running build through a reload while held is true,
1558
1639
  * such as while a player is partway through something a new build would
package/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { type CameraMove, type CameraPlayOptions, cameraPulse, type CameraPulseO
7
7
  export * as curve from './curve.js';
8
8
  export * as format from './format.js';
9
9
  export { findHero, findTitled, type Hero, heroes, type Titled, } from './heroes.js';
10
+ export { item, type Item, itemId, items, type Slot } from './items.js';
10
11
  export { Hook, type HookAbility, hookAbility, type HookPlayer, type HookRead, hookUpgrades, type ReadHandle, } from './hook.js';
11
12
  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
13
  export * as theme from './theme.js';
@@ -22,7 +23,7 @@ export { type HeroSnapshot, restoreHero } from './restore.js';
22
23
  export { type ReplayedHit, replayDamage } from './replayed-damage.js';
23
24
  export { type CatalogEntry, Dropper, dropperButtons } from './dropper.js';
24
25
  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
+ export { type ButtonProps, type Child, type Component, type Edges, type ElementProps, Fragment, type Gradient, type HeroLookName, type HeroProps, hide, hideHud, 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';
26
27
  /** LogPart is a value log writes as text. */
27
28
  export type LogPart = string | number | bigint | boolean | null | undefined;
28
29
  /**