@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.
@@ -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
  */