@kingdomsconnected/types 1.5.3 → 1.5.5
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 +160 -2
- package/generated/server-api.d.ts +676 -53
- package/package.json +1 -1
|
@@ -84,6 +84,16 @@ declare global {
|
|
|
84
84
|
*/
|
|
85
85
|
noclipChanged: [active: boolean, reason: "script" | "mapEditor" | "viewLost" | "sessionOver"];
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Dispatched when a book `Book.open` asked for is in the player's hands and showing its first page, on this machine only.
|
|
89
|
+
*/
|
|
90
|
+
bookOpened: [bookId: number];
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Dispatched when a book leaves the player's hands, on this machine only. `reason` is `player` for the player's own exit (or the game ending the reading itself), `script` for `Book.close`, `failed` for a book that never reached the hands, and `sessionOver` for the session ending. Handler promises are not awaited, and a handler may open the next book straight away.
|
|
94
|
+
*/
|
|
95
|
+
bookClosed: [bookId: number, reason: "player" | "script" | "failed" | "sessionOver"];
|
|
96
|
+
|
|
87
97
|
/**
|
|
88
98
|
* Dispatched after a resource entry point has run and immediately before the resource becomes running.
|
|
89
99
|
*/
|
|
@@ -604,6 +614,11 @@ declare global {
|
|
|
604
614
|
*/
|
|
605
615
|
readonly appearance: Appearance;
|
|
606
616
|
|
|
617
|
+
/**
|
|
618
|
+
* The prop-catalog mesh this player's body is drawn as, by its `objects/...cgf` path, or null while they look like themselves. Published by their own client, so it follows `setDisguise` once they have actually put it on.
|
|
619
|
+
*/
|
|
620
|
+
readonly disguise: string | null;
|
|
621
|
+
|
|
607
622
|
/**
|
|
608
623
|
* Whether this player's body has both a pose and a soul, which is what everyone else waits for before spawning a puppet for them. False for the first moments of a connection.
|
|
609
624
|
*/
|
|
@@ -893,7 +908,7 @@ declare global {
|
|
|
893
908
|
};
|
|
894
909
|
|
|
895
910
|
/**
|
|
896
|
-
* 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 call returns false while there is no HUD, which is the case in the main menu and across a level load.
|
|
911
|
+
* 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.
|
|
897
912
|
*/
|
|
898
913
|
const Hud: {
|
|
899
914
|
/**
|
|
@@ -1005,6 +1020,21 @@ declare global {
|
|
|
1005
1020
|
* @returns True when the HUD took it.
|
|
1006
1021
|
*/
|
|
1007
1022
|
clearNotifications(): boolean;
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Hides or shows one element of the game's HUD at this client, through the switch the game itself keeps for each. It can be called at any time, before the HUD has loaded included: the game re-applies the switch every time the HUD loads, across level loads too. Turning an element on does not force it up; the game still hides it where it would anyway, in dialogue or a menu, say. The player's own setting comes back when the resource that changed it stops.
|
|
1026
|
+
* @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
|
+
* @param visible False hides the element, true lets the game show it again.
|
|
1028
|
+
* @returns True when the switch took it; false only before the game has created its HUD switches, which it does at startup.
|
|
1029
|
+
*/
|
|
1030
|
+
setElementVisible(element: string, visible: boolean): boolean;
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Whether one element's switch is on. An element whose switch is on can still be hidden by the game at that moment.
|
|
1034
|
+
* @param element The element, by the game's own name for it, as `setElementVisible` takes it.
|
|
1035
|
+
* @returns True while the element is allowed to show.
|
|
1036
|
+
*/
|
|
1037
|
+
isElementVisible(element: string): boolean;
|
|
1008
1038
|
};
|
|
1009
1039
|
|
|
1010
1040
|
/**
|
|
@@ -1304,6 +1334,11 @@ declare global {
|
|
|
1304
1334
|
* This machine's own handle for it. Local to this client and to this session -- it is not the network ID and it is not portable, so store `entityGuid` instead. Null for terrain and static geometry.
|
|
1305
1335
|
*/
|
|
1306
1336
|
entityId: number | null;
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* The player whose body it was -- the local player's own included, when `ignoreSelf` is off -- or null for anything else. Found through the body's own entity, so it holds for a disguised player too: their collider is the mesh's size, and a trace that meets the mesh names them.
|
|
1340
|
+
*/
|
|
1341
|
+
player: Player | null;
|
|
1307
1342
|
}
|
|
1308
1343
|
|
|
1309
1344
|
/**
|
|
@@ -1782,7 +1817,7 @@ declare global {
|
|
|
1782
1817
|
/**
|
|
1783
1818
|
* The view this client is drawing through. Nothing here is replicated and nothing here is authority: it describes one machine's own camera at one moment.
|
|
1784
1819
|
*
|
|
1785
|
-
* This is the game's camera, not a camera of the mod's own -- it follows the player, a dialogue, a cutscene or a free flight, whichever the game currently has. `NoClip` is what takes it over.
|
|
1820
|
+
* This is the game's camera, not a camera of the mod's own -- it follows the player, a dialogue, a cutscene or a free flight, whichever the game currently has. `NoClip` is what takes it over, and `setThirdPerson` puts it behind the player.
|
|
1786
1821
|
*/
|
|
1787
1822
|
const Camera: {
|
|
1788
1823
|
/**
|
|
@@ -1797,6 +1832,24 @@ declare global {
|
|
|
1797
1832
|
* @returns The ray, or null when there is no active view.
|
|
1798
1833
|
*/
|
|
1799
1834
|
screenRay(options?: { x?: number; y?: number; range?: number }): CameraRay | null;
|
|
1835
|
+
|
|
1836
|
+
/**
|
|
1837
|
+
* Puts this player's camera behind them, for as long as it is on.
|
|
1838
|
+
*
|
|
1839
|
+
* The game has no third-person view to switch to, so this is a camera of the mod's own, placed every frame behind the body along the direction the player is looking. Nothing about their controls changes: they walk and turn as they did, and the mouse still turns the body. When a wall is behind them the camera comes in along the same line rather than going through it.
|
|
1840
|
+
*
|
|
1841
|
+
* This is what a disguised player needs -- `player.setDisguise` hides the body the game's own camera sits in. It is this client's own view, so a gamemode turns it on from a client script, typically on an event the server sends the disguised player.
|
|
1842
|
+
*
|
|
1843
|
+
* There is one view to draw through: `NoClip` cannot start while this holds it, and while `NoClip` flies this waits. The map, the inventory and the other pause-screen pages are filmed by the game's own camera, so this steps aside while one is open and comes back when it closes. It lasts until the session ends.
|
|
1844
|
+
* @param options Where the camera sits, in metres: `distance` back from the body along where the player looks (3.5 by default, 0.3 to 20), `height` of the point it orbits above the body's feet (1.6, up to 5 either way), and `shoulder` to the right of it, negative for the left (0, up to 3 either way). Null hands the view back to the game's own camera. Called again while on, it only moves the camera.
|
|
1845
|
+
*/
|
|
1846
|
+
setThirdPerson(options?: { distance?: number; height?: number; shoulder?: number } | null): void;
|
|
1847
|
+
|
|
1848
|
+
/**
|
|
1849
|
+
* Whether `setThirdPerson` is on.
|
|
1850
|
+
* @returns True from `setThirdPerson` until it is turned off, also while it waits for a body or for `NoClip`.
|
|
1851
|
+
*/
|
|
1852
|
+
isThirdPerson(): boolean;
|
|
1800
1853
|
};
|
|
1801
1854
|
|
|
1802
1855
|
/**
|
|
@@ -2529,6 +2582,111 @@ declare global {
|
|
|
2529
2582
|
getCatalog(): EmoteCatalogEntry[];
|
|
2530
2583
|
};
|
|
2531
2584
|
|
|
2585
|
+
/**
|
|
2586
|
+
* A picture for the skill-book and map layouts, which place pictures by page rather than inline.
|
|
2587
|
+
*/
|
|
2588
|
+
interface BookPageImage {
|
|
2589
|
+
/**
|
|
2590
|
+
* Zero-based page the picture belongs to.
|
|
2591
|
+
*/
|
|
2592
|
+
page: number;
|
|
2593
|
+
|
|
2594
|
+
/**
|
|
2595
|
+
* Its name under the game's own `Libs/UI/Textures/Books/` Skills or Maps folder, without the `_ui.dds` suffix, e.g. `swords1`.
|
|
2596
|
+
*/
|
|
2597
|
+
image: string;
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* What `Book.open` shows and how it looks.
|
|
2602
|
+
*/
|
|
2603
|
+
interface BookOptions {
|
|
2604
|
+
/**
|
|
2605
|
+
* One string per page, written in the book movie's own markup: `<title>`, `<subtitle>`, `<heading>`, `<paragraph>`, `<br/>`, `<accent>`, `<inc>X</inc>` for a decorated initial, `<poem>`, `<lpoem>`, `<note>`, `<p align>`, `<font size>`, `<i>` and `<img src='...' width='W' height='H' align='center'/>`. A page break follows every page but the last; `<newpage/>` inside a page breaks it further. The player's own reading skill never scrambles it; `legibility` decides that.
|
|
2606
|
+
*/
|
|
2607
|
+
pages: string[];
|
|
2608
|
+
|
|
2609
|
+
/**
|
|
2610
|
+
* The object in the player's hands: a red-covered book (the default), a plain-covered one, or a folded letter.
|
|
2611
|
+
*/
|
|
2612
|
+
style: "book" | "plainBook" | "letter" | undefined;
|
|
2613
|
+
|
|
2614
|
+
/**
|
|
2615
|
+
* The layout the movie uses, by `document_class` id: 1 book (the default), 2 recipe, 3 skill book, 4 map, 5 letter (the default for `letter`), 6 plan.
|
|
2616
|
+
*/
|
|
2617
|
+
type: number | undefined;
|
|
2618
|
+
|
|
2619
|
+
/**
|
|
2620
|
+
* How ornate the pages are, 1 plain to 7 embellished. Defaults to 1.
|
|
2621
|
+
*/
|
|
2622
|
+
visual: number | undefined;
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* How much of the text can be read, 0 to 1; values outside are clamped. Defaults to 1, fully legible. Below 1 the movie swaps letters for look-alike glyphs, the same effect a vanilla book shows a player with low reading skill. It works in tenths: each step brings roughly another tenth of the character classes back, so 0.31 and 0.39 look the same. The substitution is deterministic -- the same text at the same level always reads the same way -- and markup is never touched.
|
|
2626
|
+
*/
|
|
2627
|
+
legibility: number | undefined;
|
|
2628
|
+
|
|
2629
|
+
/**
|
|
2630
|
+
* A picture `Book.image` returned, replacing the carrier's own diffuse texture: the paper and the cover together, which the model maps from one atlas. Paint it over the vanilla atlas to keep the UV layout -- `Objects/manmade/task_specific_props/read_and_write/books/book_alchemy_diff.dds` for the two book styles, `.../scrolls/scroll_diff.dds` for `letter`. The material's diffuse colour multiplies it: `book` darkens it to about 78% and `letter` to about 72%, while `plainBook` shows it as painted. It applies to this book's own copy of the material only, and goes with the book.
|
|
2631
|
+
*/
|
|
2632
|
+
texture: string | undefined;
|
|
2633
|
+
|
|
2634
|
+
/**
|
|
2635
|
+
* Pictures for the skill-book and map layouts. Inline pictures go in the page text as `<img>` instead.
|
|
2636
|
+
*/
|
|
2637
|
+
images: BookPageImage[] | undefined;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* Books a resource composes and opens in this player's hands.
|
|
2642
|
+
*
|
|
2643
|
+
* A book is shown through the game's own reading: the same book in hand, camera, page-turn animation, prompts and pagination as any book the player reads from their inventory. The player turns pages and leaves it with the game's own keys, and `bookClosed` says when they did.
|
|
2644
|
+
*
|
|
2645
|
+
* Client-only and local: the book exists on this machine alone, and reading it grants nothing -- no XP, no read marker, no quest progress. A server that wants a player to read something sends the pages in its own event.
|
|
2646
|
+
*
|
|
2647
|
+
* Pictures a resource ships go through `Book.image`, which returns what an `<img src>` and the `texture` option take.
|
|
2648
|
+
*/
|
|
2649
|
+
const Book: {
|
|
2650
|
+
/**
|
|
2651
|
+
* Opens a book in the player's hands.
|
|
2652
|
+
* @param options The pages and how they look.
|
|
2653
|
+
* @returns The book's id, which `bookOpened` and `bookClosed` carry; null when the game will not open one now -- no body yet, a book already open, or a place the player cannot read in (on horseback, in combat). `getLastError` says which. Malformed options throw.
|
|
2654
|
+
*/
|
|
2655
|
+
open(options: BookOptions): number | null;
|
|
2656
|
+
|
|
2657
|
+
/**
|
|
2658
|
+
* Closes the open book the way the player's own exit does.
|
|
2659
|
+
* @returns False when no book is open.
|
|
2660
|
+
*/
|
|
2661
|
+
close(): boolean;
|
|
2662
|
+
|
|
2663
|
+
/**
|
|
2664
|
+
* Changes how legible the open book is, while it is in the player's hands.
|
|
2665
|
+
* @param value 0 fully scrambled to 1 fully legible; clamped.
|
|
2666
|
+
* @returns False when no book is in the hands yet (wait for `bookOpened`). The movie applies legibility while laying the text out, so the book is laid out again, which can return it to its first page. Throws for a non-number.
|
|
2667
|
+
*/
|
|
2668
|
+
setLegibility(value: number): boolean;
|
|
2669
|
+
|
|
2670
|
+
/**
|
|
2671
|
+
* The id of the book in the player's hands.
|
|
2672
|
+
* @returns Null when there is none.
|
|
2673
|
+
*/
|
|
2674
|
+
getOpenBook(): number | null;
|
|
2675
|
+
|
|
2676
|
+
/**
|
|
2677
|
+
* Why the last `open` returned null.
|
|
2678
|
+
* @returns Empty after one that succeeded.
|
|
2679
|
+
*/
|
|
2680
|
+
getLastError(): string;
|
|
2681
|
+
|
|
2682
|
+
/**
|
|
2683
|
+
* Makes a picture the resource ships reachable from page text.
|
|
2684
|
+
* @param path A `.dds` file the calling resource ships, relative to the resource.
|
|
2685
|
+
* @returns The value for an `<img src='...'>` attribute. Give the tag a `width` and `height` too: the movie sizes the picture to them and has no size of its own for it. Throws when the file is missing, not a `.dds`, or larger than 16 MiB.
|
|
2686
|
+
*/
|
|
2687
|
+
image(path: string): string;
|
|
2688
|
+
};
|
|
2689
|
+
|
|
2532
2690
|
/**
|
|
2533
2691
|
* Mutable two-dimensional vector.
|
|
2534
2692
|
*/
|
|
@@ -195,27 +195,27 @@ declare global {
|
|
|
195
195
|
playerPickpocketCaught: [thief: Player, victim: Player];
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
* A player asks to open an alchemy table. Every handler runs; one returning literal `false` refuses it. An async handler cannot refuse.
|
|
198
|
+
* 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
199
|
*/
|
|
200
200
|
craftingStarting: [player: Player, proposal: CraftStartProposal];
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
-
* A batch is brewing.
|
|
203
|
+
* A batch is brewing, or a workpiece took its materials.
|
|
204
204
|
*/
|
|
205
205
|
craftingStarted: [player: Player, event: CraftStartedEvent];
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
|
-
* A batch finished and its result is computed. Every handler runs; one returning literal `false` refuses it: the batch
|
|
208
|
+
* A batch or workpiece finished and its result is computed. Every handler runs; one returning literal `false` refuses it: alchemy ends the batch as failed, what was spent stays spent, and nothing is granted; smithing fails the workpiece, spending its failure share.
|
|
209
209
|
*/
|
|
210
210
|
craftingCompleting: [player: Player, proposal: CraftCompletionProposal];
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
* A
|
|
213
|
+
* A result was granted, followed by `craftingEnded`. Raised after the `playerInventoryChanged` it caused.
|
|
214
214
|
*/
|
|
215
215
|
craftingCompleted: [player: Player, event: CraftCompletedEvent];
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
|
-
* A batch is over. Raised after the `playerInventoryChanged` of any refund.
|
|
218
|
+
* A batch or workpiece is over. Raised after the `playerInventoryChanged` of any refund.
|
|
219
219
|
*/
|
|
220
220
|
craftingEnded: [player: Player, event: CraftEndedEvent];
|
|
221
221
|
|
|
@@ -386,6 +386,16 @@ declare global {
|
|
|
386
386
|
*/
|
|
387
387
|
doorInteract: [player: Player, door: Door, action: "open" | "close" | "unlock" | "lockpick", keySide: boolean];
|
|
388
388
|
|
|
389
|
+
/**
|
|
390
|
+
* Dispatched when a body comes to be inside an enabled area: it walked or rode in, or the area was created, moved, reshaped or enabled around it. The server decides this itself from the pose it already replicates, by the game's own rule for that kind of area, so a client cannot claim it. `matchingVirtualWorld` is false when a script area bound to one world is crossed by a body in another; a level area is in every world.
|
|
391
|
+
*/
|
|
392
|
+
areaEnter: [area: Area, entity: Player | Horse | Cart | Npc, matchingVirtualWorld: boolean];
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Dispatched when a body stops being inside an area: it walked out, or the area was moved, reshaped, disabled or destroyed. A body that leaves the server entirely -- a player disconnecting, a horse despawned -- raises nothing here; its own event already says it is gone.
|
|
396
|
+
*/
|
|
397
|
+
areaExit: [area: Area, entity: Player | Horse | Cart | Npc, matchingVirtualWorld: boolean];
|
|
398
|
+
|
|
389
399
|
/**
|
|
390
400
|
* A container now exists: one a script spawned, or one the level places, built in a virtual world the first time anything there asked for it. Every container starts empty; restore saved contents here with `setInventory`. The level's containers in the global world are built before any resource runs, so restore those from `resourceStart` by walking `Stash.all()`.
|
|
391
401
|
*/
|
|
@@ -948,6 +958,11 @@ declare global {
|
|
|
948
958
|
*/
|
|
949
959
|
readonly appearance: Appearance;
|
|
950
960
|
|
|
961
|
+
/**
|
|
962
|
+
* The prop-catalog mesh this player's body is drawn as, by its `objects/...cgf` path, or null while they look like themselves. Published by their own client, so it follows `setDisguise` once they have actually put it on.
|
|
963
|
+
*/
|
|
964
|
+
readonly disguise: string | null;
|
|
965
|
+
|
|
951
966
|
/**
|
|
952
967
|
* Whether this player's body has both a pose and a soul, which is what everyone else waits for before spawning a puppet for them. False for the first moments of a connection.
|
|
953
968
|
*/
|
|
@@ -1435,6 +1450,19 @@ declare global {
|
|
|
1435
1450
|
*/
|
|
1436
1451
|
heal(options?: { health?: number | boolean; injuries?: boolean; poisons?: boolean; bleeding?: boolean }): boolean;
|
|
1437
1452
|
|
|
1453
|
+
/**
|
|
1454
|
+
* Draws this player as a static mesh instead of themselves -- a barrel, a haystack, a cart wheel -- on their own screen and on everybody else's. It is state: a player who streams in or joins sees it too, and it lasts until the next call.
|
|
1455
|
+
*
|
|
1456
|
+
* Only the look and the collision change. The body is hidden rather than replaced, and its collision cylinder is resized around the mesh, so the player walks and is traced against in roughly the mesh's shape -- a client's `World.raycast` with `mode: "anything"` finds them where the mesh is drawn, and says which player it found. The mesh turns with the body. They keep everything else a person has: they can still be hurt, bleed and die, and nothing stops them drawing a weapon, which a gamemode that does not want that has to take away.
|
|
1457
|
+
*
|
|
1458
|
+
* The game's own camera sits in the head, which the mesh now covers: pair this with the client's `Camera.setThirdPerson` for the disguised player. Nametags are not touched; `setNametagVisible` is the call for that. NPCs still see a person.
|
|
1459
|
+
*
|
|
1460
|
+
* The owning client is authoritative for its body, so this is a request that lands on their next frame; `player.disguise` reads what they actually have on.
|
|
1461
|
+
* @param model A mesh from the prop catalog, by its `objects/...cgf` path or its file stem -- anything `Prop.spawn` takes. Null puts the player back in their own body.
|
|
1462
|
+
* @returns True when the request went out; false for a player with no connection to ask. Throws for a model the catalog does not carry.
|
|
1463
|
+
*/
|
|
1464
|
+
setDisguise(model: string | null): boolean;
|
|
1465
|
+
|
|
1438
1466
|
/**
|
|
1439
1467
|
* Takes this player out of whatever saddle they are in: their own client gets them off, and `horseDismount` is raised.
|
|
1440
1468
|
* @returns The horse they were taken off, or null when they were not riding one.
|
|
@@ -1585,7 +1613,7 @@ declare global {
|
|
|
1585
1613
|
ok: boolean;
|
|
1586
1614
|
|
|
1587
1615
|
/**
|
|
1588
|
-
* Empty on success, otherwise why not: `inventoryUnavailable`, `invalidRequest`, `staleRevision`, `invalidItem`, `invalidItems`, `invalidAmount`, `unknownItem`, `insufficientItems`, `inventoryCapacity`, `sameInventory`, or a property policy code (`invalidMetadata`, `unknownItemClass`, `invalidQuality`, `immutableItemHealth`, `invalidItemHealth`, `contradictoryItemHealth`, `invalidCreationSentinel`, `unsupportedPoisonProperties`, `unsupportedOnEquipBuffs`).
|
|
1616
|
+
* Empty on success, otherwise why not: `inventoryUnavailable`, `invalidRequest`, `staleRevision`, `invalidItem`, `invalidItems`, `invalidAmount`, `unknownItem`, `insufficientItems`, `inventoryCapacity`, `sameInventory`, or a property policy code (`invalidMetadata`, `unknownItemClass`, `questItem`, `invalidQuality`, `immutableItemHealth`, `invalidItemHealth`, `contradictoryItemHealth`, `invalidCreationSentinel`, `unsupportedPoisonProperties`, `unsupportedOnEquipBuffs`).
|
|
1589
1617
|
*/
|
|
1590
1618
|
code: string;
|
|
1591
1619
|
|
|
@@ -1634,6 +1662,21 @@ declare global {
|
|
|
1634
1662
|
* Moves exact units from one player to another with their properties, all or nothing. They join matching rows in the target, so the target's row ids are the ones in the result's `items`. Whether the two may trade -- distance, consent, price -- is for the script to decide.
|
|
1635
1663
|
*/
|
|
1636
1664
|
transfer(source: Player, target: Player, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number }): InventoryResult;
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* What the game prices one unit of an item at, in money units, worked out the way the game does it. `pristine` is the price at the best health its quality allows, `current` at its own health. Quality changes the price only through that health. The metadata reads as `Inventory.add` reads it -- left out, quality 1 at full condition -- so `Inventory.getItemPrice(row.item, row.metadata)` prices a row. This is the item's own worth: what the game's shopkeepers would ask depends on their terms and the haggling, and a `Vendor` charges whatever its script says.
|
|
1668
|
+
* @param metadata The item's properties, as a row's `metadata` holds them.
|
|
1669
|
+
* @returns Null for a class the server does not know, or metadata `Inventory.add` would refuse.
|
|
1670
|
+
*/
|
|
1671
|
+
getItemPrice(item: string, metadata?: Record<string, unknown>): { pristine: number; current: number } | null;
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* Changes what every player's game calls an item, in their inventory, the shops, loot and anywhere else the game names it; null gives the game its own name back. Every player sees it, including those who join later, until the server stops.
|
|
1675
|
+
*
|
|
1676
|
+
* The game does not name classes one by one: many classes show the same name -- every kite shield is a Kite Shield -- and renaming one renames all of them. The result lists them. A name is up to 128 bytes with no control characters, and is not translated.
|
|
1677
|
+
* @returns The GUIDs of every class that now shows this name.
|
|
1678
|
+
*/
|
|
1679
|
+
setItemName(item: string, name: string | null): string[];
|
|
1637
1680
|
};
|
|
1638
1681
|
|
|
1639
1682
|
/**
|
|
@@ -2103,31 +2146,46 @@ declare global {
|
|
|
2103
2146
|
}
|
|
2104
2147
|
|
|
2105
2148
|
/**
|
|
2106
|
-
* A table a player is about to open. Frozen: a handler can refuse it, not change it.
|
|
2149
|
+
* 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.
|
|
2107
2150
|
*/
|
|
2108
2151
|
interface CraftStartProposal {
|
|
2152
|
+
/**
|
|
2153
|
+
* Which craft.
|
|
2154
|
+
*/
|
|
2155
|
+
kind: 'alchemy' | 'smithing';
|
|
2156
|
+
|
|
2109
2157
|
/**
|
|
2110
2158
|
* Station id, as `Crafting.stations` names it.
|
|
2111
2159
|
*/
|
|
2112
2160
|
station: string;
|
|
2113
2161
|
|
|
2114
2162
|
/**
|
|
2115
|
-
* The player's virtual world; each world has its own
|
|
2163
|
+
* The player's virtual world; each world has its own stations.
|
|
2116
2164
|
*/
|
|
2117
2165
|
virtualWorld: number;
|
|
2118
2166
|
|
|
2119
2167
|
/**
|
|
2120
|
-
*
|
|
2168
|
+
* Smithing only: the recipe id the player chose, as `Crafting.recipes` keys it.
|
|
2169
|
+
*/
|
|
2170
|
+
recipe: string | undefined;
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* The batch this one follows at a table the player kept, or empty for a fresh entry. Always empty for smithing.
|
|
2121
2174
|
*/
|
|
2122
2175
|
continuationOf: string;
|
|
2123
2176
|
}
|
|
2124
2177
|
|
|
2125
2178
|
/**
|
|
2126
|
-
* A batch that is now brewing
|
|
2179
|
+
* A batch that is now brewing, or a workpiece whose materials were taken.
|
|
2127
2180
|
*/
|
|
2128
2181
|
interface CraftStartedEvent {
|
|
2129
2182
|
/**
|
|
2130
|
-
*
|
|
2183
|
+
* Which craft.
|
|
2184
|
+
*/
|
|
2185
|
+
kind: 'alchemy' | 'smithing';
|
|
2186
|
+
|
|
2187
|
+
/**
|
|
2188
|
+
* The batch's or workpiece's session id.
|
|
2131
2189
|
*/
|
|
2132
2190
|
session: string;
|
|
2133
2191
|
|
|
@@ -2137,22 +2195,32 @@ declare global {
|
|
|
2137
2195
|
station: string;
|
|
2138
2196
|
|
|
2139
2197
|
/**
|
|
2140
|
-
* The
|
|
2198
|
+
* The station's virtual world.
|
|
2141
2199
|
*/
|
|
2142
2200
|
virtualWorld: number;
|
|
2143
2201
|
|
|
2144
2202
|
/**
|
|
2145
|
-
*
|
|
2203
|
+
* Smithing only: the recipe being worked.
|
|
2204
|
+
*/
|
|
2205
|
+
recipe: string | undefined;
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
* The previous batch at this table, or empty for the first. Always empty for smithing.
|
|
2146
2209
|
*/
|
|
2147
2210
|
continuationOf: string;
|
|
2148
2211
|
}
|
|
2149
2212
|
|
|
2150
2213
|
/**
|
|
2151
|
-
* What a finished batch is about to grant, computed by the server. Frozen: a handler can refuse it, not change it.
|
|
2214
|
+
* What a finished batch or workpiece is about to grant, computed by the server. Frozen: a handler can refuse it, not change it.
|
|
2152
2215
|
*/
|
|
2153
2216
|
interface CraftCompletionProposal {
|
|
2154
2217
|
/**
|
|
2155
|
-
*
|
|
2218
|
+
* Which craft.
|
|
2219
|
+
*/
|
|
2220
|
+
kind: 'alchemy' | 'smithing';
|
|
2221
|
+
|
|
2222
|
+
/**
|
|
2223
|
+
* The session id.
|
|
2156
2224
|
*/
|
|
2157
2225
|
session: string;
|
|
2158
2226
|
|
|
@@ -2162,22 +2230,22 @@ declare global {
|
|
|
2162
2230
|
station: string;
|
|
2163
2231
|
|
|
2164
2232
|
/**
|
|
2165
|
-
* `failed` brews the game's failed potion.
|
|
2233
|
+
* `failed` brews the game's failed potion. A smithing proposal is always `success`: a failed workpiece grants nothing to review.
|
|
2166
2234
|
*/
|
|
2167
2235
|
outcome: 'success' | 'failed';
|
|
2168
2236
|
|
|
2169
2237
|
/**
|
|
2170
|
-
* The recipe the brew matched, or empty when it matched none.
|
|
2238
|
+
* The recipe the brew matched, or empty when it matched none; the smithing recipe worked.
|
|
2171
2239
|
*/
|
|
2172
2240
|
recipe: string;
|
|
2173
2241
|
|
|
2174
2242
|
/**
|
|
2175
|
-
* The product's native rank.
|
|
2243
|
+
* The product's native rank; for smithing, its item quality tier.
|
|
2176
2244
|
*/
|
|
2177
2245
|
grade: number;
|
|
2178
2246
|
|
|
2179
2247
|
/**
|
|
2180
|
-
* Item class GUID of what would be granted, or empty when
|
|
2248
|
+
* Item class GUID of what would be granted, or empty when nothing is: a zero alchemy yield, or a smithing quest product its quest creates.
|
|
2181
2249
|
*/
|
|
2182
2250
|
product: string;
|
|
2183
2251
|
|
|
@@ -2187,22 +2255,32 @@ declare global {
|
|
|
2187
2255
|
amount: number;
|
|
2188
2256
|
|
|
2189
2257
|
/**
|
|
2190
|
-
* Brewing quality, 0 to 1, after perks and the table-entry bonus.
|
|
2258
|
+
* Brewing quality, 0 to 1, after perks and the table-entry bonus; for smithing, the workpiece quality the player's game reported.
|
|
2191
2259
|
*/
|
|
2192
2260
|
quality: number;
|
|
2193
2261
|
|
|
2194
2262
|
/**
|
|
2195
|
-
* Base alchemy XP; the player's own multipliers apply on top.
|
|
2263
|
+
* Base alchemy or craftsmanship XP; the player's own multipliers apply on top.
|
|
2196
2264
|
*/
|
|
2197
2265
|
xp: number;
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* Smithing only: lockpicks granted alongside, drawn by the server from the player's perks.
|
|
2269
|
+
*/
|
|
2270
|
+
lockpicks: number | undefined;
|
|
2198
2271
|
}
|
|
2199
2272
|
|
|
2200
2273
|
/**
|
|
2201
|
-
* A batch whose result was granted: the output is in the inventory and the XP was ordered.
|
|
2274
|
+
* A batch or workpiece whose result was granted: the output is in the inventory and the XP was ordered.
|
|
2202
2275
|
*/
|
|
2203
2276
|
interface CraftCompletedEvent {
|
|
2204
2277
|
/**
|
|
2205
|
-
*
|
|
2278
|
+
* Which craft.
|
|
2279
|
+
*/
|
|
2280
|
+
kind: 'alchemy' | 'smithing';
|
|
2281
|
+
|
|
2282
|
+
/**
|
|
2283
|
+
* The session id.
|
|
2206
2284
|
*/
|
|
2207
2285
|
session: string;
|
|
2208
2286
|
|
|
@@ -2212,7 +2290,7 @@ declare global {
|
|
|
2212
2290
|
station: string;
|
|
2213
2291
|
|
|
2214
2292
|
/**
|
|
2215
|
-
* The
|
|
2293
|
+
* The station's virtual world.
|
|
2216
2294
|
*/
|
|
2217
2295
|
virtualWorld: number;
|
|
2218
2296
|
|
|
@@ -2227,37 +2305,47 @@ declare global {
|
|
|
2227
2305
|
recipe: string;
|
|
2228
2306
|
|
|
2229
2307
|
/**
|
|
2230
|
-
* The product's native rank.
|
|
2308
|
+
* The product's native rank; for smithing, its item quality tier.
|
|
2231
2309
|
*/
|
|
2232
2310
|
grade: number;
|
|
2233
2311
|
|
|
2234
2312
|
/**
|
|
2235
|
-
* Brewing quality, 0 to 1.
|
|
2313
|
+
* Brewing or workpiece quality, 0 to 1.
|
|
2236
2314
|
*/
|
|
2237
2315
|
quality: number;
|
|
2238
2316
|
|
|
2239
2317
|
/**
|
|
2240
|
-
* Base
|
|
2318
|
+
* Base XP ordered.
|
|
2241
2319
|
*/
|
|
2242
2320
|
xp: number;
|
|
2243
2321
|
|
|
2244
2322
|
/**
|
|
2245
|
-
*
|
|
2323
|
+
* Smithing only: lockpicks granted.
|
|
2324
|
+
*/
|
|
2325
|
+
lockpicks: number | undefined;
|
|
2326
|
+
|
|
2327
|
+
/**
|
|
2328
|
+
* The inventory rows that received the output, lockpicks included. Do not grant it again.
|
|
2246
2329
|
*/
|
|
2247
2330
|
outputs: InventoryUnit[];
|
|
2248
2331
|
|
|
2249
2332
|
/**
|
|
2250
|
-
*
|
|
2333
|
+
* Alchemy only: the player's recipe knowledge after this batch, as `Crafting.knowledge` returns it.
|
|
2251
2334
|
*/
|
|
2252
|
-
knowledge: Record<string, number
|
|
2335
|
+
knowledge: Record<string, number> | undefined;
|
|
2253
2336
|
}
|
|
2254
2337
|
|
|
2255
2338
|
/**
|
|
2256
|
-
* A batch that is over, for any reason. A table kept for the next batch is not closed by this.
|
|
2339
|
+
* A batch or workpiece that is over, for any reason. A table kept for the next batch is not closed by this.
|
|
2257
2340
|
*/
|
|
2258
2341
|
interface CraftEndedEvent {
|
|
2259
2342
|
/**
|
|
2260
|
-
*
|
|
2343
|
+
* Which craft.
|
|
2344
|
+
*/
|
|
2345
|
+
kind: 'alchemy' | 'smithing';
|
|
2346
|
+
|
|
2347
|
+
/**
|
|
2348
|
+
* The session id.
|
|
2261
2349
|
*/
|
|
2262
2350
|
session: string;
|
|
2263
2351
|
|
|
@@ -2267,7 +2355,7 @@ declare global {
|
|
|
2267
2355
|
station: string;
|
|
2268
2356
|
|
|
2269
2357
|
/**
|
|
2270
|
-
* The
|
|
2358
|
+
* The station's virtual world.
|
|
2271
2359
|
*/
|
|
2272
2360
|
virtualWorld: number;
|
|
2273
2361
|
|
|
@@ -2277,12 +2365,12 @@ declare global {
|
|
|
2277
2365
|
outcome: 'success' | 'failed' | 'cancelled';
|
|
2278
2366
|
|
|
2279
2367
|
/**
|
|
2280
|
-
* Empty for a completed batch. `craftingCompletingRejected` when a handler refused the result; `cancelled` by the player or a script; `disconnected`; `timeout` after 30 minutes; `contextInvalidated` when the player walked away, died or changed world.
|
|
2368
|
+
* Empty for a completed batch or a workpiece the game finished or broke. `craftingCompletingRejected` when a handler refused the result; `cancelled` by the player or a script; `disconnected`; `timeout` after 30 minutes; `contextInvalidated` when the player walked away, died or changed world. Smithing adds `abandoned` (the recipe never reached the anvil), `abandonTooLate`, `invalidQuality` and `inventoryUnavailable`.
|
|
2281
2369
|
*/
|
|
2282
2370
|
reason: string;
|
|
2283
2371
|
|
|
2284
2372
|
/**
|
|
2285
|
-
* The inventory rows ingredients went back to.
|
|
2373
|
+
* The inventory rows ingredients went back to. Alchemy: wholly unmilled bowl, mortar and herb groups come back; everything else put on the table was spent. Smithing: a failed workpiece spends half of each divisible material, rounded down, and a coin decides a single unit; the rest comes back.
|
|
2286
2374
|
*/
|
|
2287
2375
|
refunded: InventoryUnit[];
|
|
2288
2376
|
}
|
|
@@ -2305,6 +2393,11 @@ declare global {
|
|
|
2305
2393
|
* Units required for one attempt.
|
|
2306
2394
|
*/
|
|
2307
2395
|
amount: number;
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* A quest item, which only its quest hands out: the game cannot create one, so the inventory refuses it (`questItem`) and Player.giveItem returns false. It must be held to craft, and is never taken.
|
|
2399
|
+
*/
|
|
2400
|
+
quest: boolean;
|
|
2308
2401
|
}
|
|
2309
2402
|
|
|
2310
2403
|
/**
|
|
@@ -2408,7 +2501,7 @@ declare global {
|
|
|
2408
2501
|
}
|
|
2409
2502
|
|
|
2410
2503
|
/**
|
|
2411
|
-
* Who holds
|
|
2504
|
+
* Who holds a station. A player keeps an alchemy table between batches until they leave it; a smithery is held for one workpiece.
|
|
2412
2505
|
*/
|
|
2413
2506
|
interface CraftStationOccupant {
|
|
2414
2507
|
/**
|
|
@@ -2427,9 +2520,9 @@ declare global {
|
|
|
2427
2520
|
sessionId: string;
|
|
2428
2521
|
|
|
2429
2522
|
/**
|
|
2430
|
-
* `entering` until the opening animation finishes; `finishing` while a finished batch waits to settle.
|
|
2523
|
+
* `entering` until the opening animation finishes; `finishing` while a finished batch waits to settle; `working` at a smithery.
|
|
2431
2524
|
*/
|
|
2432
|
-
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches';
|
|
2525
|
+
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches' | 'working';
|
|
2433
2526
|
|
|
2434
2527
|
/**
|
|
2435
2528
|
* Milliseconds until the table is taken back. Each batch has 30 minutes.
|
|
@@ -2438,7 +2531,7 @@ declare global {
|
|
|
2438
2531
|
}
|
|
2439
2532
|
|
|
2440
2533
|
/**
|
|
2441
|
-
* One
|
|
2534
|
+
* One station in one virtual world. A free station may still be unusable in the game, for instance behind a quest layer.
|
|
2442
2535
|
*/
|
|
2443
2536
|
interface CraftStationOccupancy {
|
|
2444
2537
|
/**
|
|
@@ -2463,11 +2556,16 @@ declare global {
|
|
|
2463
2556
|
}
|
|
2464
2557
|
|
|
2465
2558
|
/**
|
|
2466
|
-
* A player's alchemy session
|
|
2559
|
+
* A player's alchemy session or kept table, or their smithing workpiece. A copy: changing it changes nothing.
|
|
2467
2560
|
*/
|
|
2468
2561
|
interface CraftSessionInfo {
|
|
2469
2562
|
/**
|
|
2470
|
-
*
|
|
2563
|
+
* Which craft.
|
|
2564
|
+
*/
|
|
2565
|
+
kind: 'alchemy' | 'smithing';
|
|
2566
|
+
|
|
2567
|
+
/**
|
|
2568
|
+
* The session id.
|
|
2471
2569
|
*/
|
|
2472
2570
|
id: string;
|
|
2473
2571
|
|
|
@@ -2477,24 +2575,34 @@ declare global {
|
|
|
2477
2575
|
station: string;
|
|
2478
2576
|
|
|
2479
2577
|
/**
|
|
2480
|
-
* The
|
|
2578
|
+
* The station's virtual world.
|
|
2481
2579
|
*/
|
|
2482
2580
|
virtualWorld: number;
|
|
2483
2581
|
|
|
2484
2582
|
/**
|
|
2485
|
-
* Where the batch is.
|
|
2583
|
+
* Where the batch is; `working` for a smithing workpiece.
|
|
2584
|
+
*/
|
|
2585
|
+
phase: 'entering' | 'brewing' | 'finishing' | 'betweenBatches' | 'working';
|
|
2586
|
+
|
|
2587
|
+
/**
|
|
2588
|
+
* Alchemy only: native actions accepted so far.
|
|
2589
|
+
*/
|
|
2590
|
+
sequence: number | undefined;
|
|
2591
|
+
|
|
2592
|
+
/**
|
|
2593
|
+
* Alchemy only: what is on the table: item class, the inventory row it came from (empty for a base liquid), and the native table position.
|
|
2486
2594
|
*/
|
|
2487
|
-
|
|
2595
|
+
resources: { id: number; item: string; itemId: string; position: number; base: boolean; milled: boolean; distilled: boolean }[] | undefined;
|
|
2488
2596
|
|
|
2489
2597
|
/**
|
|
2490
|
-
*
|
|
2598
|
+
* Smithing only: the recipe being worked.
|
|
2491
2599
|
*/
|
|
2492
|
-
|
|
2600
|
+
recipe: string | undefined;
|
|
2493
2601
|
|
|
2494
2602
|
/**
|
|
2495
|
-
*
|
|
2603
|
+
* Smithing only: the units taken from the inventory for this workpiece. Quest materials are required but never taken.
|
|
2496
2604
|
*/
|
|
2497
|
-
|
|
2605
|
+
materials: { item: string; amount: number }[] | undefined;
|
|
2498
2606
|
|
|
2499
2607
|
/**
|
|
2500
2608
|
* Milliseconds until the session times out.
|
|
@@ -2503,11 +2611,11 @@ declare global {
|
|
|
2503
2611
|
}
|
|
2504
2612
|
|
|
2505
2613
|
/**
|
|
2506
|
-
* Crafting catalogs,
|
|
2614
|
+
* Crafting catalogs, station occupancy, alchemy and smithing sessions, and alchemy recipe knowledge. Held in memory for each connection; nothing is saved.
|
|
2507
2615
|
*/
|
|
2508
2616
|
const Crafting: {
|
|
2509
2617
|
/**
|
|
2510
|
-
* True
|
|
2618
|
+
* True: alchemy and smithing are both ruled by the server. Omitted kind checks alchemy.
|
|
2511
2619
|
*/
|
|
2512
2620
|
isAvailable(kind?: 'alchemy' | 'smithing'): boolean;
|
|
2513
2621
|
|
|
@@ -2522,17 +2630,17 @@ declare global {
|
|
|
2522
2630
|
recipes(player: Player, kind?: 'alchemy' | 'smithing'): readonly CraftRecipeInfo[];
|
|
2523
2631
|
|
|
2524
2632
|
/**
|
|
2525
|
-
* The player's alchemy session or the table they kept between batches,
|
|
2633
|
+
* The player's alchemy session or the table they kept between batches, else their smithing workpiece, else null.
|
|
2526
2634
|
*/
|
|
2527
2635
|
session(player: Player): CraftSessionInfo | null;
|
|
2528
2636
|
|
|
2529
2637
|
/**
|
|
2530
|
-
* Who holds a
|
|
2638
|
+
* Who holds a station. World defaults to 0. Null for an unknown station.
|
|
2531
2639
|
*/
|
|
2532
2640
|
occupancy(stationId: string, virtualWorld?: number): CraftStationOccupancy | null;
|
|
2533
2641
|
|
|
2534
2642
|
/**
|
|
2535
|
-
* Ends the player's session as leaving the
|
|
2643
|
+
* Ends the player's session as leaving the station would, and their game closes it. Alchemy: wholly unmilled groups go back to the inventory, the rest is spent. Smithing: the workpiece fails, spending its failure share. `craftingEnded` follows next tick. False when there was nothing to end.
|
|
2536
2644
|
*/
|
|
2537
2645
|
cancel(player: Player): boolean;
|
|
2538
2646
|
|
|
@@ -3156,6 +3264,173 @@ declare global {
|
|
|
3156
3264
|
|
|
3157
3265
|
interface Blip extends Entity {}
|
|
3158
3266
|
|
|
3267
|
+
/** */
|
|
3268
|
+
interface LevelEditDefinition {
|
|
3269
|
+
/**
|
|
3270
|
+
* What the object is; a brush when omitted. A brush has no identity of its own, so it is found by its mesh and where the level put it; a level entity by its EntityGuid.
|
|
3271
|
+
*/
|
|
3272
|
+
kind: 'brush' | 'entity' | undefined;
|
|
3273
|
+
|
|
3274
|
+
/**
|
|
3275
|
+
* A brush's mesh path, `objects/...cgf`, as the World Builder shows it; required for a brush. An entity's name, kept for reading only.
|
|
3276
|
+
*/
|
|
3277
|
+
name: string | undefined;
|
|
3278
|
+
|
|
3279
|
+
/**
|
|
3280
|
+
* An entity's level EntityGuid as sixteen hex digits; required for an entity.
|
|
3281
|
+
*/
|
|
3282
|
+
guid: string | undefined;
|
|
3283
|
+
|
|
3284
|
+
/**
|
|
3285
|
+
* An entity's class, kept for reading only.
|
|
3286
|
+
*/
|
|
3287
|
+
class: string | undefined;
|
|
3288
|
+
|
|
3289
|
+
/**
|
|
3290
|
+
* Where the level put the object: its pivot, matched within 5 cm. A brush's key, with its mesh.
|
|
3291
|
+
*/
|
|
3292
|
+
at: Vector3 | number[];
|
|
3293
|
+
|
|
3294
|
+
/**
|
|
3295
|
+
* Whether it is taken out of the world: not drawn and not solid.
|
|
3296
|
+
*/
|
|
3297
|
+
hidden: boolean | undefined;
|
|
3298
|
+
|
|
3299
|
+
/**
|
|
3300
|
+
* Where it stands instead; present, the edit is a move.
|
|
3301
|
+
*/
|
|
3302
|
+
position: Vector3 | number[] | undefined;
|
|
3303
|
+
|
|
3304
|
+
/**
|
|
3305
|
+
* A move's orientation: a Quaternion, {x, y, z, w} or [x, y, z, w]. None when omitted.
|
|
3306
|
+
*/
|
|
3307
|
+
rotation: Quaternion | number[] | undefined;
|
|
3308
|
+
|
|
3309
|
+
/**
|
|
3310
|
+
* A move's scale per axis, from 0.01 to 100. None when omitted.
|
|
3311
|
+
*/
|
|
3312
|
+
scale: Vector3 | number[] | undefined;
|
|
3313
|
+
}
|
|
3314
|
+
|
|
3315
|
+
/**
|
|
3316
|
+
* One change the server makes, for every player, to an object the level itself placed -- a brush or a level entity taken out of the world, moved, or both. It is what a World Builder map's `world` array carries.
|
|
3317
|
+
*/
|
|
3318
|
+
class LevelEdit {
|
|
3319
|
+
/**
|
|
3320
|
+
* Wraps an edit the server already holds; use LevelEdit.apply or LevelEdit.applyMap to make one.
|
|
3321
|
+
* @param id Network entity identifier.
|
|
3322
|
+
*/
|
|
3323
|
+
constructor(id: number);
|
|
3324
|
+
|
|
3325
|
+
/**
|
|
3326
|
+
* Immutable network entity identifier.
|
|
3327
|
+
*/
|
|
3328
|
+
readonly id: number;
|
|
3329
|
+
|
|
3330
|
+
/**
|
|
3331
|
+
* False once the edit has been restored; every other read then returns its empty value.
|
|
3332
|
+
*/
|
|
3333
|
+
readonly exists: boolean;
|
|
3334
|
+
|
|
3335
|
+
/**
|
|
3336
|
+
* Whether the object is a brush, found by its mesh and where the level put it, or a level entity, found by its EntityGuid.
|
|
3337
|
+
*/
|
|
3338
|
+
readonly kind: 'brush' | 'entity';
|
|
3339
|
+
|
|
3340
|
+
/**
|
|
3341
|
+
* A brush's mesh path, or the name the level gives the entity.
|
|
3342
|
+
*/
|
|
3343
|
+
readonly name: string;
|
|
3344
|
+
|
|
3345
|
+
/**
|
|
3346
|
+
* An entity's level EntityGuid as sixteen lowercase hex digits; empty for a brush.
|
|
3347
|
+
*/
|
|
3348
|
+
readonly guid: string;
|
|
3349
|
+
|
|
3350
|
+
/**
|
|
3351
|
+
* The virtual world whose players see the edit, fixed when it was applied.
|
|
3352
|
+
*/
|
|
3353
|
+
readonly virtualWorld: number;
|
|
3354
|
+
|
|
3355
|
+
/**
|
|
3356
|
+
* Whether the object is taken out of the world: not drawn and not solid. Assignment takes it out or puts it back for every player, keeping any move.
|
|
3357
|
+
*/
|
|
3358
|
+
hidden: boolean;
|
|
3359
|
+
|
|
3360
|
+
/**
|
|
3361
|
+
* Whether the object stands somewhere other than where the level placed it; `move` and `clearMove` change it.
|
|
3362
|
+
*/
|
|
3363
|
+
readonly moved: boolean;
|
|
3364
|
+
|
|
3365
|
+
/**
|
|
3366
|
+
* Formats this edit for logging and debugging.
|
|
3367
|
+
* @returns Its id, kind, object and what it does to it.
|
|
3368
|
+
*/
|
|
3369
|
+
toString(): string;
|
|
3370
|
+
|
|
3371
|
+
/**
|
|
3372
|
+
* Moves the object for every player, collision included.
|
|
3373
|
+
* @param position Where the object stands instead.
|
|
3374
|
+
* @param rotation Its orientation: a Quaternion, or Euler angles in degrees. Left out, it keeps the last move's.
|
|
3375
|
+
* @param scale A uniform scale or one per axis, from 0.01 to 100. Left out, it keeps the last move's.
|
|
3376
|
+
* @returns False for a gone edit or a transform that is not finite.
|
|
3377
|
+
*/
|
|
3378
|
+
move(position: Vector3, rotation?: Quaternion | Vector3, scale?: number | Vector3): boolean;
|
|
3379
|
+
|
|
3380
|
+
/**
|
|
3381
|
+
* Puts the object back where the level placed it, keeping it out of the world if the edit takes it out.
|
|
3382
|
+
*/
|
|
3383
|
+
clearMove(): void;
|
|
3384
|
+
|
|
3385
|
+
/**
|
|
3386
|
+
* Drops the edit: every player gets the object back exactly as the level had it, collision included.
|
|
3387
|
+
*/
|
|
3388
|
+
restore(): void;
|
|
3389
|
+
|
|
3390
|
+
/**
|
|
3391
|
+
* The definition `LevelEdit.apply` takes to make this edit again, which is what a script saves: the server keeps nothing past a restart. It is one entry of a World Builder map's `world` array.
|
|
3392
|
+
* @returns Null once the edit is gone.
|
|
3393
|
+
*/
|
|
3394
|
+
toJSON(): LevelEditDefinition | null;
|
|
3395
|
+
|
|
3396
|
+
/**
|
|
3397
|
+
* Takes an object the level placed out of the world, or moves it, for every player in the virtual world -- whenever they join, and however far away they are. Collision goes with it. An edit already made to the same object in that world is restated rather than doubled, so applying one twice changes nothing. Kept in memory only: apply it again on boot.
|
|
3398
|
+
* @param definition The object and what to do to it, in the format of one entry of a World Builder map's `world` array.
|
|
3399
|
+
* @param virtualWorld Optional virtual world whose players see it; the global one when omitted.
|
|
3400
|
+
* @returns The edit. Throws for a definition no client could find the object by.
|
|
3401
|
+
*/
|
|
3402
|
+
static apply(definition: LevelEditDefinition, virtualWorld?: number): LevelEdit;
|
|
3403
|
+
|
|
3404
|
+
/**
|
|
3405
|
+
* Applies every entry of a map's `world` array, which is how edits made in the World Builder reach every player instead of being loaded by hand on each.
|
|
3406
|
+
* @param map A World Builder map saved from the editor, as its JSON text or the parsed object. Only its `world` array is read: its placed objects are `Prop.spawn`'s, its areas `Area.create`'s.
|
|
3407
|
+
* @param virtualWorld Optional virtual world whose players see the edits; the global one when omitted.
|
|
3408
|
+
* @returns One edit per entry, in the map's order. Throws, naming the entry, for one no client could find the object by.
|
|
3409
|
+
*/
|
|
3410
|
+
static applyMap(map: string | Record<string, unknown>, virtualWorld?: number): LevelEdit[];
|
|
3411
|
+
|
|
3412
|
+
/**
|
|
3413
|
+
* Lists every edit the server currently has.
|
|
3414
|
+
* @param virtualWorld Optional virtual world to list; omitted lists every one of them.
|
|
3415
|
+
* @returns One handle per live edit, in no particular order.
|
|
3416
|
+
*/
|
|
3417
|
+
static all(virtualWorld?: number): LevelEdit[];
|
|
3418
|
+
|
|
3419
|
+
/**
|
|
3420
|
+
* Looks an edit up by its network entity ID.
|
|
3421
|
+
* @param id Network entity identifier.
|
|
3422
|
+
* @returns The edit, or null when no live edit has that ID.
|
|
3423
|
+
*/
|
|
3424
|
+
static getById(id: number): LevelEdit | null;
|
|
3425
|
+
|
|
3426
|
+
/**
|
|
3427
|
+
* Drops edits, giving every player the objects back as the level had them.
|
|
3428
|
+
* @param virtualWorld Optional virtual world to clear; omitted clears every one of them.
|
|
3429
|
+
* @returns How many edits were dropped.
|
|
3430
|
+
*/
|
|
3431
|
+
static restoreAll(virtualWorld?: number): number;
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3159
3434
|
/**
|
|
3160
3435
|
* A server-owned NPC: spawned by a resource, simulated by whichever client is nearest.
|
|
3161
3436
|
*/
|
|
@@ -3269,6 +3544,54 @@ declare global {
|
|
|
3269
3544
|
*/
|
|
3270
3545
|
toString(): string;
|
|
3271
3546
|
|
|
3547
|
+
/**
|
|
3548
|
+
* Checks whether this NPC's nametag is drawn; the same switch as the `nametag` property.
|
|
3549
|
+
* @returns True while the nametag is shown.
|
|
3550
|
+
*/
|
|
3551
|
+
isNametagVisible(): boolean;
|
|
3552
|
+
|
|
3553
|
+
/**
|
|
3554
|
+
* Shows or hides the name over this NPC's head for every player; the same switch as the `nametag` property. Each player can still hide all nametags locally.
|
|
3555
|
+
* @param visible True to draw this NPC's nametag for every player, false to hide it.
|
|
3556
|
+
*/
|
|
3557
|
+
setNametagVisible(visible: boolean): void;
|
|
3558
|
+
|
|
3559
|
+
/**
|
|
3560
|
+
* Checks whether the health bar under this NPC's nametag is shown.
|
|
3561
|
+
* @returns True unless the health bar was hidden.
|
|
3562
|
+
*/
|
|
3563
|
+
isNametagHealthVisible(): boolean;
|
|
3564
|
+
|
|
3565
|
+
/**
|
|
3566
|
+
* Shows or hides the health bar under this NPC's nametag, leaving the name itself alone.
|
|
3567
|
+
* @param visible True to show the health bar under this NPC's name, false to hide it.
|
|
3568
|
+
*/
|
|
3569
|
+
setNametagHealthVisible(visible: boolean): void;
|
|
3570
|
+
|
|
3571
|
+
/**
|
|
3572
|
+
* Reads this NPC's nametag text override.
|
|
3573
|
+
* @returns The override, or an empty string when the NPC's `name` is drawn.
|
|
3574
|
+
*/
|
|
3575
|
+
getNametagText(): string;
|
|
3576
|
+
|
|
3577
|
+
/**
|
|
3578
|
+
* Overrides the text drawn on this NPC's nametag without renaming it: `name` still reaches conversation and the soul.
|
|
3579
|
+
* @param text Text to show instead of the NPC's name; empty or omitted restores the name.
|
|
3580
|
+
*/
|
|
3581
|
+
setNametagText(text?: string): void;
|
|
3582
|
+
|
|
3583
|
+
/**
|
|
3584
|
+
* Reads this NPC's nametag color.
|
|
3585
|
+
* @returns Packed 0xAARRGGBB color; opaque white when untinted.
|
|
3586
|
+
*/
|
|
3587
|
+
getNametagColor(): number;
|
|
3588
|
+
|
|
3589
|
+
/**
|
|
3590
|
+
* Tints the text on this NPC's nametag.
|
|
3591
|
+
* @param color Packed 0xAARRGGBB color.
|
|
3592
|
+
*/
|
|
3593
|
+
setNametagColor(color: number): void;
|
|
3594
|
+
|
|
3272
3595
|
/**
|
|
3273
3596
|
* Despawns this NPC everywhere, after emitting npcDestroy.
|
|
3274
3597
|
*/
|
|
@@ -3862,6 +4185,11 @@ declare global {
|
|
|
3862
4185
|
*/
|
|
3863
4186
|
readonly lockpickable: boolean;
|
|
3864
4187
|
|
|
4188
|
+
/**
|
|
4189
|
+
* The level areas that link this door as one of their `crime_door`s -- the house, workshop or storage room it belongs to, as the level itself records it. Nothing is inferred from where the door stands.
|
|
4190
|
+
*/
|
|
4191
|
+
readonly areas: Area[];
|
|
4192
|
+
|
|
3865
4193
|
/**
|
|
3866
4194
|
* Whether the level builds this door locked, which is the state it has at boot.
|
|
3867
4195
|
*/
|
|
@@ -3902,6 +4230,13 @@ declare global {
|
|
|
3902
4230
|
*/
|
|
3903
4231
|
static find(guid: string, virtualWorld?: number): Door | null;
|
|
3904
4232
|
|
|
4233
|
+
/**
|
|
4234
|
+
* Lists the doors the level links to an area as its `crime_door`s, with their GUID, name, position and link type, straight from the level catalog -- so a door that no client has reported yet is listed too. Pass a `guid` to `Door.find` for the live handle and its `locked` state. Only native links: a script area has none.
|
|
4235
|
+
* @param areaId The area's id, as `area.id` prints it.
|
|
4236
|
+
* @returns The doors; empty for an unknown area or one with no links.
|
|
4237
|
+
*/
|
|
4238
|
+
static getForArea(areaId: string): AreaDoor[];
|
|
4239
|
+
|
|
3905
4240
|
/**
|
|
3906
4241
|
* Asks a player's client which door their body is standing at. The server knows every door the level places but has no world to measure distances in, so this is how a command finds the door in front of a player, and the answer is what that client sees now rather than what the replica last carried.
|
|
3907
4242
|
*
|
|
@@ -4028,6 +4363,294 @@ declare global {
|
|
|
4028
4363
|
|
|
4029
4364
|
interface Gate extends Entity {}
|
|
4030
4365
|
|
|
4366
|
+
/** */
|
|
4367
|
+
interface AreaDefinition {
|
|
4368
|
+
/**
|
|
4369
|
+
* The area's identity, unique among script areas. It may not be sixteen hex digits, which is how a level area's GUID reads.
|
|
4370
|
+
*/
|
|
4371
|
+
id: string;
|
|
4372
|
+
|
|
4373
|
+
/**
|
|
4374
|
+
* A readable name; the id when omitted.
|
|
4375
|
+
*/
|
|
4376
|
+
name: string | undefined;
|
|
4377
|
+
|
|
4378
|
+
/**
|
|
4379
|
+
* CryEngine's own area shapes: `AreaBox`, `AreaShape` (a closed polygon with a height) and `AreaSphere`.
|
|
4380
|
+
*/
|
|
4381
|
+
type: 'box' | 'shape' | 'sphere';
|
|
4382
|
+
|
|
4383
|
+
/**
|
|
4384
|
+
* Where the shape is placed from; the origin when omitted.
|
|
4385
|
+
*/
|
|
4386
|
+
position: Vector3 | undefined;
|
|
4387
|
+
|
|
4388
|
+
/**
|
|
4389
|
+
* The shape's orientation: a Quaternion or {x, y, z, w}, or Euler angles in degrees.
|
|
4390
|
+
*/
|
|
4391
|
+
rotation: Quaternion | Vector3 | undefined;
|
|
4392
|
+
|
|
4393
|
+
/**
|
|
4394
|
+
* box: the corner nearest negative infinity, relative to `position` before rotation.
|
|
4395
|
+
*/
|
|
4396
|
+
min: Vector3 | undefined;
|
|
4397
|
+
|
|
4398
|
+
/**
|
|
4399
|
+
* box: the opposite corner. Every component must be above `min`'s.
|
|
4400
|
+
*/
|
|
4401
|
+
max: Vector3 | undefined;
|
|
4402
|
+
|
|
4403
|
+
/**
|
|
4404
|
+
* shape: 3 to 256 corners relative to `position` before rotation, closed back to the first. As in the engine, the floor is the lowest corner.
|
|
4405
|
+
*/
|
|
4406
|
+
points: Vector3[] | undefined;
|
|
4407
|
+
|
|
4408
|
+
/**
|
|
4409
|
+
* shape: how far above its lowest corner the area reaches; 0, the default, for no ceiling.
|
|
4410
|
+
*/
|
|
4411
|
+
height: number | undefined;
|
|
4412
|
+
|
|
4413
|
+
/**
|
|
4414
|
+
* sphere: its radius around `position`.
|
|
4415
|
+
*/
|
|
4416
|
+
radius: number | undefined;
|
|
4417
|
+
|
|
4418
|
+
/**
|
|
4419
|
+
* Free-form labels, found again with `Area.withLabel`.
|
|
4420
|
+
*/
|
|
4421
|
+
labels: string[] | undefined;
|
|
4422
|
+
|
|
4423
|
+
/**
|
|
4424
|
+
* Anything JSON can hold, kept on the area for scripts.
|
|
4425
|
+
*/
|
|
4426
|
+
metadata: Record<string, unknown> | undefined;
|
|
4427
|
+
|
|
4428
|
+
/**
|
|
4429
|
+
* The one virtual world it belongs to; every world when omitted.
|
|
4430
|
+
*/
|
|
4431
|
+
virtualWorld: number | undefined;
|
|
4432
|
+
|
|
4433
|
+
/**
|
|
4434
|
+
* Whether it starts enabled; true when omitted.
|
|
4435
|
+
*/
|
|
4436
|
+
enabled: boolean | undefined;
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
/** */
|
|
4440
|
+
interface AreaDoor {
|
|
4441
|
+
/**
|
|
4442
|
+
* The door's level EntityGuid as hex, which `Door.find` takes.
|
|
4443
|
+
*/
|
|
4444
|
+
guid: string;
|
|
4445
|
+
|
|
4446
|
+
/**
|
|
4447
|
+
* The entity name the level gives the door.
|
|
4448
|
+
*/
|
|
4449
|
+
name: string;
|
|
4450
|
+
|
|
4451
|
+
/**
|
|
4452
|
+
* Where the level places the door.
|
|
4453
|
+
*/
|
|
4454
|
+
position: Vector3;
|
|
4455
|
+
|
|
4456
|
+
/**
|
|
4457
|
+
* The `crime_doorKind` the level gives the link: the way in, an inner door, or a storage room's.
|
|
4458
|
+
*/
|
|
4459
|
+
link: 'entrance' | 'basic' | 'storage';
|
|
4460
|
+
}
|
|
4461
|
+
|
|
4462
|
+
/**
|
|
4463
|
+
* Handle for one area: one of the level's own gameplay areas, or one a script or the World Builder drew. The server tests who is inside itself, by the game's own rule for that kind of area.
|
|
4464
|
+
*/
|
|
4465
|
+
class Area {
|
|
4466
|
+
/**
|
|
4467
|
+
* Wraps an area handle the server already holds; use Area.create, Area.getById or the lookups to get one.
|
|
4468
|
+
* @param handle Internal area handle.
|
|
4469
|
+
*/
|
|
4470
|
+
constructor(handle: number);
|
|
4471
|
+
|
|
4472
|
+
/**
|
|
4473
|
+
* False once a script area has been destroyed; every other read then returns its empty value.
|
|
4474
|
+
*/
|
|
4475
|
+
readonly exists: boolean;
|
|
4476
|
+
|
|
4477
|
+
/**
|
|
4478
|
+
* The stable identity to store an area under. A level area's is its EntityGuid as sixteen lowercase hex digits, the same on every machine and every boot, as `door.guid` prints a door's; a script area's is the id it was created with.
|
|
4479
|
+
*/
|
|
4480
|
+
readonly id: string;
|
|
4481
|
+
|
|
4482
|
+
/**
|
|
4483
|
+
* Whether the level placed it or a script built it.
|
|
4484
|
+
*/
|
|
4485
|
+
readonly kind: 'level' | 'script';
|
|
4486
|
+
|
|
4487
|
+
/**
|
|
4488
|
+
* A level area's entity class -- a `TriggerArea` prism, an `AreaUnion` of them, or a `SmartAreaShape` -- or a script area's shape.
|
|
4489
|
+
*/
|
|
4490
|
+
readonly type: 'TriggerArea' | 'AreaUnion' | 'SmartAreaShape' | 'box' | 'shape' | 'sphere';
|
|
4491
|
+
|
|
4492
|
+
/**
|
|
4493
|
+
* The level's entity name, or the script area's name. Only a script area's can be changed.
|
|
4494
|
+
*/
|
|
4495
|
+
name: string;
|
|
4496
|
+
|
|
4497
|
+
/**
|
|
4498
|
+
* The level's own `Label` values -- `private`, `personal`, `interior`, `prohibited`, `castle` and the rest the game's AI reads -- or a script area's labels. Only a script area's can be changed.
|
|
4499
|
+
*/
|
|
4500
|
+
labels: string[];
|
|
4501
|
+
|
|
4502
|
+
/**
|
|
4503
|
+
* Whatever a script keeps on a script area: ownership, a type, rules. Stored as JSON, so read it, change it and assign it back. Always empty on a level area.
|
|
4504
|
+
*/
|
|
4505
|
+
metadata: Record<string, unknown>;
|
|
4506
|
+
|
|
4507
|
+
/**
|
|
4508
|
+
* Whether crossings are raised and the lookups find it. Switching it off raises `areaExit` for everyone inside on the next tick; switching it on, `areaEnter`. Works on level areas too.
|
|
4509
|
+
*/
|
|
4510
|
+
enabled: boolean;
|
|
4511
|
+
|
|
4512
|
+
/**
|
|
4513
|
+
* The one virtual world a script area belongs to, or null for all of them. A body in another world still crosses it, with `matchingVirtualWorld` false. A level area is in every world.
|
|
4514
|
+
*/
|
|
4515
|
+
virtualWorld: number | null;
|
|
4516
|
+
|
|
4517
|
+
/**
|
|
4518
|
+
* A script area's origin, which its shape is placed from; assignment moves it. A level area's is the centre of its bounds.
|
|
4519
|
+
*/
|
|
4520
|
+
position: Vector3;
|
|
4521
|
+
|
|
4522
|
+
/**
|
|
4523
|
+
* A script area's orientation; assignment turns it. A level area's shape is already in world space, so its rotation is the identity.
|
|
4524
|
+
*/
|
|
4525
|
+
rotation: Quaternion;
|
|
4526
|
+
|
|
4527
|
+
/**
|
|
4528
|
+
* How far above its lowest point a prism reaches, in metres; 0 for a shape with no ceiling. A TriggerArea's comes from the level's baked prism.
|
|
4529
|
+
*/
|
|
4530
|
+
readonly height: number;
|
|
4531
|
+
|
|
4532
|
+
/**
|
|
4533
|
+
* For a SmartAreaShape bound to one of the game's map locations, that location's English name, e.g. a settlement. Empty otherwise.
|
|
4534
|
+
*/
|
|
4535
|
+
readonly location: string;
|
|
4536
|
+
|
|
4537
|
+
/**
|
|
4538
|
+
* The world box around the area. An area with no ceiling reaches far above and below.
|
|
4539
|
+
*/
|
|
4540
|
+
readonly bounds: { min: Vector3; max: Vector3 };
|
|
4541
|
+
|
|
4542
|
+
/**
|
|
4543
|
+
* For an AreaUnion, the TriggerAreas it joins; it contains whatever one of them does. Empty otherwise.
|
|
4544
|
+
*/
|
|
4545
|
+
readonly members: Area[];
|
|
4546
|
+
|
|
4547
|
+
/**
|
|
4548
|
+
* The doors the level itself links to this area as its `crime_door`s, which is how the game knows a house's doors. Only native links: nothing is inferred from where a door stands.
|
|
4549
|
+
*/
|
|
4550
|
+
readonly doors: AreaDoor[];
|
|
4551
|
+
|
|
4552
|
+
/**
|
|
4553
|
+
* Every player inside as of the last tick, in any world.
|
|
4554
|
+
*/
|
|
4555
|
+
readonly players: Player[];
|
|
4556
|
+
|
|
4557
|
+
/**
|
|
4558
|
+
* Every body inside as of the last tick: players, horses, carts and server NPCs.
|
|
4559
|
+
*/
|
|
4560
|
+
readonly occupants: (Player | Horse | Cart | Npc)[];
|
|
4561
|
+
|
|
4562
|
+
/**
|
|
4563
|
+
* Formats this area for logging and debugging.
|
|
4564
|
+
* @returns Its id, kind, type and name.
|
|
4565
|
+
*/
|
|
4566
|
+
toString(): string;
|
|
4567
|
+
|
|
4568
|
+
/**
|
|
4569
|
+
* Tests a position the way the game tests its own areas, whether or not the area is enabled and in whatever world.
|
|
4570
|
+
* @param position The world position to test.
|
|
4571
|
+
* @returns True when the position is inside.
|
|
4572
|
+
*/
|
|
4573
|
+
contains(position: Vector3): boolean;
|
|
4574
|
+
|
|
4575
|
+
/**
|
|
4576
|
+
* Tests where a body stands right now, and in which world: an area bound to another virtual world does not contain it. This is containment only -- whether the game considers the player to be trespassing is decided by its own crime system on the player's client.
|
|
4577
|
+
* @param player The body to test; a player who has not reported a pose yet is never inside.
|
|
4578
|
+
* @returns True when the body is inside.
|
|
4579
|
+
*/
|
|
4580
|
+
containsPlayer(player: Player | Horse | Cart | Npc): boolean;
|
|
4581
|
+
|
|
4582
|
+
/**
|
|
4583
|
+
* Moves, turns or reshapes a script area. Bodies standing where it now is, or was, get their `areaEnter` and `areaExit` on the next tick. A level area cannot be reshaped.
|
|
4584
|
+
* @param definition The shape fields to change; any left out keep their value. `id`, `labels`, `metadata` and the rest are ignored here.
|
|
4585
|
+
* @returns False for a level area, a gone one, or a shape the engine could not build.
|
|
4586
|
+
*/
|
|
4587
|
+
setShape(definition: Partial<AreaDefinition>): boolean;
|
|
4588
|
+
|
|
4589
|
+
/**
|
|
4590
|
+
* Removes a script area. Every body still inside gets its `areaExit` first, while the handle still resolves.
|
|
4591
|
+
* @returns False for a level area or one already gone.
|
|
4592
|
+
*/
|
|
4593
|
+
destroy(): boolean;
|
|
4594
|
+
|
|
4595
|
+
/**
|
|
4596
|
+
* The definition `Area.create` takes to build this area again, which is what a script saves: the server keeps nothing past a restart. It is the format the World Builder exports too.
|
|
4597
|
+
* @returns Null for a level area, which the level always builds.
|
|
4598
|
+
*/
|
|
4599
|
+
toJSON(): AreaDefinition | null;
|
|
4600
|
+
|
|
4601
|
+
/**
|
|
4602
|
+
* Builds a script area. Bodies already standing in it get `areaEnter` on the next tick. Kept in memory only: save `area.toJSON()` wherever the resource keeps its data, and create it again on boot.
|
|
4603
|
+
* @param definition The area to build, in the format `area.toJSON()` and the World Builder export write.
|
|
4604
|
+
* @returns The new area. Throws for an id already taken or a shape the engine could not build.
|
|
4605
|
+
*/
|
|
4606
|
+
static create(definition: AreaDefinition): Area;
|
|
4607
|
+
|
|
4608
|
+
/**
|
|
4609
|
+
* Looks an area up by its stable identity.
|
|
4610
|
+
* @param id A script area's id, or a level area's GUID in hex as `area.definition.id` prints it.
|
|
4611
|
+
* @returns The area, or null when there is none.
|
|
4612
|
+
*/
|
|
4613
|
+
static getById(id: string): Area | null;
|
|
4614
|
+
|
|
4615
|
+
/**
|
|
4616
|
+
* Every enabled area containing a position, level and script alike.
|
|
4617
|
+
* @param position The world position to test.
|
|
4618
|
+
* @param virtualWorld Optional world; when given, a script area bound to another world is left out.
|
|
4619
|
+
* @returns The areas, in no particular order.
|
|
4620
|
+
*/
|
|
4621
|
+
static getAt(position: Vector3, virtualWorld?: number): Area[];
|
|
4622
|
+
|
|
4623
|
+
/**
|
|
4624
|
+
* Every enabled area the body stands in right now, in its own world.
|
|
4625
|
+
* @param player The body whose position and world to test.
|
|
4626
|
+
* @returns The areas; empty for a player who has not reported a pose yet.
|
|
4627
|
+
*/
|
|
4628
|
+
static getAtPlayer(player: Player | Horse | Cart | Npc): Area[];
|
|
4629
|
+
|
|
4630
|
+
/**
|
|
4631
|
+
* Every area whose bounds come within a radius of a position, enabled or not.
|
|
4632
|
+
* @param position Where to look from.
|
|
4633
|
+
* @param radius How far, in metres, from the area's bounds.
|
|
4634
|
+
* @param virtualWorld Optional world; when given, a script area bound to another world is left out.
|
|
4635
|
+
* @returns The areas, nearest first.
|
|
4636
|
+
*/
|
|
4637
|
+
static nearby(position: Vector3, radius: number, virtualWorld?: number): Area[];
|
|
4638
|
+
|
|
4639
|
+
/**
|
|
4640
|
+
* Every area carrying a label, such as `private` or `castle`.
|
|
4641
|
+
* @param label The label, compared without regard to case.
|
|
4642
|
+
* @returns The areas, level ones first.
|
|
4643
|
+
*/
|
|
4644
|
+
static withLabel(label: string): Area[];
|
|
4645
|
+
|
|
4646
|
+
/**
|
|
4647
|
+
* Every area the server knows.
|
|
4648
|
+
* @param kind Optional: only the level's areas, or only script ones.
|
|
4649
|
+
* @returns The areas, level ones first.
|
|
4650
|
+
*/
|
|
4651
|
+
static all(kind?: 'level' | 'script'): Area[];
|
|
4652
|
+
}
|
|
4653
|
+
|
|
4031
4654
|
/**
|
|
4032
4655
|
* Replicated container handle: one a script spawned, or one the level places.
|
|
4033
4656
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingdomsconnected/types",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
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": [
|