@kingdomsconnected/types 1.6.4 → 1.6.6

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.
@@ -120,6 +120,36 @@ declare global {
120
120
  */
121
121
  playerReady: [player: Player];
122
122
 
123
+ /**
124
+ * After the server receives changed player stats, including poison strength, drunkenness, health loss and potion-related readings. Changes are snapshots batched per server tick. The first valid report and each new body establish a baseline. These are observations, not cancellable requests; the client can coalesce intermediate values. No cause is inferred. Use consumption vetoes and custom server effects to decide gameplay before it happens.
125
+ */
126
+ playerStatsChanged: [player: Player, changes: { stat: "health" | "stamina" | "exhaust" | "hunger" | "bleeding" | "sleeping" | "consciousness" | "drunkenness" | "poisoning" | "charisma" | "visibility" | "conspicuousness" | "noise" | "dirtiness" | "bloodiness" | "smell" | "smellIntensity" | "fragrance" | "carriedWeight" | "inventoryCapacity" | "encumbrance" | "hangover" | "alcoholism" | "armorRating" | "overallArmorDefense" | "overallWeaponAttack" | "normalizedRunSpeed" | "runSpeedBase" | "morale"; previous: number; current: number }[]];
127
+
128
+ /**
129
+ * Before reserving a food or potion unit or pot serving. Return false synchronously to refuse without spending stock or applying effects. Async handlers cannot veto. Do not apply replacement effects here: native use can still fail.
130
+ */
131
+ playerConsuming: [player: Player, consumption: Consumption];
132
+
133
+ /**
134
+ * After playerConsuming accepts, before reservation. Return false synchronously to consume without native nutrition, energy, alcohol, potion, spoilage or added pot poison effects. Apply custom effects in playerConsumed using player.setStat, addBuff and clearBuffs.
135
+ */
136
+ playerConsumptionEffects: [player: Player, consumption: Consumption];
137
+
138
+ /**
139
+ * Before applying a reserved pot meal's additional poison on its eating receipt. Return false synchronously to suppress it. Runs only when nativeEffects is true. Native food spoilage and item buffs can be replaced through playerConsumptionEffects and Buffs.claim.
140
+ */
141
+ playerPoisonAbsorbing: [player: Player, consumption: Consumption, buff: string];
142
+
143
+ /**
144
+ * Once after the owning client confirms successful use. Use for custom stat changes and buffs after suppressing native effects. Missing receipts and expired or replaced bodies never raise it. Inventory uses also raise playerItemUsed.
145
+ */
146
+ playerConsumed: [player: Player, consumption: Consumption];
147
+
148
+ /**
149
+ * A validated custom-item action. The frozen row includes server-only data. Scripts decide what happens and explicitly consume items.
150
+ */
151
+ playerCustomItemUse: [player: Player, item: InventoryRow, revision: number];
152
+
123
153
  /**
124
154
  * An inventory changed. Raised on the next server tick in the order the changes happened, once per inventory an operation touched: a transfer raises it for both players. A handler may change inventories; those changes arrive on a later tick. Every change of a player who disconnects is raised before `playerDisconnect`. Save from here to keep inventories across sessions -- the server keeps nothing itself.
125
155
  */
@@ -231,6 +261,26 @@ declare global {
231
261
  */
232
262
  playerPickpocketCaught: [thief: Player, victim: Player];
233
263
 
264
+ /**
265
+ * A new turn begins, including turns after automatic busts.
266
+ */
267
+ diceTurnStart: [event: DiceProgressEvent];
268
+
269
+ /**
270
+ * The server dealt a roll. Includes all six face values and the mask rolled this time.
271
+ */
272
+ diceRoll: [event: DiceProgressEvent];
273
+
274
+ /**
275
+ * The server accepted Continue or Pass. Invalid or repeated requests emit nothing.
276
+ */
277
+ diceMove: [event: DiceProgressEvent];
278
+
279
+ /**
280
+ * A turn ended by banking, busting, winning, or a match ending. A round means one player's turn.
281
+ */
282
+ diceTurnEnd: [event: DiceProgressEvent];
283
+
234
284
  /**
235
285
  * Dispatched once a match has started and both players have been sent to the table. Which of them throws first is drawn at random.
236
286
  */
@@ -361,6 +411,21 @@ declare global {
361
411
  */
362
412
  npcSpawn: [npc: Npc];
363
413
 
414
+ /**
415
+ * Its initial inventory has been established. The default stock is censused once by its elected simulator; Inventory.set establishes authored stock immediately.
416
+ */
417
+ npcInventoryReady: [npc: Npc];
418
+
419
+ /**
420
+ * An accepted butchering completion. The prepopulated stock is now accessible and every client applies the butchered appearance. Emitted once per life; save Inventory.get(npc) here too to persist the harvested flag.
421
+ */
422
+ npcHarvested: [npc: Npc, player: Player];
423
+
424
+ /**
425
+ * Committed stock changes, including loot transfers. Save this stock and restore it with Inventory.set. Harvest completion is reported by npcHarvested.
426
+ */
427
+ npcInventoryChanged: [npc: Npc, change: InventoryChange];
428
+
364
429
  /**
365
430
  * Dispatched while an NPC is being despawned. The handle still resolves, so what it was and where it stood can be read one last time.
366
431
  */
@@ -468,6 +533,16 @@ declare global {
468
533
  */
469
534
  siegeEngineUse: [player: Player, engine: SiegeEngine, action: "operate" | "winch" | "leave" | "load" | "fire"];
470
535
 
536
+ /**
537
+ * Dispatched when a blast takes `amount` off an engine with a `maxHealth`, before it is wrecked by it. `health` already reads what is left.
538
+ */
539
+ siegeEngineDamage: [engine: SiegeEngine, amount: number, attacker: Player | null];
540
+
541
+ /**
542
+ * Dispatched when an engine's health runs out. Its operator and crew have been let go, and a stone still in its sling went down with it.
543
+ */
544
+ siegeEngineWreck: [engine: SiegeEngine, attacker: Player | null];
545
+
471
546
  /**
472
547
  * Dispatched the moment an engine lets its projectile go, partway through the shot `fire` started.
473
548
  */
@@ -478,6 +553,51 @@ declare global {
478
553
  */
479
554
  siegeImpact: [engine: SiegeEngine | null, position: Vector3, attacker: Player | null];
480
555
 
556
+ /**
557
+ * Dispatched immediately after a siege ladder is placed.
558
+ */
559
+ siegeLadderSpawn: [ladder: SiegeLadder];
560
+
561
+ /**
562
+ * Dispatched while a siege ladder is being removed. The handle still resolves.
563
+ */
564
+ siegeLadderDestroy: [ladder: SiegeLadder];
565
+
566
+ /**
567
+ * Dispatched when a player asks to push a `usable` ladder from the walk at its top, or to raise a fallen one from beside its foot. Return false to refuse.
568
+ */
569
+ siegeLadderUse: [player: Player, ladder: SiegeLadder, action: "push" | "raise"];
570
+
571
+ /**
572
+ * Dispatched when a pushed ladder hits the ground. Anyone who was on it was thrown off as it began to fall, and took the game's own fall.
573
+ */
574
+ siegeLadderFall: [ladder: SiegeLadder, pusher: Player | null];
575
+
576
+ /**
577
+ * Dispatched when a raised ladder leans on its wall again and can be climbed.
578
+ */
579
+ siegeLadderRaise: [ladder: SiegeLadder];
580
+
581
+ /**
582
+ * Dispatched immediately after a stone pile is placed.
583
+ */
584
+ stonePileSpawn: [pile: StonePile];
585
+
586
+ /**
587
+ * Dispatched while a stone pile is being removed. The handle still resolves.
588
+ */
589
+ stonePileDestroy: [pile: StonePile];
590
+
591
+ /**
592
+ * Dispatched when a player takes a stone off a pile. The game's own stone throwing has already lifted it and heaves it over the wall at once, so it cannot be refused; make the pile not `usable` to stop the next one.
593
+ */
594
+ stonePileThrow: [player: Player, pile: StonePile];
595
+
596
+ /**
597
+ * Dispatched where a thrown stone first met something, as its thrower saw it, checked to lie within 30 m of its pile. Players within the pile's `damageRadius` have been told to take their share, and NPCs have taken theirs.
598
+ */
599
+ stoneImpact: [pile: StonePile | null, position: Vector3, attacker: Player];
600
+
481
601
  /**
482
602
  * 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.
483
603
  */
@@ -619,61 +739,6 @@ declare global {
619
739
  * Dispatched when a player asks to join, before the connection exists: they hold no player slot, are not counted as online, and are sent nothing -- no resource list, no download, no body. The request waits until every handler has returned and every Promise a handler returned has settled, then it is let in if a player slot is free (otherwise it is refused as full). `connection.reject()` turns it away instead, and so does a handler that throws or rejects, or handlers that have not settled within the server's admission timeout (30 seconds by default, restarted by every `connection.update()`). With no handler at all, every request is let in at once.
620
740
  */
621
741
  playerConnecting: [connection: PendingConnection];
622
-
623
- /**
624
- * Dispatched when a blast takes `amount` off an engine with a `maxHealth`, before it is wrecked by it. `health` already reads what is left.
625
- */
626
- siegeEngineDamage: [engine: SiegeEngine, amount: number, attacker: Player | null];
627
-
628
- /**
629
- * Dispatched when an engine's health runs out. Its operator and crew have been let go, and a stone still in its sling went down with it.
630
- */
631
- siegeEngineWreck: [engine: SiegeEngine, attacker: Player | null];
632
-
633
- /**
634
- * Dispatched immediately after a siege ladder is placed.
635
- */
636
- siegeLadderSpawn: [ladder: SiegeLadder];
637
-
638
- /**
639
- * Dispatched while a siege ladder is being removed. The handle still resolves.
640
- */
641
- siegeLadderDestroy: [ladder: SiegeLadder];
642
-
643
- /**
644
- * Dispatched when a player asks to push a `usable` ladder from the walk at its top, or to raise a fallen one from beside its foot. Return false to refuse.
645
- */
646
- siegeLadderUse: [player: Player, ladder: SiegeLadder, action: "push" | "raise"];
647
-
648
- /**
649
- * Dispatched when a pushed ladder hits the ground. Anyone who was on it was thrown off as it began to fall, and took the game's own fall.
650
- */
651
- siegeLadderFall: [ladder: SiegeLadder, pusher: Player | null];
652
-
653
- /**
654
- * Dispatched when a raised ladder leans on its wall again and can be climbed.
655
- */
656
- siegeLadderRaise: [ladder: SiegeLadder];
657
-
658
- /**
659
- * Dispatched immediately after a stone pile is placed.
660
- */
661
- stonePileSpawn: [pile: StonePile];
662
-
663
- /**
664
- * Dispatched while a stone pile is being removed. The handle still resolves.
665
- */
666
- stonePileDestroy: [pile: StonePile];
667
-
668
- /**
669
- * Dispatched when a player takes a stone off a pile. The game's own stone throwing has already lifted it and heaves it over the wall at once, so it cannot be refused; make the pile not `usable` to stop the next one.
670
- */
671
- stonePileThrow: [player: Player, pile: StonePile];
672
-
673
- /**
674
- * Dispatched where a thrown stone first met something, as its thrower saw it, checked to lie within 30 m of its pile. Players within the pile's `damageRadius` have been told to take their share, and NPCs have taken theirs.
675
- */
676
- stoneImpact: [pile: StonePile | null, position: Vector3, attacker: Player];
677
742
  }
678
743
 
679
744
  /** Names of native events available in this scripting environment. */
@@ -1400,6 +1465,11 @@ declare global {
1400
1465
  */
1401
1466
  readonly disguise: string | null;
1402
1467
 
1468
+ /**
1469
+ * Whether this player's body is drawn at all -- itself, what it wears and what it carries. True for everybody until something hides them. Published by their own client, so it follows `setVisible` once they have actually stopped drawing. A hidden player is only invisible: they still stand where they stand, still collide, can still be hit, and NPCs still see them.
1470
+ */
1471
+ readonly visible: boolean;
1472
+
1403
1473
  /**
1404
1474
  * 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.
1405
1475
  */
@@ -1945,6 +2015,17 @@ declare global {
1945
2015
  */
1946
2016
  setDisguise(model: string | null): boolean;
1947
2017
 
2018
+ /**
2019
+ * Stops drawing this player's body, or draws it again -- on their own screen and on everybody else's. The body goes with everything on it: what it wears, the weapons on its back and belt, and whatever it is holding. It is state, like a disguise: somebody who streams in or joins sees nothing of a hidden player either, and it lasts until the next call or until they leave.
2020
+ *
2021
+ * Nothing but the drawing changes. They stand where they stood, keep their collider, their soul and their weapons, so a hidden player still blocks a doorway, can still be hit and traced against, still fights and still dies -- and the NPCs around them never stopped seeing a person. Nametags are separate; `setNametagVisible` is the call for that.
2022
+ *
2023
+ * Their own camera sits in their head, so a hidden player simply sees no arms in first person. The owning client is authoritative for its body, so this is a request that lands on their next frame; `player.visible` reads what they actually have.
2024
+ * @param visible False to stop drawing this player's body, true to draw it again.
2025
+ * @returns True when the request went out; false for a player with no connection to ask. Throws unless `visible` is a boolean.
2026
+ */
2027
+ setVisible(visible: boolean): boolean;
2028
+
1948
2029
  /**
1949
2030
  * Takes this player out of whatever saddle they are in: their own client gets them off, and `horseDismount` is raised.
1950
2031
  * @returns The horse they were taken off, or null when they were not riding one.
@@ -2006,6 +2087,91 @@ declare global {
2006
2087
 
2007
2088
  interface Player extends BasePlayer {}
2008
2089
 
2090
+ /**
2091
+ * A server-validated serving. Item properties and pot poison come from server state; changing the snapshot does not change the decision.
2092
+ */
2093
+ interface Consumption {
2094
+ /**
2095
+ * Where the serving comes from.
2096
+ */
2097
+ source: "inventory" | "cookPot";
2098
+
2099
+ /**
2100
+ * Native food or potion item class GUID.
2101
+ */
2102
+ item: string;
2103
+
2104
+ /**
2105
+ * Native food type; potions use the game's food type 1.
2106
+ */
2107
+ kind: "food" | "potion";
2108
+
2109
+ /**
2110
+ * Native table inputs before item condition, spoilage, perks or soul modifiers. Health effects may run over time. These are not promised final stat deltas. Null when the catalog has no row.
2111
+ */
2112
+ baseEffects: { buff: string | null; health: number; energy: number; nourishment: number; alcohol: number } | null;
2113
+
2114
+ /**
2115
+ * Inventory row, or null for a pot meal.
2116
+ */
2117
+ rowId: string | null;
2118
+
2119
+ /**
2120
+ * Cooking pot GUID, or null for an inventory item.
2121
+ */
2122
+ potGuid: string | null;
2123
+
2124
+ /**
2125
+ * Server item properties, including condition. Empty for a pot meal.
2126
+ */
2127
+ metadata: Record<string, unknown>;
2128
+
2129
+ /**
2130
+ * Additional cooking pot poison buff GUID, or null. Spoilage and the item's own effects are part of nativeEffects.
2131
+ */
2132
+ poison: string | null;
2133
+
2134
+ /**
2135
+ * Whether native nutrition, energy, alcohol, potion and spoilage effects are allowed. Final in playerConsumed.
2136
+ */
2137
+ nativeEffects: boolean;
2138
+ }
2139
+
2140
+ /**
2141
+ * One candidate from the game's animal loot preset; probability and inventory population belong to the gamemode.
2142
+ */
2143
+ interface AnimalLootItem {
2144
+ /**
2145
+ * Item class GUID.
2146
+ */
2147
+ item: string;
2148
+
2149
+ /**
2150
+ * Maximum authored unit count.
2151
+ */
2152
+ amount: number;
2153
+
2154
+ /**
2155
+ * Authored quantity fraction, not a drop probability.
2156
+ */
2157
+ fraction: number;
2158
+
2159
+ /**
2160
+ * Uniform variation around the quantity fraction.
2161
+ */
2162
+ variation: number;
2163
+
2164
+ /**
2165
+ * The item is food.
2166
+ */
2167
+ food: boolean;
2168
+
2169
+ /**
2170
+ * Tagged as a special Harvester part in the game data. This is metadata; the gamemode decides eligibility.
2171
+ */
2172
+ harvester: boolean;
2173
+ }
2174
+
2009
2175
  /**
2010
2176
  * A count of units from one row.
2011
2177
  */
@@ -2022,11 +2188,11 @@ declare global {
2022
2188
  }
2023
2189
 
2024
2190
  /**
2025
- * A stack of one item class with one set of properties. Two rows never hold the same class with equal properties unless a restore put them there.
2191
+ * A stack of one item class with one set of properties. Two rows never hold the same class with equal properties unless a restore put them there. Stackable custom rows merge only with matching properties. Nonstackable custom rows each contain one unit.
2026
2192
  */
2027
2193
  interface InventoryRow {
2028
2194
  /**
2029
- * The row's identity within this player's inventory. Stable while the row exists; save it with the row and pass it back to `Inventory.set`.
2195
+ * The row's identity within its owner's inventory. Stable while the row exists; save it with the row and pass it back to `Inventory.set`.
2030
2196
  */
2031
2197
  id: string;
2032
2198
 
@@ -2036,7 +2202,7 @@ declare global {
2036
2202
  item: string;
2037
2203
 
2038
2204
  /**
2039
- * The item's name in the game's own tables; not localized text.
2205
+ * Internal table name, or Items.register id for a custom type. Display overrides are in metadata.custom.name.
2040
2206
  */
2041
2207
  name: string;
2042
2208
 
@@ -2061,22 +2227,22 @@ declare global {
2061
2227
  condition: number;
2062
2228
 
2063
2229
  /**
2064
- * Units of the row the player's body wears or holds, as their game last reported it. Only in `Inventory.get` and `player.getInventory()`; give it back to `Inventory.set` to dress a restored body.
2230
+ * Units the body wears or holds: reported by a player, authored stock for an NPC. Reads include them; pass them to `Inventory.set` to dress a restored body.
2065
2231
  */
2066
2232
  equipped: number;
2067
2233
 
2068
2234
  /**
2069
- * Every property the server keeps: `quality`, `health`, `condition`, and on missiles `poison` (a buff GUID) and `poisonCharges`, and `onEquipBuffs` (buff GUIDs). A default is left out. Pass it back as it is to keep an item exactly.
2235
+ * Every property the server keeps: `quality`, `health`, `condition`, and on missiles `poison` (a buff GUID) and `poisonCharges`, and `onEquipBuffs` (buff GUIDs). Custom items also carry `custom: { name?, description?, data? }`. Data stays server-side. A default is left out. Pass it back as it is to keep an item exactly.
2070
2236
  */
2071
2237
  metadata: Record<string, unknown>;
2072
2238
  }
2073
2239
 
2074
2240
  /**
2075
- * One player's inventory as the server holds it.
2241
+ * One player's or NPC's inventory as the server holds it.
2076
2242
  */
2077
2243
  interface InventoryState {
2078
2244
  /**
2079
- * The player's game shows this revision. False for a moment after every change, and until `playerInventoryReady`.
2245
+ * For a player, their game shows this revision. For an NPC, its initial stock has been established. Wait for `playerInventoryReady` or `npcInventoryReady` respectively.
2080
2246
  */
2081
2247
  ready: boolean;
2082
2248
 
@@ -2089,10 +2255,45 @@ declare global {
2089
2255
  * Every row.
2090
2256
  */
2091
2257
  items: InventoryRow[];
2258
+
2259
+ /**
2260
+ * NPC stock only: the carcass has already been harvested. Pass it to Inventory.set when restoring a corpse; absent preserves its existing state.
2261
+ */
2262
+ harvested: boolean | undefined;
2263
+
2264
+ /**
2265
+ * The current native outfit's quick-access assignments and selections, using row IDs. Null until reported or restored. Save with items and pass both to Inventory.set.
2266
+ */
2267
+ quickslots: InventoryQuickslots | null;
2268
+ }
2269
+
2270
+ /**
2271
+ * The current outfit's weapon and item quickslots. Indices are zero-based; each array has four entries. Empty references are null.
2272
+ */
2273
+ interface InventoryQuickslots {
2274
+ /**
2275
+ * Four weapon slots, each with primary and secondary row IDs. A row may appear in several slots.
2276
+ */
2277
+ weapons: { primary: string | null; secondary: string | null }[];
2278
+
2279
+ /**
2280
+ * Four item slots, containing row IDs or null. Save equipped belts and pouches with the inventory rows to retain slot capacity.
2281
+ */
2282
+ items: (string | null)[];
2283
+
2284
+ /**
2285
+ * Selected weapon slot, 0 through 3.
2286
+ */
2287
+ activeWeapon: number;
2288
+
2289
+ /**
2290
+ * Selected item slot, 0 through 3.
2291
+ */
2292
+ activeItem: number;
2092
2293
  }
2093
2294
 
2094
2295
  /**
2095
- * What one operation did to one player's inventory.
2296
+ * What one operation did to one inventory.
2096
2297
  */
2097
2298
  interface InventoryChange {
2098
2299
  /**
@@ -2101,7 +2302,7 @@ declare global {
2101
2302
  revision: number;
2102
2303
 
2103
2304
  /**
2104
- * `add`, `remove`, `properties`, `set`, `transfer`, `wear` when the player's game wore an item down in use, `use` for food, potions and ointments, `shot` for a fired round, `pickpocket`, `trade` for a vendor deal, `repair` for a repair kit, `drop` for `player.dropInventory`, or the ground, stash and gathering reasons.
2305
+ * `add`, `remove`, `properties`, `set`, `transfer`, `wear` when the player's game wore an item down in use, `use` for food, potions and ointments, `shot` for a fired round, `pickpocket`, `trade` for a vendor deal, `repair` for a repair kit, `sharpen` for a grindstone, `drop` for `player.dropInventory`, `loot`, `npcDeposit`, `harvest`, `outfit`, or the ground, stash and gathering reasons. `equipment` reports an equipment or quickslot change: items is empty, the item revision does not advance, and Inventory.get returns the new snapshot.
2105
2306
  */
2106
2307
  reason: string;
2107
2308
 
@@ -2137,39 +2338,49 @@ declare global {
2137
2338
  }
2138
2339
 
2139
2340
  /**
2140
- * Player inventories. The server holds each connected player's items and their game shows them; nothing a player's game does adds an item. Every operation happens at once and in full, or not at all. `revision` is optional everywhere: give the one you read to refuse the operation when the inventory changed since.
2341
+ * Player and NPC inventories. The server holds the stock and clients project it. Native NPC default stock is censused once by its elected simulator; `Inventory.set` establishes scripted stock immediately. Other NPC writes require ready stock. Every operation happens at once and in full, or not at all. `revision` is optional everywhere: give the one you read to refuse the operation when the inventory changed since.
2141
2342
  */
2142
2343
  const Inventory: {
2143
2344
  /**
2144
- * Reads a player's inventory.
2145
- * @returns A copy of it, or null for a player who is not connected.
2345
+ * Lists every equippable item in the compiled game catalog. Names are table identifiers; nameKey is the native localization key. Maximum quality is the same bound Inventory.add enforces.
2346
+ */
2347
+ classes(): { id: string; name: string; nameKey: string; category: string; maximumQuality: number; quest: boolean }[];
2348
+
2349
+ /**
2350
+ * Reads a player's or NPC's inventory.
2351
+ * @returns A copy, or null for an owner that no longer exists.
2352
+ */
2353
+ get(owner: Player | Npc): InventoryState | null;
2354
+
2355
+ /**
2356
+ * Gives an owner 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. A player's game announces them with its own "You received" toast unless `notify` is false.
2146
2357
  */
2147
- get(player: Player): InventoryState | null;
2358
+ add(owner: Player | Npc, request: { item: string; amount: number; metadata?: Record<string, unknown>; revision?: number; notify?: boolean }): InventoryResult;
2148
2359
 
2149
2360
  /**
2150
- * 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. The player's game announces them with its own "You received" toast unless `notify` is false.
2361
+ * Takes exact units from named rows, every one of them or none. A player's game announces the loss with its own toast unless `notify` is false.
2151
2362
  */
2152
- add(player: Player, request: { item: string; amount: number; metadata?: Record<string, unknown>; revision?: number; notify?: boolean }): InventoryResult;
2363
+ remove(owner: Player | Npc, request: { units: InventoryUnit[]; revision?: number; notify?: boolean }): InventoryResult;
2153
2364
 
2154
2365
  /**
2155
- * Takes exact units from named rows, every one of them or none. The player's game announces the loss with its own toast unless `notify` is false.
2366
+ * Updates only named custom fields. Null resets a display override or clears data. Supplied data replaces the old object. The whole row keeps its identity, amount and native properties.
2156
2367
  */
2157
- remove(player: Player, request: { units: InventoryUnit[]; revision?: number; notify?: boolean }): InventoryResult;
2368
+ updateCustom(player: Player, request: { id: string; name?: string | null; description?: string | null; data?: Record<string, unknown> | null; revision?: number }): InventoryResult;
2158
2369
 
2159
2370
  /**
2160
2371
  * Replaces a row's properties. The row keeps its identity and amount. It replaces rather than merges: carry over anything you want to keep, and give `health` or `condition`, not two that disagree.
2161
2372
  */
2162
- setProperties(player: Player, request: { id: string; metadata: Record<string, unknown>; revision?: number }): InventoryResult;
2373
+ setProperties(owner: Player | Npc, request: { id: string; metadata: Record<string, unknown>; revision?: number }): InventoryResult;
2163
2374
 
2164
2375
  /**
2165
- * Replaces a player's whole inventory, which is how a saved one comes back. It is never announced in the player's game. Rows keep the ids they are given (letters, digits and `-_:.`, up to 64) and get new ones when they have none. `equipped` is how many units of a gear row the body wears, up to 48 in all; their game dresses in them. An empty list clears the inventory.
2376
+ * Replaces an owner's whole inventory, which is how a saved one comes back. It is never announced in the player's game. Rows keep the ids they are given (letters, digits and `-_:.`, up to 64) and get new ones when they have none. `equipped` is how many units of a gear row the body wears, up to 48 in all; their game dresses in them. Optional quickslots restores assignments and selected slots in the current native outfit; every referenced ID must occur in items. Invalid shape or missing references returns invalidQuickslots before changing anything. Omitted or null quickslots leaves assignment to the game's normal equipment handling. Native item eligibility and slot capacity still apply. An empty list clears the inventory.
2166
2377
  */
2167
- set(player: Player, request: { items: { id?: string; item: string; amount: number; metadata?: Record<string, unknown>; equipped?: number }[]; revision?: number }): InventoryResult;
2378
+ set(owner: Player | Npc, request: { items: { id?: string; item: string; amount: number; metadata?: Record<string, unknown>; equipped?: number }[]; quickslots?: InventoryQuickslots | null; revision?: number; harvested?: boolean }): InventoryResult;
2168
2379
 
2169
2380
  /**
2170
- * 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. Both players' games announce what they lost and gained unless `notify` is false.
2381
+ * Moves exact units between players or NPCs 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`. The script decides access, distance and consent. Players' games announce what they lost and gained unless `notify` is false.
2171
2382
  */
2172
- transfer(source: Player, target: Player, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number; notify?: boolean }): InventoryResult;
2383
+ transfer(source: Player | Npc, target: Player | Npc, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number; notify?: boolean }): InventoryResult;
2173
2384
 
2174
2385
  /**
2175
2386
  * 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.
@@ -2187,6 +2398,16 @@ declare global {
2187
2398
  setItemName(item: string, name: string | null): string[];
2188
2399
  };
2189
2400
 
2401
+ /**
2402
+ * Server-defined resource items using existing game appearances. Register types before restoring their instances.
2403
+ */
2404
+ const Items: {
2405
+ /**
2406
+ * Registers an immutable type and returns its stable GUID. Identical repeats succeed; conflicts throw. Defaults: empty description, price 0, stackable true, usable false, useLabel Use. visual names a miscellaneous item, crafting material or document appearance.
2407
+ */
2408
+ register(id: string, definition: { name: string; description?: string; visual: string; weight: number; price?: number; stackable?: boolean; usable?: boolean; useLabel?: string }): string;
2409
+ };
2410
+
2190
2411
  /**
2191
2412
  * Replicated KCD2 horse handle.
2192
2413
  */
@@ -2531,6 +2752,11 @@ declare global {
2531
2752
  * What one costs, in money units -- the amount of the game's `money` item, which is also what `player.giveItem('money', n)` hands out.
2532
2753
  */
2533
2754
  price: number;
2755
+
2756
+ /**
2757
+ * Item properties, including custom display overrides and private data. Preserved when bought.
2758
+ */
2759
+ metadata?: Record<string, unknown> | undefined;
2534
2760
  }
2535
2761
 
2536
2762
  /**
@@ -2552,6 +2778,11 @@ declare global {
2552
2778
  * One settled line of a deal.
2553
2779
  */
2554
2780
  interface VendorTradeLine {
2781
+ /**
2782
+ * Exact item properties, including private custom data. Sold variants appear as separate lines.
2783
+ */
2784
+ metadata: Record<string, unknown>;
2785
+
2555
2786
  /**
2556
2787
  * The item class GUID.
2557
2788
  */
@@ -2705,7 +2936,87 @@ declare global {
2705
2936
  * The score that wins, banked at the end of a turn. 2000 when omitted, at most 100000.
2706
2937
  */
2707
2938
  targetScore?: number | undefined;
2708
- }
2939
+
2940
+ /**
2941
+ * First seat's scoreboard label, up to 64 UTF-8 bytes without control characters. Empty or omitted uses the native label.
2942
+ */
2943
+ firstName?: string | undefined;
2944
+
2945
+ /**
2946
+ * Second seat's scoreboard label. Each client maps the seat to its local or opponent column.
2947
+ */
2948
+ secondName?: string | undefined;
2949
+ }
2950
+
2951
+ /**
2952
+ * An accepted server dice action. Notifications describe server decisions, which can precede the native animation. Seats and die-mask bits start at zero; turns and rolls start at one.
2953
+ */
2954
+ interface DiceProgressEvent {
2955
+ /**
2956
+ * Match ID.
2957
+ */
2958
+ match: number;
2959
+
2960
+ /**
2961
+ * Network ID of the acting player.
2962
+ */
2963
+ player: number;
2964
+
2965
+ /**
2966
+ * Acting seat: 0 for first, 1 for second.
2967
+ */
2968
+ seat: number;
2969
+
2970
+ /**
2971
+ * Turn number across both seats, starting at 1.
2972
+ */
2973
+ turn: number;
2974
+
2975
+ /**
2976
+ * Roll within the turn; 0 before its first roll.
2977
+ */
2978
+ roll: number;
2979
+
2980
+ /**
2981
+ * Number of accepted moves so far.
2982
+ */
2983
+ moveIndex: number;
2984
+
2985
+ /**
2986
+ * Unbanked points in this turn, before they are lost on a bust or banked on a pass.
2987
+ */
2988
+ turnScore: number;
2989
+
2990
+ /**
2991
+ * This seat's banked score.
2992
+ */
2993
+ totalScore: number;
2994
+
2995
+ /**
2996
+ * Six pip values (1 through 6) in die-index order on diceRoll; empty on other events. rolledMask identifies the dice rolled this time.
2997
+ */
2998
+ faces: number[];
2999
+
3000
+ /**
3001
+ * Bit mask of dice rolled, on diceRoll; zero otherwise.
3002
+ */
3003
+ rolledMask: number;
3004
+
3005
+ /**
3006
+ * Bit mask of dice selected in the accepted move; zero otherwise.
3007
+ */
3008
+ heldMask: number;
3009
+
3010
+ /**
3011
+ * Points added by diceMove or banked by a passed diceTurnEnd; zero otherwise.
3012
+ */
3013
+ points: number;
3014
+
3015
+ /**
3016
+ * continue or pass on diceMove; bust or rolled on diceRoll; pass, bust, won, gaveUp, left, timedOut, failed, or stopped on diceTurnEnd; empty on diceTurnStart.
3017
+ */
3018
+ reason: string;
3019
+ }
2709
3020
 
2710
3021
  /**
2711
3022
  * Dice matches between two players on the game's own dice table.
@@ -2728,6 +3039,15 @@ declare global {
2728
3039
  */
2729
3040
  start(first: number, second: number, options?: DiceMatchOptions): number;
2730
3041
 
3042
+ /**
3043
+ * Changes both scoreboard labels on the next native scoreboard refresh. Empty restores a native label. Names allow at most 64 UTF-8 bytes and no control characters.
3044
+ * @param match Match ID.
3045
+ * @param first First seat label.
3046
+ * @param second Second seat label.
3047
+ * @returns False if the match has ended.
3048
+ */
3049
+ setNames(match: number, first: string, second: string): boolean;
3050
+
2731
3051
  /**
2732
3052
  * Ends a match with nobody winning; both tables close.
2733
3053
  * @param match The match to end.
@@ -3742,6 +4062,29 @@ declare global {
3742
4062
 
3743
4063
  interface Vfx extends Entity {}
3744
4064
 
4065
+ /**
4066
+ * One player's view, directed from the server. A shot is sent and forgotten: the server keeps no record of it, so a player who reconnects or changes level has their own view until they are sent another.
4067
+ */
4068
+ const Camera: {
4069
+ /**
4070
+ * Films one player's view from a fixed point: what a cutscene, an intro or a kill cam is made of. It holds until `clearShot`, or glides on to the next `setShot`.
4071
+ *
4072
+ * This is the client's `Camera.setShot`, sent to that player; whichever of the two comes last wins. Nothing about the player's controls changes, and nothing about where their body is: their character stays where it stood, drawn head and all for as long as the camera is looking at it from outside its eyes. A player flying with `NoClip` refuses the shot.
4073
+ * @param player Whose view to film.
4074
+ * @param options `position` is where the camera stands and `lookAt` the point it faces, both in world space. `duration` is how long it takes to get there from wherever the player's view is, in milliseconds: 0, the default, is a cut, and the most is 60000. `fov` is the vertical field of view in degrees, 20 to 120; leave it out to keep the player's own.
4075
+ * @returns True when the shot was sent, false when `position` and `lookAt` are the same point.
4076
+ */
4077
+ setShot(player: Player, options: { position: Vector3; lookAt: Vector3; duration?: number; fov?: number }): boolean;
4078
+
4079
+ /**
4080
+ * Gives a player their own view back. Harmless for a player without a shot.
4081
+ * @param player Whose view to give back.
4082
+ * @param duration How long the glide back into the player's eyes takes, in milliseconds: 0, the default, is a cut, and the most is 60000.
4083
+ * @returns True when it was sent.
4084
+ */
4085
+ clearShot(player: Player, duration?: number): boolean;
4086
+ };
4087
+
3745
4088
  /**
3746
4089
  * Replicated ground marker handle.
3747
4090
  */
@@ -4167,9 +4510,9 @@ declare global {
4167
4510
  lootable: boolean;
4168
4511
 
4169
4512
  /**
4170
- * 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`.
4513
+ * 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. Only these exact, case-sensitive strings are accepted; invalid values throw without changing the mode. 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`.
4171
4514
  */
4172
- locomotion: string;
4515
+ locomotion: 'native' | 'kinematic';
4173
4516
 
4174
4517
  /**
4175
4518
  * What the NPC has been told to do: `hold`, `moveTo`, `follow`, `flee`, `lookAt`, `playAnim`, `talk` or `attack`.
@@ -4192,7 +4535,7 @@ declare global {
4192
4535
  readonly appearance: Appearance;
4193
4536
 
4194
4537
  /**
4195
- * What it has been told to wear, as item class GUIDs; empty when it wears its own clothes. Write it with `wear` or `setOutfit`.
4538
+ * Its worn item classes. Before default stock is established an empty list leaves the soul's own outfit; afterward empty means undressed. Write it with `wear`, `setOutfit` or `Inventory.set`.
4196
4539
  */
4197
4540
  readonly wearing: string[];
4198
4541
 
@@ -4255,6 +4598,16 @@ declare global {
4255
4598
  */
4256
4599
  setNametagColor(color: number): void;
4257
4600
 
4601
+ /**
4602
+ * Returns game-data loot candidates for this animal. Does not roll or populate stock. The gamemode chooses chances and writes Inventory.set at spawn. Null for non-animals, excluded souls or unresolved adopted bodies; an empty array is a known empty preset.
4603
+ */
4604
+ getAnimalLoot(): AnimalLootItem[] | null;
4605
+
4606
+ /**
4607
+ * Reads server-owned stock and worn row counts. Inventory.get/add/remove/setProperties/set/transfer also accept Npc handles. Default native stock becomes ready at npcInventoryReady; Inventory.set may provide it before a body exists.
4608
+ */
4609
+ getInventory(): InventoryState | null;
4610
+
4258
4611
  /**
4259
4612
  * Despawns this NPC everywhere, after emitting npcDestroy.
4260
4613
  */
@@ -4373,7 +4726,7 @@ declare global {
4373
4726
  say(text: string): boolean;
4374
4727
 
4375
4728
  /**
4376
- * Dresses the body in exactly these items, replacing what it had on. An empty list takes off what it was given and leaves what its soul owns -- which for many souls, a role's among them, is only underwear, so re-dress those with `setOutfit`.
4729
+ * Dresses the body in exactly these items, replacing what it had on. Existing items are reused and missing ones are added to stock. An empty list undresses it and retains its clothes as loose inventory.
4377
4730
  * @param itemClasses Item class GUIDs in the dashed form the game's own tables spell them.
4378
4731
  * @returns True when every GUID names an item class this build has. Otherwise nothing changes, and each refused GUID is logged.
4379
4732
  */
@@ -4418,7 +4771,7 @@ declare global {
4418
4771
  pin(player: Player | number | null): void;
4419
4772
 
4420
4773
  /**
4421
- * Spawns an NPC and replicates it. It exists on the server from this moment: every client near enough makes a body for it, one of them is elected to run it, and the rest draw what that one reports.
4774
+ * Spawns an NPC and replicates it. Omitted or undefined `locomotion` defaults to `native`; other values must be exactly `native` or `kinematic`, otherwise it throws before spawning. It exists on the server from this moment: every client near enough makes a body for it, one of them is elected to run it, and the rest draw what that one reports.
4422
4775
  *
4423
4776
  * The body is not simulated until somebody is close enough to run it, which is not a failure -- a guard on the other side of the map has nothing to do that anybody can see. Read `simulator` to tell.
4424
4777
  * @param options `soul` is a role from `Npc.roles()`, an animal name from `Npc.animals()`, or a soul GUID; `position` is where to put it. Everything else has a default.
@@ -4427,7 +4780,7 @@ declare global {
4427
4780
  static create(options: { soul?: string; class?: string; name?: string; outfit?: string; wearing?: string[]; appearance?: Partial<Appearance>; position?: Vector3 | Partial<Vector3>; rotation?: Quaternion | Vector3 | Partial<Vector3>; faction?: number; health?: number; maxHealth?: number; locomotion?: 'kinematic' | 'native'; invulnerable?: boolean; frozen?: boolean; interactable?: boolean; nametag?: boolean; lootable?: boolean; virtualWorld?: number }): Npc;
4428
4781
 
4429
4782
  /**
4430
- * Takes over one of the level's own NPCs instead of spawning a new body. A level `EntityGuid` is the same number on every machine, so every client finds the same body -- which is how doors, gates and stashes are already addressed. Adopting the same guid twice returns the NPC that already has it.
4783
+ * Takes over one of the level's own NPCs instead of spawning a new body. Locomotion is validated as for `create`. A level `EntityGuid` is the same number on every machine, so every client finds the same body -- which is how doors, gates and stashes are already addressed. Adopting the same guid twice returns the NPC that already has it without applying the options again.
4431
4784
  * @param levelGuid `EntityGuid` of the body the level already placed.
4432
4785
  * @param options The same options a spawn takes; `soul` and `class` are ignored, since the body already exists.
4433
4786
  * @returns The NPC handle for that body.
@@ -4461,6 +4814,11 @@ declare global {
4461
4814
  */
4462
4815
  static roles(): string[];
4463
4816
 
4817
+ /**
4818
+ * Authored human NPC placements in the configured level with matching catalog souls. These are initial placements, not current NPC schedules or proof that a quest layer is loaded. Does not spawn or adopt anything.
4819
+ */
4820
+ static placements(): { name: string; guid: string; level: string; layer: string; soul: string; actorClass: string; position: { x: number; y: number; z: number }; rotation: { w: number; x: number; y: number; z: number } }[];
4821
+
4464
4822
  /**
4465
4823
  * Animal souls with matching native classes. Pass a name or soul to Npc.create. Chickens use flock entities and are excluded.
4466
4824
  */
@@ -4990,6 +5348,21 @@ declare global {
4990
5348
  * A frozen snapshot of one stew pot in one virtual world.
4991
5349
  */
4992
5350
  interface CookPotSnapshot {
5351
+ /**
5352
+ * Meal served by this pot, including its native nutrition and appearance.
5353
+ */
5354
+ food: "goulash" | "lentil" | "soup";
5355
+
5356
+ /**
5357
+ * Base nutrition per meal: goulash 25, lentil 10, soup 15.
5358
+ */
5359
+ nutrition: number;
5360
+
5361
+ /**
5362
+ * Ingested buff GUID applied to future meals, or null. Visible to server scripts only.
5363
+ */
5364
+ poison: string | null;
5365
+
4993
5366
  /**
4994
5367
  * The fireplace's level GUID.
4995
5368
  */
@@ -5044,7 +5417,7 @@ declare global {
5044
5417
  get(guid: string, virtualWorld?: number): CookPotSnapshot | null;
5045
5418
 
5046
5419
  /**
5047
- * Replaces remaining stock and capacity, preserving enabled. Returns false for an unknown pot.
5420
+ * Replaces remaining stock and capacity and clears poison, preserving food and enabled. Returns false for an unknown pot.
5048
5421
  * @param guid Fireplace level GUID from CookPot.all().
5049
5422
  * @param portions Integer from 0 to 1000; defaults to four.
5050
5423
  * @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
@@ -5060,14 +5433,78 @@ declare global {
5060
5433
  setEnabled(guid: string, enabled: boolean, virtualWorld?: number): boolean;
5061
5434
 
5062
5435
  /**
5063
- * Changes food level and stock together, preserving enabled. Returns false for an unknown pot.
5436
+ * Changes food level and stock together, preserving food, poison and enabled. Returns false for an unknown pot.
5064
5437
  * @param guid Fireplace level GUID from CookPot.all().
5065
5438
  * @param state Empty, two portions, or four portions; resets capacity to four.
5066
5439
  * @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
5067
5440
  */
5068
5441
  setState(guid: string, state: "empty" | "half" | "full", virtualWorld?: number): boolean;
5442
+
5443
+ /**
5444
+ * Item class GUIDs accepted by CookPot.poison, including each native strength variant.
5445
+ */
5446
+ poisons(): string[];
5447
+
5448
+ /**
5449
+ * Changes future meals and appearance, preserving stock, poison and enabled. Already reserved meals keep their previous type.
5450
+ * @param guid Fireplace level GUID from CookPot.all().
5451
+ * @param food Native meal type.
5452
+ * @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
5453
+ */
5454
+ setFood(guid: string, food: "goulash" | "lentil" | "soup", virtualWorld?: number): boolean;
5455
+
5456
+ /**
5457
+ * Spends ingredients atomically and fills an empty enabled pot. Clears old poison. Validates player, distance, ability to act, world and synchronized inventory. Never pass unvalidated client recipe data.
5458
+ * @param player Connected player within four metres; their current virtual world selects the pot.
5459
+ * @param guid Fireplace level GUID from CookPot.all().
5460
+ * @param recipe Ingredients and yield chosen by this server script.
5461
+ */
5462
+ refillFromInventory(player: Player, guid: string, recipe: CookPotRecipe): CookPotResult;
5463
+
5464
+ /**
5465
+ * Poisons a stocked enabled pot with the item's ingested effect. Refuses a second poison until refill. A meal takes the poison present when reserved, applied once on its eating receipt; NPC poisoning and native crime reactions are not included.
5466
+ * @param player Connected player within four metres; their current virtual world selects the pot.
5467
+ * @param guid Fireplace level GUID from CookPot.all().
5468
+ * @param rowId Inventory row containing a native Poison item; spends exactly one.
5469
+ */
5470
+ poison(player: Player, guid: string, rowId: string): CookPotResult;
5069
5471
  };
5070
5472
 
5473
+ /**
5474
+ * Server-defined ingredients and portions for refilling an empty pot.
5475
+ */
5476
+ interface CookPotRecipe {
5477
+ /**
5478
+ * Meal to put in the pot.
5479
+ */
5480
+ food: "goulash" | "lentil" | "soup";
5481
+
5482
+ /**
5483
+ * Integer from 1 to 1000.
5484
+ */
5485
+ portions: number;
5486
+
5487
+ /**
5488
+ * One to sixteen food item classes by name or GUID, with positive integer amounts. Split stacks are combined; spoiled rows are skipped.
5489
+ */
5490
+ ingredients: { item: string; amount: number }[];
5491
+ }
5492
+
5493
+ /**
5494
+ * An atomic pot action. A refusal changes neither items nor contents.
5495
+ */
5496
+ interface CookPotResult {
5497
+ /**
5498
+ * Whether the action succeeded.
5499
+ */
5500
+ ok: boolean;
5501
+
5502
+ /**
5503
+ * ok, invalid_player, unknown_pot, disabled, too_far, cannot_act, inventory_not_ready, not_empty, invalid_recipe, missing_ingredients, empty, already_poisoned, unknown_item, not_poison, or an inventory refusal code.
5504
+ */
5505
+ code: string;
5506
+ }
5507
+
5071
5508
  /** */
5072
5509
  interface NearestDoor {
5073
5510
  /**
@@ -5531,38 +5968,251 @@ declare global {
5531
5968
  destroy(): void;
5532
5969
 
5533
5970
  /**
5534
- * Builds and replicates a siege engine, unloaded. The trebuchet is the game's own model and plays its own winch, load and fire animations; the cannon is the game's static gun.
5535
- * @param kind `trebuchet` or `cannon`.
5536
- * @param position World-space position of the engine's base.
5537
- * @param rotation Optional initial orientation: a Quaternion, or a Vector3 of Euler angles in degrees. `fire` and `aim` turn it to face their target.
5538
- * @param virtualWorld Optional virtual world the engine belongs to; omitted puts it in the global one.
5539
- * @returns The new engine's handle.
5971
+ * Builds and replicates a siege engine, unloaded. The trebuchet is the game's own model and plays its own winch, load and fire animations; the cannon is the game's static gun.
5972
+ * @param kind `trebuchet` or `cannon`.
5973
+ * @param position World-space position of the engine's base.
5974
+ * @param rotation Optional initial orientation: a Quaternion, or a Vector3 of Euler angles in degrees. `fire` and `aim` turn it to face their target.
5975
+ * @param virtualWorld Optional virtual world the engine belongs to; omitted puts it in the global one.
5976
+ * @returns The new engine's handle.
5977
+ */
5978
+ static spawn(kind: string, position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): SiegeEngine;
5979
+
5980
+ /**
5981
+ * Lists the siege engines the server has.
5982
+ * @param virtualWorld Optional virtual world to list; omitted lists every one.
5983
+ * @returns One handle per engine, in no particular order.
5984
+ */
5985
+ static all(virtualWorld?: number): SiegeEngine[];
5986
+
5987
+ /**
5988
+ * Looks an engine up by its network entity ID.
5989
+ * @param id Network entity identifier.
5990
+ * @returns The engine's handle, or null when no live engine has that ID.
5991
+ */
5992
+ static getById(id: number): SiegeEngine | null;
5993
+
5994
+ /**
5995
+ * Removes siege engines, emitting `siegeEngineDestroy` for each one.
5996
+ * @param virtualWorld Optional virtual world to clear; omitted clears every one.
5997
+ * @returns How many were removed.
5998
+ */
5999
+ static destroyAll(virtualWorld?: number): number;
6000
+ }
6001
+
6002
+ interface SiegeEngine extends Entity {}
6003
+
6004
+ /** */
6005
+ interface SiegeLadderKind {
6006
+ /**
6007
+ * Its name: `siege`, `tall`, `short` or `low`.
6008
+ */
6009
+ kind: string;
6010
+
6011
+ /**
6012
+ * The mesh it stands as, a path from the shared prop catalog.
6013
+ */
6014
+ model: string;
6015
+
6016
+ /**
6017
+ * How far up its rungs go, in metres.
6018
+ */
6019
+ height: number;
6020
+
6021
+ /**
6022
+ * How far it leans towards the wall standing, in degrees about its own X; it leans towards its forward.
6023
+ */
6024
+ lean: number;
6025
+ }
6026
+
6027
+ /**
6028
+ * Replicated handle for a siege ladder leaning on a wall.
6029
+ */
6030
+ class SiegeLadder {
6031
+ /**
6032
+ * Creates a script wrapper for an existing siege ladder with this ID; use SiegeLadder.spawn() to place one.
6033
+ * @param id Network entity identifier.
6034
+ */
6035
+ constructor(id: number);
6036
+
6037
+ /**
6038
+ * Which of the game's ladders it is: `siege` (the Suchdol siege ladder, 9.75 m), `tall` (5.5 m), `short` (3.25 m) or `low` (2 m).
6039
+ */
6040
+ readonly kind: string;
6041
+
6042
+ /**
6043
+ * `standing` against its wall, `pushed` (a defender's swing, then its fall), `down`, `raising` or `broken`. Named `pose` because every entity already has a `state`, which is its state bag.
6044
+ */
6045
+ readonly pose: string;
6046
+
6047
+ /**
6048
+ * How far up its rungs go, in metres: its top rests this high above its foot on the wall's top. Pick the kind whose height meets the walk.
6049
+ */
6050
+ readonly height: number;
6051
+
6052
+ /**
6053
+ * Whether the game's own climb is offered on it: while it stands and nobody has started to push it.
6054
+ */
6055
+ readonly climbable: boolean;
6056
+
6057
+ /**
6058
+ * Whether players are offered the push at its top and the raise at the foot of a fallen one, each raising `siegeLadderUse` first. On by default. The climb is the game's and is offered whenever the ladder stands.
6059
+ */
6060
+ usable: boolean;
6061
+
6062
+ /**
6063
+ * Who last pushed it, or null.
6064
+ */
6065
+ readonly pusher: Player | null;
6066
+
6067
+ /**
6068
+ * Formats this ladder handle for logging and debugging.
6069
+ * @returns The ladder ID, its kind and its pose.
6070
+ */
6071
+ toString(): string;
6072
+
6073
+ /**
6074
+ * Pushes a standing ladder off its wall. It stands through the swing, falls away from the wall as the blade meets it -- throwing off anyone climbing it -- and lies where it lands, about 4.5 seconds later.
6075
+ * @param player Who pushes it: they play the game's own halberd push, and are credited with it in `siegeLadderFall`.
6076
+ * @returns What happened, and the phrase to explain it with when nothing did.
6077
+ */
6078
+ push(player?: Player | number | null): SiegeResult;
6079
+
6080
+ /**
6081
+ * Lays a fallen ladder back against its wall, over the lift's 5.7 seconds.
6082
+ * @param player Who raises it: they play the game's own ladder lift.
6083
+ * @returns What happened, and the phrase to explain it with when nothing did.
6084
+ */
6085
+ raise(player?: Player | number | null): SiegeResult;
6086
+
6087
+ /**
6088
+ * Breaks the ladder: it lies in pieces where it stands, anyone on it falls, and nothing raises it until `repair`.
6089
+ */
6090
+ break(): void;
6091
+
6092
+ /**
6093
+ * Puts a fallen or broken ladder back against its wall at once.
6094
+ */
6095
+ repair(): void;
6096
+
6097
+ /**
6098
+ * Removes the ladder on every client after emitting `siegeLadderDestroy`.
6099
+ */
6100
+ destroy(): void;
6101
+
6102
+ /**
6103
+ * Places one of the game's own ladders leaning on a wall, the way the Suchdol and Nebakov sieges stand theirs: the game's climb, and the game's step off over the palisade at its top, which wants the top a little over the walk.
6104
+ * @param kind `siege`, `tall`, `short` or `low`.
6105
+ * @param position Where its foot stands, on the ground below the wall.
6106
+ * @param rotation Its facing: forward is the way to the wall it leans on. A Quaternion, or a Vector3 of Euler angles in degrees.
6107
+ * @param virtualWorld Optional virtual world the ladder belongs to; omitted puts it in the global one.
6108
+ * @returns The new ladder's handle.
6109
+ */
6110
+ static spawn(kind: string, position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): SiegeLadder;
6111
+
6112
+ /**
6113
+ * What one kind of ladder is: its mesh, its climb and its lean -- what a placement preview needs to show it as it will stand.
6114
+ * @param kind `siege`, `tall`, `short` or `low`.
6115
+ * @returns The kind, or null for a name that is not one.
6116
+ */
6117
+ static describe(kind: string): SiegeLadderKind | null;
6118
+
6119
+ /**
6120
+ * Lists the siege ladders the server has.
6121
+ * @param virtualWorld Optional virtual world to list; omitted lists every one.
6122
+ * @returns One handle per ladder, in no particular order.
6123
+ */
6124
+ static all(virtualWorld?: number): SiegeLadder[];
6125
+
6126
+ /**
6127
+ * Looks a ladder up by its network entity ID.
6128
+ * @param id Network entity identifier.
6129
+ * @returns The ladder's handle, or null when no live ladder has that ID.
6130
+ */
6131
+ static getById(id: number): SiegeLadder | null;
6132
+
6133
+ /**
6134
+ * Removes siege ladders, emitting `siegeLadderDestroy` for each one.
6135
+ * @param virtualWorld Optional virtual world to clear; omitted clears every one.
6136
+ * @returns How many were removed.
6137
+ */
6138
+ static destroyAll(virtualWorld?: number): number;
6139
+ }
6140
+
6141
+ interface SiegeLadder extends Entity {}
6142
+
6143
+ /**
6144
+ * Replicated handle for a pile of hurling stones on a battlement.
6145
+ */
6146
+ class StonePile {
6147
+ /**
6148
+ * Creates a script wrapper for an existing stone pile with this ID; use StonePile.spawn() to place one.
6149
+ * @param id Network entity identifier.
6150
+ */
6151
+ constructor(id: number);
6152
+
6153
+ /**
6154
+ * Stones left to throw; each throw takes one, and a pile with none offers nothing. Players see at most nine in the heap. -1, the default, never runs out; any negative value means the same.
6155
+ */
6156
+ stones: number;
6157
+
6158
+ /**
6159
+ * Whether players are offered the game's own prompt at the pile. On by default.
6160
+ */
6161
+ usable: boolean;
6162
+
6163
+ /**
6164
+ * Health taken from anyone at the point a stone comes down, up to 1000; a quarter of it reaches the edge of `damageRadius`. 60 to start with; a player has 100.
6165
+ */
6166
+ damage: number;
6167
+
6168
+ /**
6169
+ * How far from where a stone comes down anyone is hurt, in metres, up to 10. 1.5 to start with.
6170
+ */
6171
+ damageRadius: number;
6172
+
6173
+ /**
6174
+ * Formats this pile handle for logging and debugging.
6175
+ * @returns The pile ID and the stones it has left.
6176
+ */
6177
+ toString(): string;
6178
+
6179
+ /**
6180
+ * Removes the pile on every client after emitting `stonePileDestroy`. A stone already thrown still lands.
6181
+ */
6182
+ destroy(): void;
6183
+
6184
+ /**
6185
+ * Places the game's own battlement pile of hurling stones, the Nebakov and Suchdol defenders' heap. Its prompt, the lift and the heave over the wall are the game's stone throwing; each stone is a real rigid body that falls where it falls.
6186
+ * @param position Where the thrower stands on the walk, behind the parapet.
6187
+ * @param rotation Its facing: forward is the way the stones go, over the wall. A Quaternion, or a Vector3 of Euler angles in degrees.
6188
+ * @param virtualWorld Optional virtual world the pile belongs to; omitted puts it in the global one.
6189
+ * @returns The new pile's handle.
5540
6190
  */
5541
- static spawn(kind: string, position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): SiegeEngine;
6191
+ static spawn(position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): StonePile;
5542
6192
 
5543
6193
  /**
5544
- * Lists the siege engines the server has.
6194
+ * Lists the stone piles the server has.
5545
6195
  * @param virtualWorld Optional virtual world to list; omitted lists every one.
5546
- * @returns One handle per engine, in no particular order.
6196
+ * @returns One handle per pile, in no particular order.
5547
6197
  */
5548
- static all(virtualWorld?: number): SiegeEngine[];
6198
+ static all(virtualWorld?: number): StonePile[];
5549
6199
 
5550
6200
  /**
5551
- * Looks an engine up by its network entity ID.
6201
+ * Looks a pile up by its network entity ID.
5552
6202
  * @param id Network entity identifier.
5553
- * @returns The engine's handle, or null when no live engine has that ID.
6203
+ * @returns The pile's handle, or null when no live pile has that ID.
5554
6204
  */
5555
- static getById(id: number): SiegeEngine | null;
6205
+ static getById(id: number): StonePile | null;
5556
6206
 
5557
6207
  /**
5558
- * Removes siege engines, emitting `siegeEngineDestroy` for each one.
6208
+ * Removes stone piles, emitting `stonePileDestroy` for each one.
5559
6209
  * @param virtualWorld Optional virtual world to clear; omitted clears every one.
5560
6210
  * @returns How many were removed.
5561
6211
  */
5562
6212
  static destroyAll(virtualWorld?: number): number;
5563
6213
  }
5564
6214
 
5565
- interface SiegeEngine extends Entity {}
6215
+ interface StonePile extends Entity {}
5566
6216
 
5567
6217
  /** */
5568
6218
  interface AreaDefinition {
@@ -5631,6 +6281,11 @@ declare global {
5631
6281
  */
5632
6282
  virtualWorld?: number | undefined;
5633
6283
 
6284
+ /**
6285
+ * Invisible boundary collision from both sides; false when omitted. Polygons need a simple outline and positive height. Walls are 0.2 m thick; spheres use a tessellated boundary.
6286
+ */
6287
+ collision?: boolean | undefined;
6288
+
5634
6289
  /**
5635
6290
  * Whether it starts enabled; true when omitted.
5636
6291
  */
@@ -5705,6 +6360,11 @@ declare global {
5705
6360
  */
5706
6361
  metadata: Record<string, unknown>;
5707
6362
 
6363
+ /**
6364
+ * Invisible boundary walls block both directions while enabled, leaving the interior empty. Authored areas only; invalid collision shapes throw.
6365
+ */
6366
+ collision: boolean;
6367
+
5708
6368
  /**
5709
6369
  * 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.
5710
6370
  */
@@ -6099,6 +6759,11 @@ declare global {
6099
6759
  * The server's own clock and weather, which every client follows, and the three questions it can ask a client's engine about the level itself.
6100
6760
  */
6101
6761
  const World: {
6762
+ /**
6763
+ * The configured level loaded by every client in this server session.
6764
+ */
6765
+ readonly level: string;
6766
+
6102
6767
  /**
6103
6768
  * Whole days the clock has run, from the level's own midnight. Starts at 0 and only grows.
6104
6769
  */
@@ -6164,6 +6829,11 @@ declare global {
6164
6829
  */
6165
6830
  readonly puddles: number;
6166
6831
 
6832
+ /**
6833
+ * Points of interest in the configured level only, from the compiled game catalog. Positions are ground-marker clusters checked against the level navmesh; a teleport still needs the destination to stream on the client.
6834
+ */
6835
+ pointsOfInterest(): { name: string; group: string; level: string; position: { x: number; y: number; z: number } }[];
6836
+
6167
6837
  /**
6168
6838
  * Winds the clock forward to an absolute day and hour, which is how a saved clock is restored.
6169
6839
  * @param day Absolute day to wind forward to, as the `day` property counts them. Must be whole.
@@ -8301,219 +8971,6 @@ declare global {
8301
8971
 
8302
8972
  interface BasePlayer extends Entity {}
8303
8973
 
8304
- /** */
8305
- interface SiegeLadderKind {
8306
- /**
8307
- * Its name: `siege`, `tall`, `short` or `low`.
8308
- */
8309
- kind: string;
8310
-
8311
- /**
8312
- * The mesh it stands as, a path from the shared prop catalog.
8313
- */
8314
- model: string;
8315
-
8316
- /**
8317
- * How far up its rungs go, in metres.
8318
- */
8319
- height: number;
8320
-
8321
- /**
8322
- * How far it leans towards the wall standing, in degrees about its own X; it leans towards its forward.
8323
- */
8324
- lean: number;
8325
- }
8326
-
8327
- /**
8328
- * Replicated handle for a siege ladder leaning on a wall.
8329
- */
8330
- class SiegeLadder {
8331
- /**
8332
- * Creates a script wrapper for an existing siege ladder with this ID; use SiegeLadder.spawn() to place one.
8333
- * @param id Network entity identifier.
8334
- */
8335
- constructor(id: number);
8336
-
8337
- /**
8338
- * Which of the game's ladders it is: `siege` (the Suchdol siege ladder, 9.75 m), `tall` (5.5 m), `short` (3.25 m) or `low` (2 m).
8339
- */
8340
- readonly kind: string;
8341
-
8342
- /**
8343
- * `standing` against its wall, `pushed` (a defender's swing, then its fall), `down`, `raising` or `broken`. Named `pose` because every entity already has a `state`, which is its state bag.
8344
- */
8345
- readonly pose: string;
8346
-
8347
- /**
8348
- * How far up its rungs go, in metres: its top rests this high above its foot on the wall's top. Pick the kind whose height meets the walk.
8349
- */
8350
- readonly height: number;
8351
-
8352
- /**
8353
- * Whether the game's own climb is offered on it: while it stands and nobody has started to push it.
8354
- */
8355
- readonly climbable: boolean;
8356
-
8357
- /**
8358
- * Whether players are offered the push at its top and the raise at the foot of a fallen one, each raising `siegeLadderUse` first. On by default. The climb is the game's and is offered whenever the ladder stands.
8359
- */
8360
- usable: boolean;
8361
-
8362
- /**
8363
- * Who last pushed it, or null.
8364
- */
8365
- readonly pusher: Player | null;
8366
-
8367
- /**
8368
- * Formats this ladder handle for logging and debugging.
8369
- * @returns The ladder ID, its kind and its pose.
8370
- */
8371
- toString(): string;
8372
-
8373
- /**
8374
- * Pushes a standing ladder off its wall. It stands through the swing, falls away from the wall as the blade meets it -- throwing off anyone climbing it -- and lies where it lands, about 4.5 seconds later.
8375
- * @param player Who pushes it: they play the game's own halberd push, and are credited with it in `siegeLadderFall`.
8376
- * @returns What happened, and the phrase to explain it with when nothing did.
8377
- */
8378
- push(player?: Player | number | null): SiegeResult;
8379
-
8380
- /**
8381
- * Lays a fallen ladder back against its wall, over the lift's 5.7 seconds.
8382
- * @param player Who raises it: they play the game's own ladder lift.
8383
- * @returns What happened, and the phrase to explain it with when nothing did.
8384
- */
8385
- raise(player?: Player | number | null): SiegeResult;
8386
-
8387
- /**
8388
- * Breaks the ladder: it lies in pieces where it stands, anyone on it falls, and nothing raises it until `repair`.
8389
- */
8390
- break(): void;
8391
-
8392
- /**
8393
- * Puts a fallen or broken ladder back against its wall at once.
8394
- */
8395
- repair(): void;
8396
-
8397
- /**
8398
- * Removes the ladder on every client after emitting `siegeLadderDestroy`.
8399
- */
8400
- destroy(): void;
8401
-
8402
- /**
8403
- * Places one of the game's own ladders leaning on a wall, the way the Suchdol and Nebakov sieges stand theirs: the game's climb, and the game's step off over the palisade at its top, which wants the top a little over the walk.
8404
- * @param kind `siege`, `tall`, `short` or `low`.
8405
- * @param position Where its foot stands, on the ground below the wall.
8406
- * @param rotation Its facing: forward is the way to the wall it leans on. A Quaternion, or a Vector3 of Euler angles in degrees.
8407
- * @param virtualWorld Optional virtual world the ladder belongs to; omitted puts it in the global one.
8408
- * @returns The new ladder's handle.
8409
- */
8410
- static spawn(kind: string, position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): SiegeLadder;
8411
-
8412
- /**
8413
- * What one kind of ladder is: its mesh, its climb and its lean -- what a placement preview needs to show it as it will stand.
8414
- * @param kind `siege`, `tall`, `short` or `low`.
8415
- * @returns The kind, or null for a name that is not one.
8416
- */
8417
- static describe(kind: string): SiegeLadderKind | null;
8418
-
8419
- /**
8420
- * Lists the siege ladders the server has.
8421
- * @param virtualWorld Optional virtual world to list; omitted lists every one.
8422
- * @returns One handle per ladder, in no particular order.
8423
- */
8424
- static all(virtualWorld?: number): SiegeLadder[];
8425
-
8426
- /**
8427
- * Looks a ladder up by its network entity ID.
8428
- * @param id Network entity identifier.
8429
- * @returns The ladder's handle, or null when no live ladder has that ID.
8430
- */
8431
- static getById(id: number): SiegeLadder | null;
8432
-
8433
- /**
8434
- * Removes siege ladders, emitting `siegeLadderDestroy` for each one.
8435
- * @param virtualWorld Optional virtual world to clear; omitted clears every one.
8436
- * @returns How many were removed.
8437
- */
8438
- static destroyAll(virtualWorld?: number): number;
8439
- }
8440
-
8441
- interface SiegeLadder extends Entity {}
8442
-
8443
- /**
8444
- * Replicated handle for a pile of hurling stones on a battlement.
8445
- */
8446
- class StonePile {
8447
- /**
8448
- * Creates a script wrapper for an existing stone pile with this ID; use StonePile.spawn() to place one.
8449
- * @param id Network entity identifier.
8450
- */
8451
- constructor(id: number);
8452
-
8453
- /**
8454
- * Stones left to throw; each throw takes one, and a pile with none offers nothing. Players see at most nine in the heap. -1, the default, never runs out; any negative value means the same.
8455
- */
8456
- stones: number;
8457
-
8458
- /**
8459
- * Whether players are offered the game's own prompt at the pile. On by default.
8460
- */
8461
- usable: boolean;
8462
-
8463
- /**
8464
- * Health taken from anyone at the point a stone comes down, up to 1000; a quarter of it reaches the edge of `damageRadius`. 60 to start with; a player has 100.
8465
- */
8466
- damage: number;
8467
-
8468
- /**
8469
- * How far from where a stone comes down anyone is hurt, in metres, up to 10. 1.5 to start with.
8470
- */
8471
- damageRadius: number;
8472
-
8473
- /**
8474
- * Formats this pile handle for logging and debugging.
8475
- * @returns The pile ID and the stones it has left.
8476
- */
8477
- toString(): string;
8478
-
8479
- /**
8480
- * Removes the pile on every client after emitting `stonePileDestroy`. A stone already thrown still lands.
8481
- */
8482
- destroy(): void;
8483
-
8484
- /**
8485
- * Places the game's own battlement pile of hurling stones, the Nebakov and Suchdol defenders' heap. Its prompt, the lift and the heave over the wall are the game's stone throwing; each stone is a real rigid body that falls where it falls.
8486
- * @param position Where the thrower stands on the walk, behind the parapet.
8487
- * @param rotation Its facing: forward is the way the stones go, over the wall. A Quaternion, or a Vector3 of Euler angles in degrees.
8488
- * @param virtualWorld Optional virtual world the pile belongs to; omitted puts it in the global one.
8489
- * @returns The new pile's handle.
8490
- */
8491
- static spawn(position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): StonePile;
8492
-
8493
- /**
8494
- * Lists the stone piles the server has.
8495
- * @param virtualWorld Optional virtual world to list; omitted lists every one.
8496
- * @returns One handle per pile, in no particular order.
8497
- */
8498
- static all(virtualWorld?: number): StonePile[];
8499
-
8500
- /**
8501
- * Looks a pile up by its network entity ID.
8502
- * @param id Network entity identifier.
8503
- * @returns The pile's handle, or null when no live pile has that ID.
8504
- */
8505
- static getById(id: number): StonePile | null;
8506
-
8507
- /**
8508
- * Removes stone piles, emitting `stonePileDestroy` for each one.
8509
- * @param virtualWorld Optional virtual world to clear; omitted clears every one.
8510
- * @returns How many were removed.
8511
- */
8512
- static destroyAll(virtualWorld?: number): number;
8513
- }
8514
-
8515
- interface StonePile extends Entity {}
8516
-
8517
8974
  /**
8518
8975
  * Calls a function once after a delay.
8519
8976
  * @param handler Function to call.