@kingdomsconnected/types 1.6.3 → 1.6.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.
@@ -2192,7 +2192,7 @@ declare global {
2192
2192
  /**
2193
2193
  * 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.
2194
2194
  *
2195
- * 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.
2195
+ * 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, `setThirdPerson` puts it behind the player, and `setShot` stands it somewhere in the world.
2196
2196
  */
2197
2197
  const Camera: {
2198
2198
  /**
@@ -2211,7 +2211,7 @@ declare global {
2211
2211
  /**
2212
2212
  * Puts this player's camera behind them, for as long as it is on.
2213
2213
  *
2214
- * 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.
2214
+ * 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. Their head, which the game keeps out of its own first person, is drawn for as long as this camera is the one looking at them.
2215
2215
  *
2216
2216
  * 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.
2217
2217
  *
@@ -2225,6 +2225,31 @@ declare global {
2225
2225
  * @returns True from `setThirdPerson` until it is turned off, also while it waits for a body or for `NoClip`.
2226
2226
  */
2227
2227
  isThirdPerson(): boolean;
2228
+
2229
+ /**
2230
+ * Films this player's view from a fixed point: what a cutscene, an intro or a kill cam is made of.
2231
+ *
2232
+ * The camera holds there until `clearShot` -- or until another `setShot`, which glides on from wherever this one is. Nothing about the player's controls changes; a gamemode that wants them still says so through `Controls`. The player's head, which the game keeps out of its first person, is drawn for as long as the camera is looking at them from outside their eyes.
2233
+ *
2234
+ * There is one view to draw through. A shot outranks `setThirdPerson`, which takes over again when the shot ends, and `NoClip` cannot start while it holds. The map, the inventory and the other pause-screen pages are filmed by the game's own camera, so the shot steps aside while one is open and comes back when it closes. A shot ends with the session.
2235
+ *
2236
+ * The server can send the same shot with its own `Camera.setShot(player, options)`; whichever comes last wins.
2237
+ * @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 view is now, 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.
2238
+ * @returns True, or false while `NoClip` is flying or when `position` and `lookAt` are the same point.
2239
+ */
2240
+ setShot(options: { position: Vector3; lookAt: Vector3; duration?: number; fov?: number }): boolean;
2241
+
2242
+ /**
2243
+ * Gives the player their own view back. Does nothing without a shot.
2244
+ * @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. The glide follows the player if they move meanwhile. With `setThirdPerson` on, it ends behind them instead and their head stays drawn.
2245
+ */
2246
+ clearShot(duration?: number): void;
2247
+
2248
+ /**
2249
+ * Whether a shot holds the view.
2250
+ * @returns True from `setShot`, including its glide in, until `clearShot`; false already while gliding back.
2251
+ */
2252
+ isShotActive(): boolean;
2228
2253
  };
2229
2254
 
2230
2255
  /**
@@ -3592,6 +3617,61 @@ declare global {
3592
3617
  keys(): string[];
3593
3618
  };
3594
3619
 
3620
+ /**
3621
+ * A local inventory action intercepted before the game applies it. A snapshot, not permission to spend an item on the server.
3622
+ */
3623
+ interface InventoryUse {
3624
+ /**
3625
+ * Item class GUID, using the logical GUID for custom items.
3626
+ */
3627
+ item: string;
3628
+
3629
+ /**
3630
+ * Native instance UID as a lossless decimal string. Local to this client; splits, merges and reprojection may replace it.
3631
+ */
3632
+ uid: string;
3633
+
3634
+ /**
3635
+ * A server inventory row represented by the selected native item. Send this to a server resource to request consumption.
3636
+ */
3637
+ id: string;
3638
+
3639
+ /**
3640
+ * The inventory revision at the time of the action. The server must validate it and current ownership.
3641
+ */
3642
+ revision: number;
3643
+
3644
+ /**
3645
+ * Always 1. The override requests one use, even when a native row represents a stack.
3646
+ */
3647
+ amount: number;
3648
+
3649
+ /**
3650
+ * Which native path was intercepted. Eat/Drink and Learn use secondary; primary also includes equipment actions; activate is the native equip-toggle path.
3651
+ */
3652
+ action: "primary" | "secondary" | "activate";
3653
+ }
3654
+
3655
+ /**
3656
+ * Client-side overrides for actions in the local player's native inventory. Register by catalog item name, class GUID, custom item id, or { uid } for one native instance. A matching handler replaces the action before native consumption or effects. Scripts run on the next feature update, outside the native detour; return values are ignored and errors do not restore the native action. Only owned, synchronized inventory items dispatch. Pending uses are discarded if their handler, native item, server row or inventory revision disappears or changes. Instance handlers take priority over class handlers; otherwise the newest matching registration wins. Removing it reveals the earlier handler. Resource stop and session end remove handlers. The server remains responsible for validating requests, consuming inventory and applying effects. This API does not intercept quick-slot actions outside the inventory.
3657
+ */
3658
+ const Inventory: {
3659
+ /**
3660
+ * Registers an inventory action override for this resource. Adds a Use action even for an item without a normal primary action. Duplicate presses on the same UID within one frame are combined.
3661
+ * @param item Catalog name such as apple, a class GUID, a custom item id, or a native UID from InventoryUse.uid.
3662
+ * @param handler Runs instead of the native action. No item is automatically consumed.
3663
+ * @returns A registration id for offUse. Throws for an unknown class, invalid UID, missing resource or more than 256 active registrations.
3664
+ */
3665
+ onUse(item: string | { uid: string }, handler: (use: InventoryUse) => void): number;
3666
+
3667
+ /**
3668
+ * Removes a handler owned by the calling resource and discards its pending uses.
3669
+ * @param handlerId Id returned by onUse.
3670
+ * @returns False if the registration is missing or belongs to another resource.
3671
+ */
3672
+ offUse(handlerId: number): boolean;
3673
+ };
3674
+
3595
3675
  /**
3596
3676
  * Mutable two-dimensional vector.
3597
3677
  */
@@ -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
  */
@@ -361,6 +391,21 @@ declare global {
361
391
  */
362
392
  npcSpawn: [npc: Npc];
363
393
 
394
+ /**
395
+ * Its initial inventory has been established. The default stock is censused once by its elected simulator; Inventory.set establishes authored stock immediately.
396
+ */
397
+ npcInventoryReady: [npc: Npc];
398
+
399
+ /**
400
+ * 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.
401
+ */
402
+ npcHarvested: [npc: Npc, player: Player];
403
+
404
+ /**
405
+ * Committed stock changes, including loot transfers. Save this stock and restore it with Inventory.set. Harvest completion is reported by npcHarvested.
406
+ */
407
+ npcInventoryChanged: [npc: Npc, change: InventoryChange];
408
+
364
409
  /**
365
410
  * 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
411
  */
@@ -468,6 +513,16 @@ declare global {
468
513
  */
469
514
  siegeEngineUse: [player: Player, engine: SiegeEngine, action: "operate" | "winch" | "leave" | "load" | "fire"];
470
515
 
516
+ /**
517
+ * Dispatched when a blast takes `amount` off an engine with a `maxHealth`, before it is wrecked by it. `health` already reads what is left.
518
+ */
519
+ siegeEngineDamage: [engine: SiegeEngine, amount: number, attacker: Player | null];
520
+
521
+ /**
522
+ * 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.
523
+ */
524
+ siegeEngineWreck: [engine: SiegeEngine, attacker: Player | null];
525
+
471
526
  /**
472
527
  * Dispatched the moment an engine lets its projectile go, partway through the shot `fire` started.
473
528
  */
@@ -478,6 +533,51 @@ declare global {
478
533
  */
479
534
  siegeImpact: [engine: SiegeEngine | null, position: Vector3, attacker: Player | null];
480
535
 
536
+ /**
537
+ * Dispatched immediately after a siege ladder is placed.
538
+ */
539
+ siegeLadderSpawn: [ladder: SiegeLadder];
540
+
541
+ /**
542
+ * Dispatched while a siege ladder is being removed. The handle still resolves.
543
+ */
544
+ siegeLadderDestroy: [ladder: SiegeLadder];
545
+
546
+ /**
547
+ * 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.
548
+ */
549
+ siegeLadderUse: [player: Player, ladder: SiegeLadder, action: "push" | "raise"];
550
+
551
+ /**
552
+ * 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.
553
+ */
554
+ siegeLadderFall: [ladder: SiegeLadder, pusher: Player | null];
555
+
556
+ /**
557
+ * Dispatched when a raised ladder leans on its wall again and can be climbed.
558
+ */
559
+ siegeLadderRaise: [ladder: SiegeLadder];
560
+
561
+ /**
562
+ * Dispatched immediately after a stone pile is placed.
563
+ */
564
+ stonePileSpawn: [pile: StonePile];
565
+
566
+ /**
567
+ * Dispatched while a stone pile is being removed. The handle still resolves.
568
+ */
569
+ stonePileDestroy: [pile: StonePile];
570
+
571
+ /**
572
+ * 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.
573
+ */
574
+ stonePileThrow: [player: Player, pile: StonePile];
575
+
576
+ /**
577
+ * 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.
578
+ */
579
+ stoneImpact: [pile: StonePile | null, position: Vector3, attacker: Player];
580
+
481
581
  /**
482
582
  * 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
583
  */
@@ -619,61 +719,6 @@ declare global {
619
719
  * 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
720
  */
621
721
  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
722
  }
678
723
 
679
724
  /** Names of native events available in this scripting environment. */
@@ -1400,6 +1445,11 @@ declare global {
1400
1445
  */
1401
1446
  readonly disguise: string | null;
1402
1447
 
1448
+ /**
1449
+ * 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.
1450
+ */
1451
+ readonly visible: boolean;
1452
+
1403
1453
  /**
1404
1454
  * 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
1455
  */
@@ -1945,6 +1995,17 @@ declare global {
1945
1995
  */
1946
1996
  setDisguise(model: string | null): boolean;
1947
1997
 
1998
+ /**
1999
+ * 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.
2000
+ *
2001
+ * 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.
2002
+ *
2003
+ * 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.
2004
+ * @param visible False to stop drawing this player's body, true to draw it again.
2005
+ * @returns True when the request went out; false for a player with no connection to ask. Throws unless `visible` is a boolean.
2006
+ */
2007
+ setVisible(visible: boolean): boolean;
2008
+
1948
2009
  /**
1949
2010
  * Takes this player out of whatever saddle they are in: their own client gets them off, and `horseDismount` is raised.
1950
2011
  * @returns The horse they were taken off, or null when they were not riding one.
@@ -2006,6 +2067,91 @@ declare global {
2006
2067
 
2007
2068
  interface Player extends BasePlayer {}
2008
2069
 
2070
+ /**
2071
+ * A server-validated serving. Item properties and pot poison come from server state; changing the snapshot does not change the decision.
2072
+ */
2073
+ interface Consumption {
2074
+ /**
2075
+ * Where the serving comes from.
2076
+ */
2077
+ source: "inventory" | "cookPot";
2078
+
2079
+ /**
2080
+ * Native food or potion item class GUID.
2081
+ */
2082
+ item: string;
2083
+
2084
+ /**
2085
+ * Native food type; potions use the game's food type 1.
2086
+ */
2087
+ kind: "food" | "potion";
2088
+
2089
+ /**
2090
+ * 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.
2091
+ */
2092
+ baseEffects: { buff: string | null; health: number; energy: number; nourishment: number; alcohol: number } | null;
2093
+
2094
+ /**
2095
+ * Inventory row, or null for a pot meal.
2096
+ */
2097
+ rowId: string | null;
2098
+
2099
+ /**
2100
+ * Cooking pot GUID, or null for an inventory item.
2101
+ */
2102
+ potGuid: string | null;
2103
+
2104
+ /**
2105
+ * Server item properties, including condition. Empty for a pot meal.
2106
+ */
2107
+ metadata: Record<string, unknown>;
2108
+
2109
+ /**
2110
+ * Additional cooking pot poison buff GUID, or null. Spoilage and the item's own effects are part of nativeEffects.
2111
+ */
2112
+ poison: string | null;
2113
+
2114
+ /**
2115
+ * Whether native nutrition, energy, alcohol, potion and spoilage effects are allowed. Final in playerConsumed.
2116
+ */
2117
+ nativeEffects: boolean;
2118
+ }
2119
+
2120
+ /**
2121
+ * One candidate from the game's animal loot preset; probability and inventory population belong to the gamemode.
2122
+ */
2123
+ interface AnimalLootItem {
2124
+ /**
2125
+ * Item class GUID.
2126
+ */
2127
+ item: string;
2128
+
2129
+ /**
2130
+ * Maximum authored unit count.
2131
+ */
2132
+ amount: number;
2133
+
2134
+ /**
2135
+ * Authored quantity fraction, not a drop probability.
2136
+ */
2137
+ fraction: number;
2138
+
2139
+ /**
2140
+ * Uniform variation around the quantity fraction.
2141
+ */
2142
+ variation: number;
2143
+
2144
+ /**
2145
+ * The item is food.
2146
+ */
2147
+ food: boolean;
2148
+
2149
+ /**
2150
+ * Tagged as a special Harvester part in the game data. This is metadata; the gamemode decides eligibility.
2151
+ */
2152
+ harvester: boolean;
2153
+ }
2154
+
2009
2155
  /**
2010
2156
  * A count of units from one row.
2011
2157
  */
@@ -2022,11 +2168,11 @@ declare global {
2022
2168
  }
2023
2169
 
2024
2170
  /**
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.
2171
+ * 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
2172
  */
2027
2173
  interface InventoryRow {
2028
2174
  /**
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`.
2175
+ * 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
2176
  */
2031
2177
  id: string;
2032
2178
 
@@ -2036,7 +2182,7 @@ declare global {
2036
2182
  item: string;
2037
2183
 
2038
2184
  /**
2039
- * The item's name in the game's own tables; not localized text.
2185
+ * Internal table name, or Items.register id for a custom type. Display overrides are in metadata.custom.name.
2040
2186
  */
2041
2187
  name: string;
2042
2188
 
@@ -2061,22 +2207,22 @@ declare global {
2061
2207
  condition: number;
2062
2208
 
2063
2209
  /**
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.
2210
+ * 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
2211
  */
2066
2212
  equipped: number;
2067
2213
 
2068
2214
  /**
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.
2215
+ * 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
2216
  */
2071
2217
  metadata: Record<string, unknown>;
2072
2218
  }
2073
2219
 
2074
2220
  /**
2075
- * One player's inventory as the server holds it.
2221
+ * One player's or NPC's inventory as the server holds it.
2076
2222
  */
2077
2223
  interface InventoryState {
2078
2224
  /**
2079
- * The player's game shows this revision. False for a moment after every change, and until `playerInventoryReady`.
2225
+ * For a player, their game shows this revision. For an NPC, its initial stock has been established. Wait for `playerInventoryReady` or `npcInventoryReady` respectively.
2080
2226
  */
2081
2227
  ready: boolean;
2082
2228
 
@@ -2089,10 +2235,45 @@ declare global {
2089
2235
  * Every row.
2090
2236
  */
2091
2237
  items: InventoryRow[];
2238
+
2239
+ /**
2240
+ * NPC stock only: the carcass has already been harvested. Pass it to Inventory.set when restoring a corpse; absent preserves its existing state.
2241
+ */
2242
+ harvested: boolean | undefined;
2243
+
2244
+ /**
2245
+ * 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.
2246
+ */
2247
+ quickslots: InventoryQuickslots | null;
2248
+ }
2249
+
2250
+ /**
2251
+ * The current outfit's weapon and item quickslots. Indices are zero-based; each array has four entries. Empty references are null.
2252
+ */
2253
+ interface InventoryQuickslots {
2254
+ /**
2255
+ * Four weapon slots, each with primary and secondary row IDs. A row may appear in several slots.
2256
+ */
2257
+ weapons: { primary: string | null; secondary: string | null }[];
2258
+
2259
+ /**
2260
+ * Four item slots, containing row IDs or null. Save equipped belts and pouches with the inventory rows to retain slot capacity.
2261
+ */
2262
+ items: (string | null)[];
2263
+
2264
+ /**
2265
+ * Selected weapon slot, 0 through 3.
2266
+ */
2267
+ activeWeapon: number;
2268
+
2269
+ /**
2270
+ * Selected item slot, 0 through 3.
2271
+ */
2272
+ activeItem: number;
2092
2273
  }
2093
2274
 
2094
2275
  /**
2095
- * What one operation did to one player's inventory.
2276
+ * What one operation did to one inventory.
2096
2277
  */
2097
2278
  interface InventoryChange {
2098
2279
  /**
@@ -2101,7 +2282,7 @@ declare global {
2101
2282
  revision: number;
2102
2283
 
2103
2284
  /**
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.
2285
+ * `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
2286
  */
2106
2287
  reason: string;
2107
2288
 
@@ -2137,39 +2318,49 @@ declare global {
2137
2318
  }
2138
2319
 
2139
2320
  /**
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.
2321
+ * 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
2322
  */
2142
2323
  const Inventory: {
2143
2324
  /**
2144
- * Reads a player's inventory.
2145
- * @returns A copy of it, or null for a player who is not connected.
2325
+ * 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.
2326
+ */
2327
+ classes(): { id: string; name: string; nameKey: string; category: string; maximumQuality: number; quest: boolean }[];
2328
+
2329
+ /**
2330
+ * Reads a player's or NPC's inventory.
2331
+ * @returns A copy, or null for an owner that no longer exists.
2332
+ */
2333
+ get(owner: Player | Npc): InventoryState | null;
2334
+
2335
+ /**
2336
+ * 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
2337
  */
2147
- get(player: Player): InventoryState | null;
2338
+ add(owner: Player | Npc, request: { item: string; amount: number; metadata?: Record<string, unknown>; revision?: number; notify?: boolean }): InventoryResult;
2148
2339
 
2149
2340
  /**
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.
2341
+ * 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
2342
  */
2152
- add(player: Player, request: { item: string; amount: number; metadata?: Record<string, unknown>; revision?: number; notify?: boolean }): InventoryResult;
2343
+ remove(owner: Player | Npc, request: { units: InventoryUnit[]; revision?: number; notify?: boolean }): InventoryResult;
2153
2344
 
2154
2345
  /**
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.
2346
+ * 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
2347
  */
2157
- remove(player: Player, request: { units: InventoryUnit[]; revision?: number; notify?: boolean }): InventoryResult;
2348
+ updateCustom(player: Player, request: { id: string; name?: string | null; description?: string | null; data?: Record<string, unknown> | null; revision?: number }): InventoryResult;
2158
2349
 
2159
2350
  /**
2160
2351
  * 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
2352
  */
2162
- setProperties(player: Player, request: { id: string; metadata: Record<string, unknown>; revision?: number }): InventoryResult;
2353
+ setProperties(owner: Player | Npc, request: { id: string; metadata: Record<string, unknown>; revision?: number }): InventoryResult;
2163
2354
 
2164
2355
  /**
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.
2356
+ * 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
2357
  */
2167
- set(player: Player, request: { items: { id?: string; item: string; amount: number; metadata?: Record<string, unknown>; equipped?: number }[]; revision?: number }): InventoryResult;
2358
+ 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
2359
 
2169
2360
  /**
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.
2361
+ * 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
2362
  */
2172
- transfer(source: Player, target: Player, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number; notify?: boolean }): InventoryResult;
2363
+ transfer(source: Player | Npc, target: Player | Npc, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number; notify?: boolean }): InventoryResult;
2173
2364
 
2174
2365
  /**
2175
2366
  * 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 +2378,16 @@ declare global {
2187
2378
  setItemName(item: string, name: string | null): string[];
2188
2379
  };
2189
2380
 
2381
+ /**
2382
+ * Server-defined resource items using existing game appearances. Register types before restoring their instances.
2383
+ */
2384
+ const Items: {
2385
+ /**
2386
+ * 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.
2387
+ */
2388
+ register(id: string, definition: { name: string; description?: string; visual: string; weight: number; price?: number; stackable?: boolean; usable?: boolean; useLabel?: string }): string;
2389
+ };
2390
+
2190
2391
  /**
2191
2392
  * Replicated KCD2 horse handle.
2192
2393
  */
@@ -2531,6 +2732,11 @@ declare global {
2531
2732
  * 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
2733
  */
2533
2734
  price: number;
2735
+
2736
+ /**
2737
+ * Item properties, including custom display overrides and private data. Preserved when bought.
2738
+ */
2739
+ metadata?: Record<string, unknown> | undefined;
2534
2740
  }
2535
2741
 
2536
2742
  /**
@@ -2552,6 +2758,11 @@ declare global {
2552
2758
  * One settled line of a deal.
2553
2759
  */
2554
2760
  interface VendorTradeLine {
2761
+ /**
2762
+ * Exact item properties, including private custom data. Sold variants appear as separate lines.
2763
+ */
2764
+ metadata: Record<string, unknown>;
2765
+
2555
2766
  /**
2556
2767
  * The item class GUID.
2557
2768
  */
@@ -3742,6 +3953,29 @@ declare global {
3742
3953
 
3743
3954
  interface Vfx extends Entity {}
3744
3955
 
3956
+ /**
3957
+ * 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.
3958
+ */
3959
+ const Camera: {
3960
+ /**
3961
+ * 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`.
3962
+ *
3963
+ * 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.
3964
+ * @param player Whose view to film.
3965
+ * @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.
3966
+ * @returns True when the shot was sent, false when `position` and `lookAt` are the same point.
3967
+ */
3968
+ setShot(player: Player, options: { position: Vector3; lookAt: Vector3; duration?: number; fov?: number }): boolean;
3969
+
3970
+ /**
3971
+ * Gives a player their own view back. Harmless for a player without a shot.
3972
+ * @param player Whose view to give back.
3973
+ * @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.
3974
+ * @returns True when it was sent.
3975
+ */
3976
+ clearShot(player: Player, duration?: number): boolean;
3977
+ };
3978
+
3745
3979
  /**
3746
3980
  * Replicated ground marker handle.
3747
3981
  */
@@ -4167,9 +4401,9 @@ declare global {
4167
4401
  lootable: boolean;
4168
4402
 
4169
4403
  /**
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`.
4404
+ * 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
4405
  */
4172
- locomotion: string;
4406
+ locomotion: 'native' | 'kinematic';
4173
4407
 
4174
4408
  /**
4175
4409
  * What the NPC has been told to do: `hold`, `moveTo`, `follow`, `flee`, `lookAt`, `playAnim`, `talk` or `attack`.
@@ -4192,7 +4426,7 @@ declare global {
4192
4426
  readonly appearance: Appearance;
4193
4427
 
4194
4428
  /**
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`.
4429
+ * 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
4430
  */
4197
4431
  readonly wearing: string[];
4198
4432
 
@@ -4256,12 +4490,22 @@ declare global {
4256
4490
  setNametagColor(color: number): void;
4257
4491
 
4258
4492
  /**
4259
- * Despawns this NPC everywhere, after emitting npcDestroy.
4493
+ * 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.
4260
4494
  */
4261
- remove(): void;
4495
+ getAnimalLoot(): AnimalLootItem[] | null;
4262
4496
 
4263
4497
  /**
4264
- * Cancels whatever it was doing and leaves it standing where it is.
4498
+ * 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.
4499
+ */
4500
+ getInventory(): InventoryState | null;
4501
+
4502
+ /**
4503
+ * Despawns this NPC everywhere, after emitting npcDestroy.
4504
+ */
4505
+ remove(): void;
4506
+
4507
+ /**
4508
+ * Cancels whatever it was doing and leaves it standing where it is.
4265
4509
  */
4266
4510
  hold(): void;
4267
4511
 
@@ -4373,7 +4617,7 @@ declare global {
4373
4617
  say(text: string): boolean;
4374
4618
 
4375
4619
  /**
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`.
4620
+ * 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
4621
  * @param itemClasses Item class GUIDs in the dashed form the game's own tables spell them.
4378
4622
  * @returns True when every GUID names an item class this build has. Otherwise nothing changes, and each refused GUID is logged.
4379
4623
  */
@@ -4418,7 +4662,7 @@ declare global {
4418
4662
  pin(player: Player | number | null): void;
4419
4663
 
4420
4664
  /**
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.
4665
+ * 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
4666
  *
4423
4667
  * 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
4668
  * @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 +4671,7 @@ declare global {
4427
4671
  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
4672
 
4429
4673
  /**
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.
4674
+ * 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
4675
  * @param levelGuid `EntityGuid` of the body the level already placed.
4432
4676
  * @param options The same options a spawn takes; `soul` and `class` are ignored, since the body already exists.
4433
4677
  * @returns The NPC handle for that body.
@@ -4461,6 +4705,11 @@ declare global {
4461
4705
  */
4462
4706
  static roles(): string[];
4463
4707
 
4708
+ /**
4709
+ * 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.
4710
+ */
4711
+ 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 } }[];
4712
+
4464
4713
  /**
4465
4714
  * Animal souls with matching native classes. Pass a name or soul to Npc.create. Chickens use flock entities and are excluded.
4466
4715
  */
@@ -4990,6 +5239,21 @@ declare global {
4990
5239
  * A frozen snapshot of one stew pot in one virtual world.
4991
5240
  */
4992
5241
  interface CookPotSnapshot {
5242
+ /**
5243
+ * Meal served by this pot, including its native nutrition and appearance.
5244
+ */
5245
+ food: "goulash" | "lentil" | "soup";
5246
+
5247
+ /**
5248
+ * Base nutrition per meal: goulash 25, lentil 10, soup 15.
5249
+ */
5250
+ nutrition: number;
5251
+
5252
+ /**
5253
+ * Ingested buff GUID applied to future meals, or null. Visible to server scripts only.
5254
+ */
5255
+ poison: string | null;
5256
+
4993
5257
  /**
4994
5258
  * The fireplace's level GUID.
4995
5259
  */
@@ -5044,7 +5308,7 @@ declare global {
5044
5308
  get(guid: string, virtualWorld?: number): CookPotSnapshot | null;
5045
5309
 
5046
5310
  /**
5047
- * Replaces remaining stock and capacity, preserving enabled. Returns false for an unknown pot.
5311
+ * Replaces remaining stock and capacity and clears poison, preserving food and enabled. Returns false for an unknown pot.
5048
5312
  * @param guid Fireplace level GUID from CookPot.all().
5049
5313
  * @param portions Integer from 0 to 1000; defaults to four.
5050
5314
  * @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
@@ -5060,14 +5324,78 @@ declare global {
5060
5324
  setEnabled(guid: string, enabled: boolean, virtualWorld?: number): boolean;
5061
5325
 
5062
5326
  /**
5063
- * Changes food level and stock together, preserving enabled. Returns false for an unknown pot.
5327
+ * Changes food level and stock together, preserving food, poison and enabled. Returns false for an unknown pot.
5064
5328
  * @param guid Fireplace level GUID from CookPot.all().
5065
5329
  * @param state Empty, two portions, or four portions; resets capacity to four.
5066
5330
  * @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
5067
5331
  */
5068
5332
  setState(guid: string, state: "empty" | "half" | "full", virtualWorld?: number): boolean;
5333
+
5334
+ /**
5335
+ * Item class GUIDs accepted by CookPot.poison, including each native strength variant.
5336
+ */
5337
+ poisons(): string[];
5338
+
5339
+ /**
5340
+ * Changes future meals and appearance, preserving stock, poison and enabled. Already reserved meals keep their previous type.
5341
+ * @param guid Fireplace level GUID from CookPot.all().
5342
+ * @param food Native meal type.
5343
+ * @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
5344
+ */
5345
+ setFood(guid: string, food: "goulash" | "lentil" | "soup", virtualWorld?: number): boolean;
5346
+
5347
+ /**
5348
+ * 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.
5349
+ * @param player Connected player within four metres; their current virtual world selects the pot.
5350
+ * @param guid Fireplace level GUID from CookPot.all().
5351
+ * @param recipe Ingredients and yield chosen by this server script.
5352
+ */
5353
+ refillFromInventory(player: Player, guid: string, recipe: CookPotRecipe): CookPotResult;
5354
+
5355
+ /**
5356
+ * 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.
5357
+ * @param player Connected player within four metres; their current virtual world selects the pot.
5358
+ * @param guid Fireplace level GUID from CookPot.all().
5359
+ * @param rowId Inventory row containing a native Poison item; spends exactly one.
5360
+ */
5361
+ poison(player: Player, guid: string, rowId: string): CookPotResult;
5069
5362
  };
5070
5363
 
5364
+ /**
5365
+ * Server-defined ingredients and portions for refilling an empty pot.
5366
+ */
5367
+ interface CookPotRecipe {
5368
+ /**
5369
+ * Meal to put in the pot.
5370
+ */
5371
+ food: "goulash" | "lentil" | "soup";
5372
+
5373
+ /**
5374
+ * Integer from 1 to 1000.
5375
+ */
5376
+ portions: number;
5377
+
5378
+ /**
5379
+ * One to sixteen food item classes by name or GUID, with positive integer amounts. Split stacks are combined; spoiled rows are skipped.
5380
+ */
5381
+ ingredients: { item: string; amount: number }[];
5382
+ }
5383
+
5384
+ /**
5385
+ * An atomic pot action. A refusal changes neither items nor contents.
5386
+ */
5387
+ interface CookPotResult {
5388
+ /**
5389
+ * Whether the action succeeded.
5390
+ */
5391
+ ok: boolean;
5392
+
5393
+ /**
5394
+ * 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.
5395
+ */
5396
+ code: string;
5397
+ }
5398
+
5071
5399
  /** */
5072
5400
  interface NearestDoor {
5073
5401
  /**
@@ -5564,6 +5892,219 @@ declare global {
5564
5892
 
5565
5893
  interface SiegeEngine extends Entity {}
5566
5894
 
5895
+ /** */
5896
+ interface SiegeLadderKind {
5897
+ /**
5898
+ * Its name: `siege`, `tall`, `short` or `low`.
5899
+ */
5900
+ kind: string;
5901
+
5902
+ /**
5903
+ * The mesh it stands as, a path from the shared prop catalog.
5904
+ */
5905
+ model: string;
5906
+
5907
+ /**
5908
+ * How far up its rungs go, in metres.
5909
+ */
5910
+ height: number;
5911
+
5912
+ /**
5913
+ * How far it leans towards the wall standing, in degrees about its own X; it leans towards its forward.
5914
+ */
5915
+ lean: number;
5916
+ }
5917
+
5918
+ /**
5919
+ * Replicated handle for a siege ladder leaning on a wall.
5920
+ */
5921
+ class SiegeLadder {
5922
+ /**
5923
+ * Creates a script wrapper for an existing siege ladder with this ID; use SiegeLadder.spawn() to place one.
5924
+ * @param id Network entity identifier.
5925
+ */
5926
+ constructor(id: number);
5927
+
5928
+ /**
5929
+ * 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).
5930
+ */
5931
+ readonly kind: string;
5932
+
5933
+ /**
5934
+ * `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.
5935
+ */
5936
+ readonly pose: string;
5937
+
5938
+ /**
5939
+ * 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.
5940
+ */
5941
+ readonly height: number;
5942
+
5943
+ /**
5944
+ * Whether the game's own climb is offered on it: while it stands and nobody has started to push it.
5945
+ */
5946
+ readonly climbable: boolean;
5947
+
5948
+ /**
5949
+ * 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.
5950
+ */
5951
+ usable: boolean;
5952
+
5953
+ /**
5954
+ * Who last pushed it, or null.
5955
+ */
5956
+ readonly pusher: Player | null;
5957
+
5958
+ /**
5959
+ * Formats this ladder handle for logging and debugging.
5960
+ * @returns The ladder ID, its kind and its pose.
5961
+ */
5962
+ toString(): string;
5963
+
5964
+ /**
5965
+ * 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.
5966
+ * @param player Who pushes it: they play the game's own halberd push, and are credited with it in `siegeLadderFall`.
5967
+ * @returns What happened, and the phrase to explain it with when nothing did.
5968
+ */
5969
+ push(player?: Player | number | null): SiegeResult;
5970
+
5971
+ /**
5972
+ * Lays a fallen ladder back against its wall, over the lift's 5.7 seconds.
5973
+ * @param player Who raises it: they play the game's own ladder lift.
5974
+ * @returns What happened, and the phrase to explain it with when nothing did.
5975
+ */
5976
+ raise(player?: Player | number | null): SiegeResult;
5977
+
5978
+ /**
5979
+ * Breaks the ladder: it lies in pieces where it stands, anyone on it falls, and nothing raises it until `repair`.
5980
+ */
5981
+ break(): void;
5982
+
5983
+ /**
5984
+ * Puts a fallen or broken ladder back against its wall at once.
5985
+ */
5986
+ repair(): void;
5987
+
5988
+ /**
5989
+ * Removes the ladder on every client after emitting `siegeLadderDestroy`.
5990
+ */
5991
+ destroy(): void;
5992
+
5993
+ /**
5994
+ * 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.
5995
+ * @param kind `siege`, `tall`, `short` or `low`.
5996
+ * @param position Where its foot stands, on the ground below the wall.
5997
+ * @param rotation Its facing: forward is the way to the wall it leans on. A Quaternion, or a Vector3 of Euler angles in degrees.
5998
+ * @param virtualWorld Optional virtual world the ladder belongs to; omitted puts it in the global one.
5999
+ * @returns The new ladder's handle.
6000
+ */
6001
+ static spawn(kind: string, position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): SiegeLadder;
6002
+
6003
+ /**
6004
+ * 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.
6005
+ * @param kind `siege`, `tall`, `short` or `low`.
6006
+ * @returns The kind, or null for a name that is not one.
6007
+ */
6008
+ static describe(kind: string): SiegeLadderKind | null;
6009
+
6010
+ /**
6011
+ * Lists the siege ladders the server has.
6012
+ * @param virtualWorld Optional virtual world to list; omitted lists every one.
6013
+ * @returns One handle per ladder, in no particular order.
6014
+ */
6015
+ static all(virtualWorld?: number): SiegeLadder[];
6016
+
6017
+ /**
6018
+ * Looks a ladder up by its network entity ID.
6019
+ * @param id Network entity identifier.
6020
+ * @returns The ladder's handle, or null when no live ladder has that ID.
6021
+ */
6022
+ static getById(id: number): SiegeLadder | null;
6023
+
6024
+ /**
6025
+ * Removes siege ladders, emitting `siegeLadderDestroy` for each one.
6026
+ * @param virtualWorld Optional virtual world to clear; omitted clears every one.
6027
+ * @returns How many were removed.
6028
+ */
6029
+ static destroyAll(virtualWorld?: number): number;
6030
+ }
6031
+
6032
+ interface SiegeLadder extends Entity {}
6033
+
6034
+ /**
6035
+ * Replicated handle for a pile of hurling stones on a battlement.
6036
+ */
6037
+ class StonePile {
6038
+ /**
6039
+ * Creates a script wrapper for an existing stone pile with this ID; use StonePile.spawn() to place one.
6040
+ * @param id Network entity identifier.
6041
+ */
6042
+ constructor(id: number);
6043
+
6044
+ /**
6045
+ * 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.
6046
+ */
6047
+ stones: number;
6048
+
6049
+ /**
6050
+ * Whether players are offered the game's own prompt at the pile. On by default.
6051
+ */
6052
+ usable: boolean;
6053
+
6054
+ /**
6055
+ * 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.
6056
+ */
6057
+ damage: number;
6058
+
6059
+ /**
6060
+ * How far from where a stone comes down anyone is hurt, in metres, up to 10. 1.5 to start with.
6061
+ */
6062
+ damageRadius: number;
6063
+
6064
+ /**
6065
+ * Formats this pile handle for logging and debugging.
6066
+ * @returns The pile ID and the stones it has left.
6067
+ */
6068
+ toString(): string;
6069
+
6070
+ /**
6071
+ * Removes the pile on every client after emitting `stonePileDestroy`. A stone already thrown still lands.
6072
+ */
6073
+ destroy(): void;
6074
+
6075
+ /**
6076
+ * 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.
6077
+ * @param position Where the thrower stands on the walk, behind the parapet.
6078
+ * @param rotation Its facing: forward is the way the stones go, over the wall. A Quaternion, or a Vector3 of Euler angles in degrees.
6079
+ * @param virtualWorld Optional virtual world the pile belongs to; omitted puts it in the global one.
6080
+ * @returns The new pile's handle.
6081
+ */
6082
+ static spawn(position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): StonePile;
6083
+
6084
+ /**
6085
+ * Lists the stone piles the server has.
6086
+ * @param virtualWorld Optional virtual world to list; omitted lists every one.
6087
+ * @returns One handle per pile, in no particular order.
6088
+ */
6089
+ static all(virtualWorld?: number): StonePile[];
6090
+
6091
+ /**
6092
+ * Looks a pile up by its network entity ID.
6093
+ * @param id Network entity identifier.
6094
+ * @returns The pile's handle, or null when no live pile has that ID.
6095
+ */
6096
+ static getById(id: number): StonePile | null;
6097
+
6098
+ /**
6099
+ * Removes stone piles, emitting `stonePileDestroy` for each one.
6100
+ * @param virtualWorld Optional virtual world to clear; omitted clears every one.
6101
+ * @returns How many were removed.
6102
+ */
6103
+ static destroyAll(virtualWorld?: number): number;
6104
+ }
6105
+
6106
+ interface StonePile extends Entity {}
6107
+
5567
6108
  /** */
5568
6109
  interface AreaDefinition {
5569
6110
  /**
@@ -6099,6 +6640,11 @@ declare global {
6099
6640
  * 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
6641
  */
6101
6642
  const World: {
6643
+ /**
6644
+ * The configured level loaded by every client in this server session.
6645
+ */
6646
+ readonly level: string;
6647
+
6102
6648
  /**
6103
6649
  * Whole days the clock has run, from the level's own midnight. Starts at 0 and only grows.
6104
6650
  */
@@ -6164,6 +6710,11 @@ declare global {
6164
6710
  */
6165
6711
  readonly puddles: number;
6166
6712
 
6713
+ /**
6714
+ * 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.
6715
+ */
6716
+ pointsOfInterest(): { name: string; group: string; level: string; position: { x: number; y: number; z: number } }[];
6717
+
6167
6718
  /**
6168
6719
  * Winds the clock forward to an absolute day and hour, which is how a saved clock is restored.
6169
6720
  * @param day Absolute day to wind forward to, as the `day` property counts them. Must be whole.
@@ -8301,219 +8852,6 @@ declare global {
8301
8852
 
8302
8853
  interface BasePlayer extends Entity {}
8303
8854
 
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
8855
  /**
8518
8856
  * Calls a function once after a delay.
8519
8857
  * @param handler Function to call.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingdomsconnected/types",
3
- "version": "1.6.3",
3
+ "version": "1.6.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": [