@kingdomsconnected/types 1.5.5 → 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.
- package/generated/client-api.d.ts +214 -5
- package/generated/server-api.d.ts +266 -23
- package/package.json +1 -1
- package/shared.d.ts +3 -0
|
@@ -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
|
*/
|
|
@@ -909,6 +914,8 @@ declare global {
|
|
|
909
914
|
|
|
910
915
|
/**
|
|
911
916
|
* The game's own HUD messages, shown to the player at this machine. Nothing here is replicated: a message everyone should see is sent to everyone, and each client shows it. Every message call returns false while there is no HUD, which is the case in the main menu and across a level load.
|
|
917
|
+
*
|
|
918
|
+
* The screen-effect verbs -- `addScreenEffect` and its siblings -- put full-screen post effects on this player's own picture. They are drawn by the game's renderer rather than the HUD, so they need no HUD and hiding HUD elements leaves them alone.
|
|
912
919
|
*/
|
|
913
920
|
const Hud: {
|
|
914
921
|
/**
|
|
@@ -1022,21 +1029,127 @@ declare global {
|
|
|
1022
1029
|
clearNotifications(): boolean;
|
|
1023
1030
|
|
|
1024
1031
|
/**
|
|
1025
|
-
*
|
|
1032
|
+
* Retains a visibility request for one HUD element, including before the HUD is ready. Hidden clips are suppressed before each HUD render, across movie and level reloads. Turning an element on releases multiplayer suppression; the current native HUD rules still apply. Suppression is released when its owning resource stops or the session ends. No console variables are changed.
|
|
1026
1033
|
* @param element The element, by the game's own name for it: `Stats` is the health, stamina and nourishment bars along the bottom. One of `Compass`, `Stats`, `QAMWeapon`, `QAMFood`, `Subtitles`, `InfoText`, `GameLog`, `Hints`, `DialogLeft`, `DialogRight`, `Cursor`, `Crime`, `Wanted`, `PopUpBackground`, `TutorialMessage`, `FancyEvent`, `SkillCheck`, `ItemTransfer`, `Buffs`, `CommonEvent`, `DiceCursor`, `Trespassing`, `RatioStrips`, `ShootingContest`, `Bubbles`, `TutorialInDialog`, `DiceContainer`, `Vignette`, compared exactly.
|
|
1027
1034
|
* @param visible False hides the element, true lets the game show it again.
|
|
1028
|
-
* @returns True when the
|
|
1035
|
+
* @returns True when the request is retained; application waits for the native HUD when it is not ready yet.
|
|
1029
1036
|
*/
|
|
1030
1037
|
setElementVisible(element: string, visible: boolean): boolean;
|
|
1031
1038
|
|
|
1032
1039
|
/**
|
|
1033
|
-
* Whether
|
|
1040
|
+
* Whether multiplayer permits the element to show. True when no resource suppresses it; native gameplay rules can still hide it. This is not a pixel-visibility query.
|
|
1034
1041
|
* @param element The element, by the game's own name for it, as `setElementVisible` takes it.
|
|
1035
|
-
* @returns True while the element
|
|
1042
|
+
* @returns True while multiplayer allows the element to show.
|
|
1036
1043
|
*/
|
|
1037
1044
|
isElementVisible(element: string): boolean;
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Every effect `addScreenEffect` accepts, with each parameter's range, default and neutral value.
|
|
1048
|
+
* @returns The effects, in a fixed order.
|
|
1049
|
+
*/
|
|
1050
|
+
screenEffects(): ScreenEffect[];
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Puts a full-screen effect on this player's own picture -- a colour grade, a blur, ghosting or the game's blood overlay, for intoxication, injury, poison, dreams or a place that should feel wrong -- owned by the calling resource. These are the game's own post-processing passes, driven with the parameters this build actually reads; they are not part of the HUD and showing or hiding HUD elements does not touch them.
|
|
1054
|
+
*
|
|
1055
|
+
* This is presentation, not state. Nothing is replicated, nobody else sees it, and none of it makes a player drunk or hurt: whatever decides that -- usually the server -- keeps it, and a client script asks for the picture to match. Weather and time of day are shared world state and are not touched.
|
|
1056
|
+
*
|
|
1057
|
+
* Effects from every resource combine rather than overwrite each other, on top of the game's own grade -- which already desaturates the screen as health runs low -- rather than in its place: brightness, contrast and saturation multiply, the colour cast and the hue shift add, and blur, ghosting and blood each draw the strongest one asked for. The result does not depend on which resource asked first, and removing one effect leaves the game's grade and every other effect as they were.
|
|
1058
|
+
*
|
|
1059
|
+
* An effect belongs to the resource that created it: only that resource can change or remove it, and it goes when the resource stops, when the session ends or when the level changes. A cinematic that resets the game's post-processing clears the screen until the effect next changes. Up to 64 effects are kept across every resource.
|
|
1060
|
+
* @param effect Which effect, as `screenEffects` names it.
|
|
1061
|
+
* @param params Values for the effect's own parameters, each clamped into its range. A parameter left out takes its default; one the effect does not take is an error.
|
|
1062
|
+
* @param options `fadeInMs` brings it up from nothing; `fadeOutMs` is how long it takes to go, when its duration runs out or when `removeScreenEffect` is called without a fade of its own; `durationMs` ends it on its own after that long, before its fade-out -- 0, the default, keeps it until it is removed. Fades are up to a minute.
|
|
1063
|
+
* @returns A handle for `updateScreenEffect`, `removeScreenEffect` and `isScreenEffectActive`, or 0 when 64 effects are already on screen.
|
|
1064
|
+
*/
|
|
1065
|
+
addScreenEffect(effect: "colorGrade" | "blur" | "ghosting" | "screenBlood", params?: { saturation?: number; brightness?: number; contrast?: number; cyan?: number; magenta?: number; yellow?: number; darkness?: number; hue?: number; amount?: number }, options?: { fadeInMs?: number; fadeOutMs?: number; durationMs?: number }): number;
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Changes an effect while it is on screen -- a drunkenness that deepens with every drink, a wound that worsens.
|
|
1069
|
+
* @param handle What `addScreenEffect` returned.
|
|
1070
|
+
* @param params New values for some of the effect's parameters. The others keep theirs.
|
|
1071
|
+
* @param options `fadeMs` moves the parameters to their new values over that long, from wherever they are now; 0, the default, moves them at once.
|
|
1072
|
+
* @returns False when the handle is gone or belongs to another resource.
|
|
1073
|
+
*/
|
|
1074
|
+
updateScreenEffect(handle: number, params: { saturation?: number; brightness?: number; contrast?: number; cyan?: number; magenta?: number; yellow?: number; darkness?: number; hue?: number; amount?: number }, options?: { fadeMs?: number }): boolean;
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Takes an effect off the screen. An effect already fading out carries on from where it is.
|
|
1078
|
+
* @param handle What `addScreenEffect` returned.
|
|
1079
|
+
* @param options How long it takes to fade out. Left out, it fades over the `fadeOutMs` it was created with; 0 takes it off at once.
|
|
1080
|
+
* @returns False when the handle is gone or belongs to another resource.
|
|
1081
|
+
*/
|
|
1082
|
+
removeScreenEffect(handle: number, options?: { fadeOutMs?: number }): boolean;
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Takes every effect the calling resource owns off the screen at once. Other resources' effects stay.
|
|
1086
|
+
* @returns How many were removed.
|
|
1087
|
+
*/
|
|
1088
|
+
removeAllScreenEffects(): number;
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Whether an effect is still on screen, fading out included.
|
|
1092
|
+
* @param handle What `addScreenEffect` returned.
|
|
1093
|
+
* @returns False once it has been removed and faded, has run its duration out, or was dropped by its resource stopping, the session ending or the level changing.
|
|
1094
|
+
*/
|
|
1095
|
+
isScreenEffectActive(handle: number): boolean;
|
|
1038
1096
|
};
|
|
1039
1097
|
|
|
1098
|
+
/**
|
|
1099
|
+
* One parameter a screen effect takes.
|
|
1100
|
+
*/
|
|
1101
|
+
interface ScreenEffectParam {
|
|
1102
|
+
/**
|
|
1103
|
+
* The key to pass it under in a params bag.
|
|
1104
|
+
*/
|
|
1105
|
+
name: string;
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* What it does to the picture.
|
|
1109
|
+
*/
|
|
1110
|
+
description: string;
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* The lowest value it takes. Anything lower is clamped.
|
|
1114
|
+
*/
|
|
1115
|
+
min: number;
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* The highest value it takes. Anything higher is clamped.
|
|
1119
|
+
*/
|
|
1120
|
+
max: number;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* What `addScreenEffect` uses when the parameter is not given.
|
|
1124
|
+
*/
|
|
1125
|
+
default: number;
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* The value at which it leaves the picture alone, which is also where a fade starts and ends.
|
|
1129
|
+
*/
|
|
1130
|
+
neutral: number;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* One screen effect `Hud.addScreenEffect` accepts.
|
|
1135
|
+
*/
|
|
1136
|
+
interface ScreenEffect {
|
|
1137
|
+
/**
|
|
1138
|
+
* What to pass to `addScreenEffect`.
|
|
1139
|
+
*/
|
|
1140
|
+
name: string;
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* What it does, and how several of it combine.
|
|
1144
|
+
*/
|
|
1145
|
+
description: string;
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Every parameter it takes, with its range.
|
|
1149
|
+
*/
|
|
1150
|
+
params: ScreenEffectParam[];
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1040
1153
|
/**
|
|
1041
1154
|
* The game's own sound triggers, played at this machine. A trigger is a name the game's audio data declares -- `a_o_bell_kkut_kostelni`, `c_torch_whoosh1`, `f_ge_cough_woman` -- standing for an FMOD event. The full vocabulary is `Libs/GameAudio/*.xml` in `IPL_GameData.pak`, with the gameplay-facing subset listed in `Libs/Tables/GameAudio/SkaldAtlTrigger.xml`. Nothing here is replicated: a sound everyone should hear is one the server tells every client to play. Every call returns false while the audio system is not up, which is the case before a world is loaded, and for a trigger name the audio data does not declare.
|
|
1042
1155
|
*/
|
|
@@ -2687,6 +2800,102 @@ declare global {
|
|
|
2687
2800
|
image(path: string): string;
|
|
2688
2801
|
};
|
|
2689
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
|
+
|
|
2690
2899
|
/**
|
|
2691
2900
|
* Mutable two-dimensional vector.
|
|
2692
2901
|
*/
|
|
@@ -194,6 +194,16 @@ declare global {
|
|
|
194
194
|
*/
|
|
195
195
|
playerPickpocketCaught: [thief: Player, victim: Player];
|
|
196
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Dispatched once a match has started and both players have been sent to the table. Which of them throws first is drawn at random.
|
|
199
|
+
*/
|
|
200
|
+
diceMatchStart: [match: number, first: Player, second: Player, targetScore: number];
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Dispatched once a match is over and both players have been told. `winner` is 0 when `first` won, 1 when `second` did, 255 when nobody did. `reason` is `won` (a player banked the target score), `gaveUp` (a player left the table), `left` (a player disconnected), `timedOut` (the player to throw did not move for three minutes), `failed` (a client could not play the table) or `stopped` (`Dice.stop`). A player who has gone since is null. Nothing changes hands on its own: what a match was played for is the gamemode's to settle here.
|
|
204
|
+
*/
|
|
205
|
+
diceMatchEnd: [match: number, first: Player | null, second: Player | null, winner: number, reason: string, firstScore: number, secondScore: number];
|
|
206
|
+
|
|
197
207
|
/**
|
|
198
208
|
* A player asks to open an alchemy table, or to begin a smithing recipe. Every handler runs; one returning literal `false` refuses it. An async handler cannot refuse.
|
|
199
209
|
*/
|
|
@@ -265,7 +275,7 @@ declare global {
|
|
|
265
275
|
cartEntering: [cart: Cart, player: Player, seat: string];
|
|
266
276
|
|
|
267
277
|
/**
|
|
268
|
-
* Dispatched after a player is given a seat
|
|
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.
|
|
269
279
|
*/
|
|
270
280
|
cartEnter: [cart: Cart, player: Player | null, seat: string];
|
|
271
281
|
|
|
@@ -315,7 +325,7 @@ declare global {
|
|
|
315
325
|
npcDestroy: [npc: Npc];
|
|
316
326
|
|
|
317
327
|
/**
|
|
318
|
-
* 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.
|
|
319
329
|
*/
|
|
320
330
|
npcIntentDone: [npc: Npc, status: string];
|
|
321
331
|
|
|
@@ -375,7 +385,7 @@ declare global {
|
|
|
375
385
|
gatheringHarvest: [player: Player, proposal: GatheringProposal];
|
|
376
386
|
|
|
377
387
|
/**
|
|
378
|
-
* A player was given a herb, after the `playerInventoryChanged` it caused. The plant and the same-kind plants harvested with it are picked for everyone in the virtual world until
|
|
388
|
+
* A player was given a herb, after the `playerInventoryChanged` it caused. The plant and the same-kind plants harvested with it are picked for everyone in the virtual world until timed or scripted regrowth; nothing about them survives a restart.
|
|
379
389
|
*/
|
|
380
390
|
gatheringHarvested: [player: Player, event: GatheringHarvestedEvent];
|
|
381
391
|
|
|
@@ -1639,7 +1649,7 @@ declare global {
|
|
|
1639
1649
|
get(player: Player): InventoryState | null;
|
|
1640
1650
|
|
|
1641
1651
|
/**
|
|
1642
|
-
* Gives a player items of a class, 1 to 10000 at a time. Left-out properties mean quality 1 at full condition. The units join the row that already holds this class with these properties, if there is one.
|
|
1652
|
+
* Gives a player items of a class, 1 to 10000 at a time. `item` is the class GUID or the exact name the game's own item tables use, the same spelling `giveItem` takes. Left-out properties mean quality 1 at full condition; `metadata.quality` asks for a higher tier, up to what the class is made in, and `invalidQuality` refuses one past it. The units join the row that already holds this class with these properties, if there is one.
|
|
1643
1653
|
*/
|
|
1644
1654
|
add(player: Player, request: { item: string; amount: number; metadata?: Record<string, unknown>; revision?: number }): InventoryResult;
|
|
1645
1655
|
|
|
@@ -2145,6 +2155,46 @@ declare global {
|
|
|
2145
2155
|
amount: number;
|
|
2146
2156
|
}
|
|
2147
2157
|
|
|
2158
|
+
/**
|
|
2159
|
+
* How a dice match is played.
|
|
2160
|
+
*/
|
|
2161
|
+
interface DiceMatchOptions {
|
|
2162
|
+
/**
|
|
2163
|
+
* The score that wins, banked at the end of a turn. 2000 when omitted, at most 100000.
|
|
2164
|
+
*/
|
|
2165
|
+
targetScore: number | undefined;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Dice matches between two players on the game's own dice table.
|
|
2170
|
+
*
|
|
2171
|
+
* Both players sit down at the dice table nearest them and play it as they would against an NPC, the other player's body opposite. Every throw is dealt and every move checked by the server, by the game's own scoring rules; badges and dice perks are off, so a match is decided by the dice and the decisions alone.
|
|
2172
|
+
*/
|
|
2173
|
+
const Dice: {
|
|
2174
|
+
/**
|
|
2175
|
+
* Starts a match. Both players must stand together, within a few metres, at a dice table, and neither may be playing already. Throws an Error saying why when it cannot start.
|
|
2176
|
+
* @param first NetworkID of the player on the table's first seat.
|
|
2177
|
+
* @param second NetworkID of the player on the second seat.
|
|
2178
|
+
* @param options The target score. Optional.
|
|
2179
|
+
* @returns The match id.
|
|
2180
|
+
*/
|
|
2181
|
+
start(first: number, second: number, options?: DiceMatchOptions): number;
|
|
2182
|
+
|
|
2183
|
+
/**
|
|
2184
|
+
* Ends a match with nobody winning; both tables close.
|
|
2185
|
+
* @param match The match to end.
|
|
2186
|
+
* @returns False when it had already ended.
|
|
2187
|
+
*/
|
|
2188
|
+
stop(match: number): boolean;
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* The match a player is in.
|
|
2192
|
+
* @param player NetworkID of the player to ask about.
|
|
2193
|
+
* @returns The match id, or 0.
|
|
2194
|
+
*/
|
|
2195
|
+
matchOf(player: number): number;
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2148
2198
|
/**
|
|
2149
2199
|
* A table a player is about to open, or a workpiece about to take its materials. Frozen: a handler can refuse it, not change it.
|
|
2150
2200
|
*/
|
|
@@ -2860,6 +2910,16 @@ declare global {
|
|
|
2860
2910
|
*/
|
|
2861
2911
|
readonly pace: string;
|
|
2862
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
|
+
|
|
2863
2923
|
/**
|
|
2864
2924
|
* Formats this cart handle for logging and debugging.
|
|
2865
2925
|
* @returns The cart ID, its blueprint, its driver and its pace.
|
|
@@ -2874,7 +2934,7 @@ declare global {
|
|
|
2874
2934
|
/**
|
|
2875
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.
|
|
2876
2936
|
* @param player The player to seat.
|
|
2877
|
-
* @param seat `driver` (the
|
|
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`.
|
|
2878
2938
|
* @returns Whether the player was seated: false for a taken seat, a player that is not connected, or a handler's refusal.
|
|
2879
2939
|
*/
|
|
2880
2940
|
putPlayer(player: Player, seat: string): boolean;
|
|
@@ -2888,7 +2948,7 @@ declare global {
|
|
|
2888
2948
|
|
|
2889
2949
|
/**
|
|
2890
2950
|
* Who sits in a seat.
|
|
2891
|
-
* @param seat
|
|
2951
|
+
* @param seat One of the cart's `seats`.
|
|
2892
2952
|
* @returns The player in it, or null when it is empty.
|
|
2893
2953
|
*/
|
|
2894
2954
|
getOccupant(seat: string): Player | null;
|
|
@@ -2896,12 +2956,12 @@ declare global {
|
|
|
2896
2956
|
/**
|
|
2897
2957
|
* Where a player sits in this cart.
|
|
2898
2958
|
* @param player The player to look for.
|
|
2899
|
-
* @returns
|
|
2959
|
+
* @returns The seat's name, one of `seats`, or null when they are not in it.
|
|
2900
2960
|
*/
|
|
2901
2961
|
seatOf(player: Player): string | null;
|
|
2902
2962
|
|
|
2903
2963
|
/**
|
|
2904
|
-
* Moves the cart outright, with everyone in it
|
|
2964
|
+
* Moves the cart outright, standing, with everyone in it; a driver carries on from there.
|
|
2905
2965
|
* @param position Where the cart's front axle stands.
|
|
2906
2966
|
* @param rotation Which way it faces; omitted keeps its heading.
|
|
2907
2967
|
* @returns False for a pose that is not finite.
|
|
@@ -2909,7 +2969,7 @@ declare global {
|
|
|
2909
2969
|
teleport(position: Vector3, rotation?: Vector3 | Quaternion): boolean;
|
|
2910
2970
|
|
|
2911
2971
|
/**
|
|
2912
|
-
* Spawns and replicates a cart or wagon from the game's own prefabs, with its horses already in the shafts. It stands
|
|
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.
|
|
2913
2973
|
* @param blueprint Which of the game's cart prefabs to build; omitted builds `wagon_b_covered`. `Cart.blueprints()` lists them.
|
|
2914
2974
|
* @param position Where the cart's front axle stands; omitted components default to zero.
|
|
2915
2975
|
* @param rotation Which way it faces: a Quaternion, or a Vector3 of Euler angles in degrees.
|
|
@@ -3507,9 +3567,7 @@ declare global {
|
|
|
3507
3567
|
lootable: boolean;
|
|
3508
3568
|
|
|
3509
3569
|
/**
|
|
3510
|
-
* How the
|
|
3511
|
-
*
|
|
3512
|
-
* `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`.
|
|
3513
3571
|
*/
|
|
3514
3572
|
locomotion: string;
|
|
3515
3573
|
|
|
@@ -3519,7 +3577,7 @@ declare global {
|
|
|
3519
3577
|
readonly intent: string;
|
|
3520
3578
|
|
|
3521
3579
|
/**
|
|
3522
|
-
* What
|
|
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.
|
|
3523
3581
|
*/
|
|
3524
3582
|
readonly status: string;
|
|
3525
3583
|
|
|
@@ -3603,23 +3661,31 @@ declare global {
|
|
|
3603
3661
|
hold(): void;
|
|
3604
3662
|
|
|
3605
3663
|
/**
|
|
3606
|
-
*
|
|
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.
|
|
3607
3671
|
* @param position Where to walk to.
|
|
3608
|
-
* @param options `speed`
|
|
3609
|
-
* @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.
|
|
3610
3674
|
*/
|
|
3611
|
-
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;
|
|
3612
3676
|
|
|
3613
3677
|
/**
|
|
3614
|
-
* Walks
|
|
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.
|
|
3615
3681
|
* @param points The waypoints, in order.
|
|
3616
|
-
* @param options `loop`
|
|
3617
|
-
* @returns True when the route was accepted; false for an empty route or a
|
|
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.
|
|
3618
3684
|
*/
|
|
3619
|
-
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;
|
|
3620
3686
|
|
|
3621
3687
|
/**
|
|
3622
|
-
* 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.
|
|
3623
3689
|
* @param target Who to follow, as a handle or a network ID.
|
|
3624
3690
|
* @param options `radius` is how close it tries to stay, in metres; `speed` is the pace.
|
|
3625
3691
|
* @returns True when the order went out.
|
|
@@ -3627,7 +3693,7 @@ declare global {
|
|
|
3627
3693
|
follow(target: Player | Npc | number, options?: { speed?: 'walk' | 'jog' | 'run'; radius?: number }): boolean;
|
|
3628
3694
|
|
|
3629
3695
|
/**
|
|
3630
|
-
* Sends the NPC away from a place.
|
|
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.
|
|
3631
3697
|
* @param from What to run away from.
|
|
3632
3698
|
* @param options `radius` is how far away is far enough; `speed` is the pace, `run` by default.
|
|
3633
3699
|
* @returns True when the order went out.
|
|
@@ -4022,6 +4088,60 @@ declare global {
|
|
|
4022
4088
|
|
|
4023
4089
|
interface GroundItem extends Entity {}
|
|
4024
4090
|
|
|
4091
|
+
/**
|
|
4092
|
+
* The server-wide override for herb regrowth, measured in game hours.
|
|
4093
|
+
*/
|
|
4094
|
+
interface GatheringRespawnTime {
|
|
4095
|
+
/**
|
|
4096
|
+
* Lower bound, inclusive. Both bounds zero disable timed regrowth.
|
|
4097
|
+
*/
|
|
4098
|
+
minHours: number;
|
|
4099
|
+
|
|
4100
|
+
/**
|
|
4101
|
+
* Upper bound, inclusive. Equal positive bounds give a fixed duration.
|
|
4102
|
+
*/
|
|
4103
|
+
maxHours: number;
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4106
|
+
/**
|
|
4107
|
+
* Controls herb regrowth. Defaults are five times faster than the game's authored species timings. Changes are held in server memory.
|
|
4108
|
+
*/
|
|
4109
|
+
const Gathering: {
|
|
4110
|
+
/**
|
|
4111
|
+
* Current frozen override, or null for the species defaults at one fifth of their authored duration.
|
|
4112
|
+
*/
|
|
4113
|
+
readonly respawnTime: GatheringRespawnTime | null;
|
|
4114
|
+
|
|
4115
|
+
/**
|
|
4116
|
+
* Restarts all active herb deadlines from now and sets the policy for future picks. Samples uniformly per plant. Equal bounds fix the duration; (0, 0) disables timed regrowth while manual respawn remains available. Applies to every virtual world.
|
|
4117
|
+
* @param minHours Minimum game hours, from 0 to maxHours.
|
|
4118
|
+
* @param maxHours Maximum game hours, up to 87600. Positive durations must reach at least one game millisecond.
|
|
4119
|
+
* @returns True on success; false for non-finite, reversed or out-of-range bounds.
|
|
4120
|
+
*/
|
|
4121
|
+
setRespawnTime(minHours: number, maxHours: number): boolean;
|
|
4122
|
+
|
|
4123
|
+
/**
|
|
4124
|
+
* Restores five-times-faster species defaults and restarts all active herb timers from now.
|
|
4125
|
+
*/
|
|
4126
|
+
resetRespawnTime(): void;
|
|
4127
|
+
|
|
4128
|
+
/**
|
|
4129
|
+
* Respawns recorded harvested plants in a sphere, including plants with timed regrowth disabled. Restores client vegetation as well as server availability. Does not create new plants.
|
|
4130
|
+
* @param position Centre of the sphere in world metres; finite coordinates within +/-100000.
|
|
4131
|
+
* @param radius Inclusive 3D radius in metres, from 0 to 100000.
|
|
4132
|
+
* @param virtualWorld Only this virtual world; defaults to 0.
|
|
4133
|
+
* @returns Number of active harvested sources restored. Invalid arguments throw.
|
|
4134
|
+
*/
|
|
4135
|
+
respawn(position: Vector3, radius: number, virtualWorld?: number): number;
|
|
4136
|
+
|
|
4137
|
+
/**
|
|
4138
|
+
* Respawns every recorded harvested plant in one virtual world, including plants with timed regrowth disabled.
|
|
4139
|
+
* @param virtualWorld Only this virtual world; defaults to 0.
|
|
4140
|
+
* @returns Number of active harvested sources restored. Invalid arguments throw.
|
|
4141
|
+
*/
|
|
4142
|
+
respawnAll(virtualWorld?: number): number;
|
|
4143
|
+
};
|
|
4144
|
+
|
|
4025
4145
|
/**
|
|
4026
4146
|
* A plant a player picked and what it is about to give them.
|
|
4027
4147
|
*/
|
|
@@ -5109,6 +5229,129 @@ declare global {
|
|
|
5109
5229
|
entities: WorldNearbyEntity[];
|
|
5110
5230
|
}
|
|
5111
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
|
+
|
|
5112
5355
|
/**
|
|
5113
5356
|
* What the game's own tables say about one status effect.
|
|
5114
5357
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingdomsconnected/types",
|
|
3
|
-
"version": "1.5.
|
|
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
|
|