@kingdomsconnected/types 1.5.6 → 1.5.7

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.
@@ -1,4 +1,4 @@
1
- import type { Color, EventHandler, KeyHandler, MessageHandler, MessageReply, NativeClipHandler, NativeElementHandler, NativeScreenHandler, PlacementHandler, Quaternion, Unsubscribe, Vector2, Vector3, WebEventHandler } from "../shared.js";
1
+ import type { ActionHintHandler, Color, EventHandler, KeyHandler, MessageHandler, MessageReply, NativeClipHandler, NativeElementHandler, NativeScreenHandler, PlacementHandler, Quaternion, Unsubscribe, Vector2, Vector3, WebEventHandler } from "../shared.js";
2
2
 
3
3
  declare global {
4
4
  /**
@@ -94,6 +94,11 @@ declare global {
94
94
  */
95
95
  bookClosed: [bookId: number, reason: "player" | "script" | "failed" | "sessionOver"];
96
96
 
97
+ /**
98
+ * Dispatched once for every creator, on this machine only, whatever ended it. `appearance` is the look the player accepted, and null for every other ending. `reason` is `accepted`, `cancelled` for the player backing out, `closed` for `CharacterCreator.close`, `replaced` for another `CharacterCreator.open`, `unavailable` when the stage could not be put up, and `interrupted` when the session or the body went away under it. Nothing is put on the body: send the look wherever it should go -- `Events.emitServer`, then `player.setAppearance` on the server -- or open the next creator straight from the handler.
99
+ */
100
+ characterCreatorClosed: [appearance: Appearance | null, reason: "accepted" | "cancelled" | "closed" | "replaced" | "unavailable" | "interrupted"];
101
+
97
102
  /**
98
103
  * Dispatched after a resource entry point has run and immediately before the resource becomes running.
99
104
  */
@@ -2795,6 +2800,102 @@ declare global {
2795
2800
  image(path: string): string;
2796
2801
  };
2797
2802
 
2803
+ /**
2804
+ * What `CharacterCreator.open` shows.
2805
+ */
2806
+ interface CharacterCreatorOptions {
2807
+ /**
2808
+ * The look the stage starts on. Left out, it starts on the first gender offered with every part left to the figure -- the player's own look on the man, the game's default on the woman.
2809
+ */
2810
+ appearance: Appearance | undefined;
2811
+
2812
+ /**
2813
+ * Which bodies the player may choose between; `both` (the default) lets them switch.
2814
+ */
2815
+ genders: "male" | "female" | "both" | undefined;
2816
+
2817
+ /**
2818
+ * The panel's heading, at most 64 bytes. Defaults to `Character`.
2819
+ */
2820
+ title: string | undefined;
2821
+ }
2822
+
2823
+ /**
2824
+ * The game's own character stage, for the local player to choose how they look.
2825
+ *
2826
+ * Opens the pause screen on its character page, hides the page's own panels and stands a panel of tabs -- body, face, hair, beard -- beside a figure the player dresses and turns. The keys are listed on the panel, named as the game names them.
2827
+ *
2828
+ * Client-only and local: it changes nothing anywhere. `characterCreatorClosed` reports what the player accepted, and the resource decides what that means.
2829
+ */
2830
+ const CharacterCreator: {
2831
+ /**
2832
+ * Opens a creator, ending one already open as `replaced`. The stage goes up on the next ticks; one that cannot ends as `unavailable`.
2833
+ * @param options What to show.
2834
+ * @returns True. Malformed options throw.
2835
+ */
2836
+ open(options?: CharacterCreatorOptions): boolean;
2837
+
2838
+ /**
2839
+ * Ends the open creator as `closed`.
2840
+ * @returns False when none was open.
2841
+ */
2842
+ close(): boolean;
2843
+
2844
+ /**
2845
+ * Whether a creator is open or going up.
2846
+ * @returns True from `open` until its `characterCreatorClosed`.
2847
+ */
2848
+ isOpen(): boolean;
2849
+ };
2850
+
2851
+ /**
2852
+ * "Press [key] to ..." hints, drawn by the game's own HUD beside its own, with a handler run when the player presses the key.
2853
+ *
2854
+ * A hint names one of the game's keys by its control -- `primary_action`, `jump` and the rest of `keys()` -- and never a physical key: the glyph is whatever the player has bound to that control, keyboard or pad, and follows a rebind. A press hint fires on the press; a hold hint draws the game's ring and fires once it fills.
2855
+ *
2856
+ * Hints are drawn while the player is in control of their character, on foot or in the saddle, and the game takes them down in dialogue, minigames and menus. Two hints on one key stack: the newest is drawn and gets the press, and removing it brings back the one under it. A hint does not stop the game's own action on that key -- put a hint on `primary_action` and the player still interacts with whatever they look at.
2857
+ *
2858
+ * Client-only and local: a hint is shown to the player at this machine. Hints go when the resource that made them stops.
2859
+ */
2860
+ const ActionHint: {
2861
+ /**
2862
+ * Puts a hint up. It is drawn from the next frame the player is in control.
2863
+ * @param options `key` is one of `keys()`. `text` is what the HUD writes beside the key, as written, at most 256 bytes. `mode` is "press" by default. `holdDuration` is how long a hold hint's ring takes to fill, 0.2 to 10 seconds, 1 by default. `enabled` false draws the hint greyed out and keeps the handler from running.
2864
+ * @param handler Run with the hint's id each time it fires.
2865
+ * @returns The hint's id. Throws when an option is out of range or the key is not one of `keys()`.
2866
+ */
2867
+ create(options: { key: string; text: string; mode?: "press" | "hold"; holdDuration?: number; enabled?: boolean }, handler: ActionHintHandler): number;
2868
+
2869
+ /**
2870
+ * Rewrites a hint's text in place.
2871
+ * @param hint An id from `create`.
2872
+ * @param text The new text, as written, at most 256 bytes.
2873
+ * @returns False when the hint is gone or the text is too long.
2874
+ */
2875
+ setText(hint: number, text: string): boolean;
2876
+
2877
+ /**
2878
+ * Greys a hint out, or brings it back.
2879
+ * @param hint An id from `create`.
2880
+ * @param enabled False greys the hint out and its handler stops running.
2881
+ * @returns False when the hint is gone.
2882
+ */
2883
+ setEnabled(hint: number, enabled: boolean): boolean;
2884
+
2885
+ /**
2886
+ * Takes a hint down for good.
2887
+ * @param hint An id from `create`.
2888
+ * @returns False when it was already gone.
2889
+ */
2890
+ remove(hint: number): boolean;
2891
+
2892
+ /**
2893
+ * The controls a hint can be put on.
2894
+ * @returns Control names, in a fixed order.
2895
+ */
2896
+ keys(): string[];
2897
+ };
2898
+
2798
2899
  /**
2799
2900
  * Mutable two-dimensional vector.
2800
2901
  */
@@ -275,7 +275,7 @@ declare global {
275
275
  cartEntering: [cart: Cart, player: Player, seat: string];
276
276
 
277
277
  /**
278
- * Dispatched after a player is given a seat. `seat` is `driver` or `back`; a driver's client runs the cart from here on.
278
+ * Dispatched after a player is given a seat, named as in `cart.seats`; the `driver` seat's client runs the cart from here on.
279
279
  */
280
280
  cartEnter: [cart: Cart, player: Player | null, seat: string];
281
281
 
@@ -325,7 +325,7 @@ declare global {
325
325
  npcDestroy: [npc: Npc];
326
326
 
327
327
  /**
328
- * Dispatched when an NPC finishes what it was told to do. `status` is `reached` when it arrived, `blocked` when it could not make progress, or `failed` when the order could not be carried out at all. A patrol steps on this event, so a handler that re-orders the NPC here replaces the route rather than racing it.
328
+ * Dispatched once when an NPC finishes what it was told to do. `status` is `reached` when it arrived, `blocked` when it could not make progress, or `failed` when the order could not be carried out at all, or when a patrol gives up. Server-planned intermediate corners do not raise this event, and neither does a change of simulator: a finished order is not reported twice. A follow, which never finishes, raises `reached` the first time it catches up and again only after a change of simulator. A patrol steps on this event, so a handler that re-orders the NPC here replaces the route rather than racing it.
329
329
  */
330
330
  npcIntentDone: [npc: Npc, status: string];
331
331
 
@@ -2910,6 +2910,16 @@ declare global {
2910
2910
  */
2911
2911
  readonly pace: string;
2912
2912
 
2913
+ /**
2914
+ * The names of this cart's seats, the reins first: six on a wagon, three on the two-wheeler.
2915
+ */
2916
+ readonly seats: string[];
2917
+
2918
+ /**
2919
+ * The fastest the driver may take it urged on (the trot key held), in metres a second, 0 to 15; 7 by default. Unurged the team trots at 3.6 or this, whichever is less. A value outside the range is ignored.
2920
+ */
2921
+ maxSpeed: number;
2922
+
2913
2923
  /**
2914
2924
  * Formats this cart handle for logging and debugging.
2915
2925
  * @returns The cart ID, its blueprint, its driver and its pace.
@@ -2924,7 +2934,7 @@ declare global {
2924
2934
  /**
2925
2935
  * Puts a player in a seat. They are taken out of any cart they were in, their own game walks them to the seat and climbs in, and `cartEnter` follows; the driver's client runs the cart from then on. `cartEntering` handlers are asked first.
2926
2936
  * @param player The player to seat.
2927
- * @param seat `driver` (the bench, holding the reins) or `back` (the right rail): the two seats the game animates a player in.
2937
+ * @param seat One of the cart's `seats`. A wagon has `driver` (the reins, on the bench's left), `bench` (beside them), `rightBack`, `leftBack`, `rightFront` and `leftFront` (on the rails); the two-wheeler `driver`, `rightBack` and `leftBack`.
2928
2938
  * @returns Whether the player was seated: false for a taken seat, a player that is not connected, or a handler's refusal.
2929
2939
  */
2930
2940
  putPlayer(player: Player, seat: string): boolean;
@@ -2938,7 +2948,7 @@ declare global {
2938
2948
 
2939
2949
  /**
2940
2950
  * Who sits in a seat.
2941
- * @param seat `driver` or `back`.
2951
+ * @param seat One of the cart's `seats`.
2942
2952
  * @returns The player in it, or null when it is empty.
2943
2953
  */
2944
2954
  getOccupant(seat: string): Player | null;
@@ -2946,12 +2956,12 @@ declare global {
2946
2956
  /**
2947
2957
  * Where a player sits in this cart.
2948
2958
  * @param player The player to look for.
2949
- * @returns `driver` or `back`, or null when they are not in it.
2959
+ * @returns The seat's name, one of `seats`, or null when they are not in it.
2950
2960
  */
2951
2961
  seatOf(player: Player): string | null;
2952
2962
 
2953
2963
  /**
2954
- * Moves the cart outright, with everyone in it: every client rebuilds it on a new short road at the new pose, and a driver carries on from there.
2964
+ * Moves the cart outright, standing, with everyone in it; a driver carries on from there.
2955
2965
  * @param position Where the cart's front axle stands.
2956
2966
  * @param rotation Which way it faces; omitted keeps its heading.
2957
2967
  * @returns False for a pose that is not finite.
@@ -2959,7 +2969,7 @@ declare global {
2959
2969
  teleport(position: Vector3, rotation?: Vector3 | Quaternion): boolean;
2960
2970
 
2961
2971
  /**
2962
- * Spawns and replicates a cart or wagon from the game's own prefabs, with its horses already in the shafts. It stands on a short straight road until somebody takes the reins.
2972
+ * Spawns and replicates a cart or wagon from the game's own prefabs, with its horses already in the shafts. It stands where it was put until somebody takes the reins.
2963
2973
  * @param blueprint Which of the game's cart prefabs to build; omitted builds `wagon_b_covered`. `Cart.blueprints()` lists them.
2964
2974
  * @param position Where the cart's front axle stands; omitted components default to zero.
2965
2975
  * @param rotation Which way it faces: a Quaternion, or a Vector3 of Euler angles in degrees.
@@ -3557,9 +3567,7 @@ declare global {
3557
3567
  lootable: boolean;
3558
3568
 
3559
3569
  /**
3560
- * How the simulating client moves this body.
3561
- *
3562
- * `kinematic` (the default) advances the pose and lets every client animate it -- predictable, and the same path every remote player's body already runs on. `native` hands the destination to the game's own movement controller, which walks the body with real footfalls and real turns but will walk into whatever the engine does not route around. Pick `native` for bodies in the open and `kinematic` for anything on an authored route.
3570
+ * How the client simulator moves the body. `native` (default) uses the game's movement controller and walk animations. `kinematic` moves the body directly without walk animation. Neither finds a way around anything: the game's movement controller steers straight at the point it is given. Routes come from server pathfinding, which hands either mode mesh corners -- see `moveTo`.
3563
3571
  */
3564
3572
  locomotion: string;
3565
3573
 
@@ -3569,7 +3577,7 @@ declare global {
3569
3577
  readonly intent: string;
3570
3578
 
3571
3579
  /**
3572
- * What the simulating client last reported about the current intent: `idle`, `running`, `reached`, `blocked` or `failed`. A dormant NPC that is walking an authored route reports through the server's own dead reckoning instead, so a patrol keeps stepping with nobody there to watch it.
3580
+ * What has become of the current order: `idle`, `running`, `reached`, `blocked` or `failed`. A move reads `running` from the moment it is given -- while its route is planned and while it walks the route's corners -- until it ends, and then the outcome `npcIntentDone` announced, which stays until the next order. A follow reads `reached` while it is within its radius. Dormant moves in `auto` or `server` mode are carried out and decided by the server; dormant `game` moves wait for a client simulator.
3573
3581
  */
3574
3582
  readonly status: string;
3575
3583
 
@@ -3653,23 +3661,31 @@ declare global {
3653
3661
  hold(): void;
3654
3662
 
3655
3663
  /**
3656
- * Sends the NPC somewhere and raises `npcIntentDone` when it arrives, cannot get there, or gives up. Cancels any patrol.
3664
+ * Moves to `position`, cancels any patrol, and emits `npcIntentDone` once when the move ends.
3665
+ *
3666
+ * The game's own movement steers a body straight at the point it is given and finds no way around anything, so routes come from the server's navigation mesh. The server plans the route and hands the simulating client one corner at a time, the next before the body reaches the last, so it walks through bends without stopping; a dormant NPC is walked along the same route by the server. Routes only use doorways whose door stands open.
3667
+ *
3668
+ * `auto` (the default) routes on the server whenever a mesh is loaded. Without one, a simulating client steers straight at `position` and a dormant NPC moves in a straight line. `game` steers straight at `position` and waits while dormant; if the body reports `blocked` and a mesh is loaded, the server tries a route before emitting `npcIntentDone`. `server` always routes on the server and throws without a loaded mesh, preserving the previous order.
3669
+ *
3670
+ * A missing or partial route ends with `blocked`, and a blocked route is not retried. Route plans are queued and spread over ticks; the move reads `running` meanwhile.
3657
3671
  * @param position Where to walk to.
3658
- * @param options `speed` is the pace to walk at; `radius` is how close counts as arrived, in metres.
3659
- * @returns True when the order went out.
3672
+ * @param options `speed` defaults to `walk`; `radius` is the arrival distance in metres (default 1.5). `pathfinding` defaults to `auto`.
3673
+ * @returns True when the order went out; false for an invalid NPC or destination.
3660
3674
  */
3661
- moveTo(position: Vector3 | Partial<Vector3>, options?: { speed?: 'walk' | 'jog' | 'run'; radius?: number }): boolean;
3675
+ moveTo(position: Vector3 | Partial<Vector3>, options?: { speed?: 'walk' | 'jog' | 'run'; radius?: number; pathfinding?: 'auto' | 'game' | 'server' }): boolean;
3662
3676
 
3663
3677
  /**
3664
- * Walks a route, one waypoint at a time. The route stays on the server and only the waypoint being walked to is ever replicated, so a player who joins mid-patrol sees one move rather than a plan to catch up with -- and a patrol nobody is near enough to simulate keeps advancing on the server's own reckoning.
3678
+ * Walks the waypoints in order. The server stores the route and replicates the current target. `npcIntentDone` fires once per leg, after its final mesh corner or a movement failure.
3679
+ *
3680
+ * A leg that ends `blocked` or `failed` is skipped after at least 2 seconds. When every leg of a lap has failed in a row, the patrol is abandoned and that last leg reports `failed` instead.
3665
3681
  * @param points The waypoints, in order.
3666
- * @param options `loop` walks the route forever (the default); `waitSeconds` is how long to stand at each waypoint; `speed` is the pace.
3667
- * @returns True when the route was accepted; false for an empty route or a point that is not finite.
3682
+ * @param options `loop` defaults to true; `waitSeconds` is the wait at each waypoint, 0 to 3600 (default 0); `speed` defaults to `walk`. `pathfinding` uses the modes documented for `moveTo` and applies to every leg.
3683
+ * @returns True when the route was accepted; false for an empty route, more than 256 waypoints, a waypoint that is not finite or lies outside the world, or a `waitSeconds` that is not a number. Throws if server mode has no loaded mesh, leaving the previous order intact.
3668
3684
  */
3669
- patrol(points: (Vector3 | Partial<Vector3>)[], options?: { speed?: 'walk' | 'jog' | 'run'; loop?: boolean; waitSeconds?: number }): boolean;
3685
+ patrol(points: (Vector3 | Partial<Vector3>)[], options?: { speed?: 'walk' | 'jog' | 'run'; loop?: boolean; waitSeconds?: number; pathfinding?: 'auto' | 'game' | 'server' }): boolean;
3670
3686
 
3671
3687
  /**
3672
- * Keeps the NPC near somebody as they move.
3688
+ * Keeps the NPC near somebody as they move, steering straight at them. `npcIntentDone` reports `reached` the first time it catches up, and the follow carries on. If the body reports `blocked`, a loaded mesh lets the server route to the target's current position before reporting it. After recovery it resumes following the moving target.
3673
3689
  * @param target Who to follow, as a handle or a network ID.
3674
3690
  * @param options `radius` is how close it tries to stay, in metres; `speed` is the pace.
3675
3691
  * @returns True when the order went out.
@@ -3677,7 +3693,7 @@ declare global {
3677
3693
  follow(target: Player | Npc | number, options?: { speed?: 'walk' | 'jog' | 'run'; radius?: number }): boolean;
3678
3694
 
3679
3695
  /**
3680
- * Sends the NPC away from a place. The one intent that picks its own direction.
3696
+ * Sends the NPC straight away from a place until the requested distance separates them. If the body reports `blocked`, a loaded mesh lets the server try a route to a point past that distance, on the ground at the NPC's own height, before reporting it.
3681
3697
  * @param from What to run away from.
3682
3698
  * @param options `radius` is how far away is far enough; `speed` is the pace, `run` by default.
3683
3699
  * @returns True when the order went out.
@@ -5213,6 +5229,129 @@ declare global {
5213
5229
  entities: WorldNearbyEntity[];
5214
5230
  }
5215
5231
 
5232
+ /**
5233
+ * A walk across the mesh.
5234
+ */
5235
+ interface NavigationPath {
5236
+ /**
5237
+ * The corners to walk through, first the point on the mesh nearest `from`. Straight lines between them stay on the mesh.
5238
+ */
5239
+ points: Vector3[];
5240
+
5241
+ /**
5242
+ * Whether it reaches `to`. False when `to` cannot be reached, and the path then ends at the nearest point the mesh allows.
5243
+ */
5244
+ complete: boolean;
5245
+
5246
+ /**
5247
+ * Its length in metres.
5248
+ */
5249
+ length: number;
5250
+ }
5251
+
5252
+ /**
5253
+ * How far a straight walk across the mesh gets.
5254
+ */
5255
+ interface NavigationRay {
5256
+ /**
5257
+ * Whether the edge of the mesh -- a wall, a drop, a locked door -- stops it before `to`.
5258
+ */
5259
+ hit: boolean;
5260
+
5261
+ /**
5262
+ * Where it stops: the edge, or the point on the mesh under `to`.
5263
+ */
5264
+ point: Vector3;
5265
+ }
5266
+
5267
+ /**
5268
+ * Queries the level's navigation mesh on the server. The mesh includes walkable floors, bridges and stairs.
5269
+ *
5270
+ * Copy the game's `Data/Levels/<level>/recast.pak` to the server's `files/<level>/` directory. The server searches `files/` recursively at startup. An optional `mod.navmesh` in `server.json` takes priority and can name a game install, level folder or pak file. The game data must be supplied separately. Without a mesh, `ready` is false and geometry queries return null or false. Points are world-space metres, Z up. Every query takes an optional options object. `searchRadius` and `searchHeight` limit how far a point may be from the mesh, across the ground and up or down: 2 metres by default, up to 64, and 4 by default, up to 128. Keep `searchHeight` under a storey's height, or a point on one floor snaps to the floor above. `doors` picks which doors a query walks through: `unlocked`, the default, is how an NPC treats a door -- open or shut, it goes through unless the door is locked; `open` only through doors that stand open; `any` ignores locks; `none` treats every doorway as a wall. A door's state is read off the door in the global world. A field given with the wrong type or out of range throws.
5271
+ */
5272
+ const Navigation: {
5273
+ /**
5274
+ * Whether a mesh loaded from `mod.navmesh` or the server's `files/` directory. False when no usable copy is found; the server log gives the reason.
5275
+ */
5276
+ readonly ready: boolean;
5277
+
5278
+ /**
5279
+ * Available overlay names, sorted. Overlays contain replacement navigation data for quest states. Enabling one replaces the covered part of the mesh. Empty without a mesh.
5280
+ */
5281
+ readonly overlays: string[];
5282
+
5283
+ /**
5284
+ * Enabled overlays in activation order. Initially empty; the level starts with its base mesh.
5285
+ */
5286
+ readonly activeOverlays: string[];
5287
+
5288
+ /**
5289
+ * Snaps a point to the nearest walkable surface.
5290
+ * @param point The point to snap; omitted components default to zero.
5291
+ * @param options How far to look, and which doors count.
5292
+ * @returns The nearest point within the search limits, or null when none is found or no mesh is loaded.
5293
+ */
5294
+ closestPoint(point: Vector3 | Partial<Vector3>, options?: { searchRadius?: number; searchHeight?: number; doors?: "unlocked" | "open" | "any" | "none" }): Vector3 | null;
5295
+
5296
+ /**
5297
+ * Returns the height of the nearest walkable surface, including upper floors, bridges and stairs.
5298
+ * @param point The point to measure; omitted components default to zero. Its z estimates the floor height and selects the storey.
5299
+ * @param options How far to look.
5300
+ * @returns The height in metres, or null when none is found or no mesh is loaded.
5301
+ */
5302
+ floorAt(point: Vector3 | Partial<Vector3>, options?: { searchRadius?: number; searchHeight?: number; doors?: "unlocked" | "open" | "any" | "none" }): number | null;
5303
+
5304
+ /**
5305
+ * Plans a path around obstacles on the mesh. Plan when a destination changes; avoid recalculating every NPC's path each tick.
5306
+ * @param from Where the walk starts; omitted components default to zero.
5307
+ * @param to Where it should end; omitted components default to zero.
5308
+ * @param options How far to look for each end, and which doors to walk through.
5309
+ * @returns The path, or null when an endpoint cannot be found, the query fails or no mesh is loaded. A partial path has `complete: false`.
5310
+ */
5311
+ findPath(from: Vector3 | Partial<Vector3>, to: Vector3 | Partial<Vector3>, options?: { searchRadius?: number; searchHeight?: number; doors?: "unlocked" | "open" | "any" | "none" }): NavigationPath | null;
5312
+
5313
+ /**
5314
+ * Checks reachability by calling `findPath`.
5315
+ * @param from Where the walk starts; omitted components default to zero.
5316
+ * @param to Where it should end; omitted components default to zero.
5317
+ * @param options How far to look for each end, and which doors to walk through.
5318
+ * @returns True when a complete path exists; false otherwise, including when no mesh is loaded.
5319
+ */
5320
+ canReach(from: Vector3 | Partial<Vector3>, to: Vector3 | Partial<Vector3>, options?: { searchRadius?: number; searchHeight?: number; doors?: "unlocked" | "open" | "any" | "none" }): boolean;
5321
+
5322
+ /**
5323
+ * Checks a straight line across the mesh and reports where it stops.
5324
+ * @param from Where the walk starts; omitted components default to zero.
5325
+ * @param to Where it heads; only its x and y are used, the walk follows the surface.
5326
+ * @param options How far to look for `from`, and which doors let the walk through.
5327
+ * @returns The result, or null when `from` is off the mesh, the query fails or no mesh is loaded.
5328
+ */
5329
+ raycast(from: Vector3 | Partial<Vector3>, to: Vector3 | Partial<Vector3>, options?: { searchRadius?: number; searchHeight?: number; doors?: "unlocked" | "open" | "any" | "none" }): NavigationRay | null;
5330
+
5331
+ /**
5332
+ * Returns a random walkable point reachable from `center` and no further from it across the ground than `radius`. A point drawn outside the circle is drawn again, a bounded number of times. Without a centre, samples the whole level, choosing each tile with equal probability.
5333
+ * @param center The point to scatter around; it has to be on the mesh, and omitted components default to zero. Omitted entirely, the point can be anywhere on the level's mesh; pass `undefined` for it and for `radius` to give options.
5334
+ * @param radius How far from `center`, in metres, up to 512. Required with a centre.
5335
+ * @param options How far to look for `center`, and which doors the point may lie behind.
5336
+ * @returns The point, or null when `center` is off the mesh, no draw lands within `radius`, the query fails or no mesh is loaded.
5337
+ */
5338
+ randomPoint(center?: Vector3 | Partial<Vector3>, radius?: number, options?: { searchRadius?: number; searchHeight?: number; doors?: "unlocked" | "open" | "any" | "none" }): Vector3 | null;
5339
+
5340
+ /**
5341
+ * Enables an overlay. Where overlays overlap, the last enabled takes precedence. Subsequent queries use the updated mesh.
5342
+ * @param name An entry of `overlays`.
5343
+ * @returns False for a name the level does not ship, one already enabled, one whose tiles cannot be read or loaded (the server log says why), or without a mesh.
5344
+ */
5345
+ enableOverlay(name: string): boolean;
5346
+
5347
+ /**
5348
+ * Disables an overlay, restoring the previous enabled overlay or the base mesh in that area.
5349
+ * @param name An entry of `activeOverlays`.
5350
+ * @returns False for a name that is not enabled, or when part of the area could not be restored (the server log says why); the overlay is disabled either way.
5351
+ */
5352
+ disableOverlay(name: string): boolean;
5353
+ };
5354
+
5216
5355
  /**
5217
5356
  * What the game's own tables say about one status effect.
5218
5357
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingdomsconnected/types",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "TypeScript declarations for the Kingdoms Connected scripting API, one entry per side: @kingdomsconnected/types/server and @kingdomsconnected/types/client",
5
5
  "license": "UNLICENSED",
6
6
  "keywords": [
package/shared.d.ts CHANGED
@@ -10,6 +10,9 @@
10
10
  * inline `(...) => ...`, so a handler parameter has nowhere else it can be spelled.
11
11
  */
12
12
 
13
+ /** Handler for an `ActionHint`, given the id `ActionHint.create` returned for it. */
14
+ export type ActionHintHandler = (hint: number) => void;
15
+
13
16
  /** Handler for an event raised through the framework event bus. A returned promise is awaited, so a handler may be async. */
14
17
  export type EventHandler = (...args: unknown[]) => unknown | Promise<unknown>;
15
18