@falloutmp/types 0.2.5 → 0.3.1

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.
@@ -80,6 +80,11 @@ declare global {
80
80
  */
81
81
  inventoryChange: [changes: InventoryDelta[]];
82
82
 
83
+ /**
84
+ * Dispatched when the local player activates a reference: the Activate button, a prompt, a pick-up. `ref` is the placed reference's form ID, `base` its base object's. It tells of the attempt, which the game may still refuse; a reference with an activate parent raises one for the parent first. To stop an activation, block it beforehand with References.setActivationBlocked or Controls.setEnabled.
85
+ */
86
+ activate: [ref: number, base: number];
87
+
83
88
  /**
84
89
  * Dispatched when the local player opens or closes a door the session shares, as the server is told. `ref` is the placed reference's form ID.
85
90
  */
@@ -120,6 +125,11 @@ declare global {
120
125
  */
121
126
  workshopMove: [form: number, position: { x: number; y: number; z: number }];
122
127
 
128
+ /**
129
+ * Dispatched when the local player enters workshop mode at a workbench (`entering`) and when they leave it. `workbench` is the workbench reference's form ID.
130
+ */
131
+ workshopMode: [workbench: number, entering: boolean];
132
+
123
133
  /**
124
134
  * Dispatched when the local player scraps or stores a built object the session shares.
125
135
  */
@@ -199,6 +209,26 @@ declare global {
199
209
  * Dispatched on view creation and whenever Web.loadURL re-locks an owned view to a different origin.
200
210
  */
201
211
  browserOriginChange: [event: BrowserOriginChangeEvent];
212
+
213
+ /**
214
+ * Dispatched for every chat line the server sends. An empty author is a notice line; color is packed 0xRRGGBBAA, 0 for the chat box's default.
215
+ */
216
+ chatMessage: [message: { author: string; text: string; color: number }];
217
+
218
+ /**
219
+ * Dispatched synchronously for a line the player typed into the chat box, before it is sent. A handler returning false, not a Promise of it, blocks it; Chat.send does not raise this.
220
+ */
221
+ chatSend: [text: string];
222
+
223
+ /**
224
+ * Dispatched when the local player starts speaking, as isTalking turns true.
225
+ */
226
+ voiceStart: [];
227
+
228
+ /**
229
+ * Dispatched when the local player stops speaking, as isTalking turns false.
230
+ */
231
+ voiceStop: [];
202
232
  }
203
233
 
204
234
  /** Names of native events available in this scripting environment. */
@@ -215,6 +245,56 @@ declare global {
215
245
  */
216
246
  notify(message: string, sound?: string): void;
217
247
 
248
+ /**
249
+ * Plays a Vault Boy clip on the HUD, the animation a perk shows when it triggers, as Game.ShowPerkVaultBoyOnHUD does.
250
+ * @param swf The clip's path under Interface, such as "Components/VaultBoys/Perks/PerkClip_1d247c.swf".
251
+ * @param sound A sound descriptor's editor ID to play with it, such as "UIPerkRicochet".
252
+ * @returns False when the path is empty or the sound is not one the game knows; the clip still plays without it.
253
+ */
254
+ showVaultBoy(swf: string, sound?: string): boolean;
255
+
256
+ /**
257
+ * Shows a place name on the HUD, as the game does on coming up to a location the player knows: a zone a script defines announces itself this way.
258
+ * @param name The name to show.
259
+ * @returns False for an empty name.
260
+ */
261
+ showLocation(name: string): boolean;
262
+
263
+ /**
264
+ * Turns one of the HUD's own modes on or off, as Game.SetInsideMemoryHUDMode and Game.SetCharGenHUDMode do for theirs: the HUD shows, hides and restyles its parts by the modes that are on. A mode a script turned on stays until it turns it off; the game switches its own as before.
265
+ * @param mode The mode's name as the game knows it: "PowerArmor", "InsideMemory", "DialogueMode", "IronSights", "VATS", "WorkshopMode", "CharGen_Init" and the like.
266
+ * @param on On or off.
267
+ * @returns False for an empty name. A name the HUD does not know changes nothing.
268
+ */
269
+ setMode(mode: string, on: boolean): boolean;
270
+
271
+ /**
272
+ * Flashes the hit marker around the crosshair, as the game does when a sneak attack or a critical lands: the cue for a hit the server confirmed.
273
+ */
274
+ showHitMarker(): void;
275
+
276
+ /**
277
+ * Keeps the health or the action point bar on the HUD. The game hides each while it is full and nothing touches it; this holds one up until it is let go.
278
+ * @param meter Which bar.
279
+ * @param shown Kept up, or left to the HUD again.
280
+ */
281
+ setMeterShown(meter: "health" | "actionPoints", shown: boolean): void;
282
+
283
+ /**
284
+ * Blinks the health or the action point bar, as the game blinks the action points when an attack needs more than are left. A bar the HUD is hiding blinks unseen: keep it up with `setMeterShown` first.
285
+ * @param meter Which bar.
286
+ * @returns False when the game has no such actor value.
287
+ */
288
+ flashMeter(meter: "health" | "actionPoints"): boolean;
289
+
290
+ /**
291
+ * Shows a quest objective line on the HUD with any text, alone or under a banner shown just before, with the game's own sound and timing.
292
+ * @param text The line's text, shown as given: the game's own completed and failed lines open with "Completed: " and "Failed: ".
293
+ * @param kind A new objective, by default, or one drawn as done.
294
+ * @returns False when the quest that lends the objective is not loaded.
295
+ */
296
+ showObjective(text: string, kind?: "added" | "completed" | "failed"): boolean;
297
+
218
298
  /**
219
299
  * Shows the HUD's quest banner with any text. Banners queue behind the game's own. False when the quest that lends the icon is not loaded.
220
300
  * @param text The banner's text.
@@ -268,6 +348,14 @@ declare global {
268
348
  * The game's own menus, message boxes and dialogue wheel.
269
349
  */
270
350
  const Ui: {
351
+ /**
352
+ * Plays a Bink video over the game, as Game.PlayBink does: an intro, a cutscene between rounds. `Ui.hideMenu("PlayBinkMenu")` ends it early; `Ui.isMenuOpen("PlayBinkMenu")` tells when it is over.
353
+ * @param file The video's file name under Data/Video, such as "Intro.bk2": a name alone, no path.
354
+ * @param options Whether a key ends it (default false), whether it is letterboxed (default true), and whether the game's sound and music are silenced while it plays (default true).
355
+ * @returns False for an empty name or one that is not a bare file name.
356
+ */
357
+ playVideo(file: string, options?: { interruptible?: boolean; letterbox?: boolean; muteAudio?: boolean; muteMusic?: boolean }): boolean;
358
+
271
359
  /**
272
360
  * Opens a game menu by name. Takes effect next frame; an unknown name does nothing.
273
361
  * @param name The menu's registered name, such as "PipboyMenu".
@@ -447,6 +535,36 @@ declare global {
447
535
  */
448
536
  getFov(): { horizontal: number; vertical: number } | null;
449
537
 
538
+ /**
539
+ * Whether the player's camera is in its first-person state.
540
+ * @returns False in third person and in every other state: the fly camera, furniture, a scripted camera.
541
+ */
542
+ isFirstPerson(): boolean;
543
+
544
+ /**
545
+ * Puts the player's camera in first person, as Game.ForceFirstPerson does. The game only does it while the camera follows the player.
546
+ * @returns False before the camera exists.
547
+ */
548
+ forceFirstPerson(): boolean;
549
+
550
+ /**
551
+ * Makes the camera follow another body in third person, as Game.SetCameraTarget does: what a spectator mode is built on. The player's own body stays where it is and still takes its input; the camera comes back by itself when the body followed leaves this game.
552
+ * @param entityId The network ID of a player or an NPC, as the server knows it (`player.id`); null for the player's own body.
553
+ * @returns False when no such player or NPC has a body loaded here.
554
+ */
555
+ setTarget(entityId: number | null): boolean;
556
+
557
+ /**
558
+ * The network ID of the body the camera was told to follow; null while it follows the player's own.
559
+ */
560
+ getTarget(): number | null;
561
+
562
+ /**
563
+ * Puts the player's camera in third person, as Game.ForceThirdPerson does. The game refuses from some states, such as furniture, and waits for an open menu to close.
564
+ * @returns False before the camera exists.
565
+ */
566
+ forceThirdPerson(): boolean;
567
+
450
568
  /**
451
569
  * The game's back buffer, in pixels: the space worldToScreen answers in.
452
570
  */
@@ -461,6 +579,58 @@ declare global {
461
579
  worldToScreen(x: number, y: number, z: number): { x: number; y: number; onScreen: boolean } | null;
462
580
  };
463
581
 
582
+ /**
583
+ * The game's own tuning values (game settings, GMST) in this player's game: how high a jump goes, how fast a sprint is, what a lock costs to pick. The game reads them where they stand, so a change takes effect at once, for this player alone; a server sets the same on every client to make it a rule. What a script changed goes back to what it was when the session ends.
584
+ */
585
+ const GameSettings: {
586
+ /**
587
+ * A game setting's value.
588
+ * @param name The setting's name as the game's data defines it: "fJumpHeightMin", "fSprintSpeedMult", "iMaxCharacterLevel". The first letter says what it holds: f a number, i and u a whole number, b a boolean, s a text.
589
+ * @returns Null when the game has no setting of that name.
590
+ */
591
+ get(name: string): number | boolean | string | null;
592
+
593
+ /**
594
+ * Changes a game setting for this player's game, until the session ends.
595
+ * @param name The setting's name as the game's data defines it: "fJumpHeightMin", "fSprintSpeedMult", "iMaxCharacterLevel". The first letter says what it holds: f a number, i and u a whole number, b a boolean, s a text.
596
+ * @param value The new value, of the setting's kind.
597
+ * @returns False when the game has no setting of that name, it holds a text, or the value is not of its kind.
598
+ */
599
+ set(name: string, value: number | boolean): boolean;
600
+ };
601
+
602
+ /**
603
+ * The local player's controls, on a layer of the game's own input locks: a control the game itself holds off stays off.
604
+ */
605
+ const Controls: {
606
+ /**
607
+ * Turns one control off or back on. Everything comes back on disconnect.
608
+ * @param control Which control.
609
+ * @param enabled False holds it off.
610
+ * @returns False when the game had no free layer.
611
+ */
612
+ setEnabled(control: "movement" | "looking" | "fighting" | "sneaking" | "menu" | "jumping" | "journal" | "activate" | "fastTravel" | "camSwitch" | "vats" | "favorites" | "zKey" | "running" | "sprinting", enabled: boolean): boolean;
613
+
614
+ /**
615
+ * Whether every layer, the game's included, lets the control through.
616
+ * @param control Which control.
617
+ * @returns True when it is on.
618
+ */
619
+ isEnabled(control: "movement" | "looking" | "fighting" | "sneaking" | "menu" | "jumping" | "journal" | "activate" | "fastTravel" | "camSwitch" | "vats" | "favorites" | "zKey" | "running" | "sprinting"): boolean;
620
+
621
+ /**
622
+ * Whether a script holds the control off, whatever the game's own layers do.
623
+ * @param control Which control.
624
+ * @returns True when setEnabled turned it off.
625
+ */
626
+ isDisabledByScripts(control: "movement" | "looking" | "fighting" | "sneaking" | "menu" | "jumping" | "journal" | "activate" | "fastTravel" | "camSwitch" | "vats" | "favorites" | "zKey" | "running" | "sprinting"): boolean;
627
+
628
+ /**
629
+ * Gives back everything scripts held off.
630
+ */
631
+ reset(): void;
632
+ };
633
+
464
634
  /**
465
635
  * Markers on the local player's HUD compass and Pip-Boy map, drawn by the game's own widgets. Only this client sees them; they go when the resource that made them stops.
466
636
  */
@@ -748,6 +918,139 @@ declare global {
748
918
  */
749
919
  getOutfit(): OutfitPiece[];
750
920
 
921
+ /**
922
+ * Whether the player's Pip-Boy light is on.
923
+ * @returns False before the player exists.
924
+ */
925
+ isPipboyLightOn(): boolean;
926
+
927
+ /**
928
+ * Turns the player's Pip-Boy light on or off, as the light key does, without its sound.
929
+ * @param on On or off.
930
+ * @returns False before the player stands in the world.
931
+ */
932
+ setPipboyLight(on: boolean): boolean;
933
+
934
+ /**
935
+ * Puts the player into a piece of furniture at once, wherever they stand, as Actor.SnapIntoInteraction does: a chair seats them, a bed lays them down, once its animations are loaded. A seated player stands up by moving; one lying in a bed is there until leaveFurniture.
936
+ * @param furniture The furniture reference: a chair, a bed, a workbench.
937
+ * @returns False before the player stands in the world, while they are down or dead, when the furniture is not loaded here or would not take them.
938
+ */
939
+ useFurniture(furniture: number | string): boolean;
940
+
941
+ /**
942
+ * Has the player get up from the furniture they are in, or stop making for it.
943
+ * @returns False when they are in none.
944
+ */
945
+ leaveFurniture(): boolean;
946
+
947
+ /**
948
+ * Whether the player is in a piece of furniture: seated, lying asleep, or on their way in or out of one.
949
+ */
950
+ getFurnitureState(): "none" | "sitting" | "sleeping" | "moving";
951
+
952
+ /**
953
+ * Holds the player in place, as Actor.SetRestrained does: they stand where they are and neither move nor act until let go. Cuffs, a stun, a cutscene.
954
+ * @param restrained Held, or let go.
955
+ * @returns False before the player stands in the world, or while they are down or dead.
956
+ */
957
+ setRestrained(restrained: boolean): boolean;
958
+
959
+ /**
960
+ * Knocks the player off their feet into their ragdoll, as ObjectReference.PushActorAway does: they fall, lie a moment and get up by themselves. Every other player sees them fall and get up.
961
+ * @param force How hard they are thrown, as ObjectReference.PushActorAway takes it; 0, the default, drops them where they stand.
962
+ * @param from The point they are thrown away from; their own position by default.
963
+ * @returns False before the player stands in the world, while they are dead, down already, bleeding out, held in place or in furniture.
964
+ */
965
+ knockDown(force?: number, from?: { x: number; y: number; z: number }): boolean;
966
+
967
+ /**
968
+ * Whether the player is knocked down: in their ragdoll or getting up from it, by a script or by the game, a blast for one.
969
+ */
970
+ isKnockedDown(): boolean;
971
+
972
+ /**
973
+ * Puts the player into the game's bleedout, or gets them out of it: down on the ground and alive, the camera pulled out, the controls held, as a downed companion is. Every other player sees them down. Nothing kills them there, as nothing kills a downed companion; they stay until a script gets them up or the session ends, and get up at full health.
974
+ * @param bleedingOut True to go down, false to get back up.
975
+ * @returns False before the player stands in the world, while they are dead or held in place.
976
+ */
977
+ setBleedingOut(bleedingOut: boolean): boolean;
978
+
979
+ /**
980
+ * Whether the player is in the game's bleedout.
981
+ */
982
+ isBleedingOut(): boolean;
983
+
984
+ /**
985
+ * Whether the player is held in place by `setRestrained`.
986
+ */
987
+ isRestrained(): boolean;
988
+
989
+ /**
990
+ * Plays a holotape recording in the player's Pip-Boy, in place of the one in it, without the loading animation: the radio goes quiet while it runs, as when the player loads one. Seen and heard in this game alone.
991
+ * @param holotape The holotape's form ID. It need not be carried.
992
+ * @returns False when the form is no holotape, holds no recording (a game or a terminal tape), or would not start.
993
+ */
994
+ playHolotape(holotape: number | string): boolean;
995
+
996
+ /**
997
+ * Stops the player's holotape and takes it out.
998
+ * @returns False when there was none.
999
+ */
1000
+ stopHolotape(): boolean;
1001
+
1002
+ /**
1003
+ * The holotape in the player's Pip-Boy and whether it runs now; null for none.
1004
+ */
1005
+ getHolotape(): { form: number; playing: boolean } | null;
1006
+
1007
+ /**
1008
+ * The named location the player is in, a BGSLocation form ID, as ObjectReference.GetCurrentLocation reads it.
1009
+ * @returns Null in the open, where the game names no location.
1010
+ */
1011
+ getLocation(): number | null;
1012
+
1013
+ /**
1014
+ * Where the player's own map marker is: the waypoint dropped on the Pip-Boy map.
1015
+ * @returns Null while there is none.
1016
+ */
1017
+ getMapWaypoint(): { x: number; y: number; z: number } | null;
1018
+
1019
+ /**
1020
+ * Drops the player's own map marker, or takes it off, as they would on the Pip-Boy map: the server's `playerMapWaypoint` hears of it and may put back what was there.
1021
+ * @param position Where to, in the space the player stands in; null takes it off.
1022
+ * @returns False before the player stands in the world.
1023
+ */
1024
+ setMapWaypoint(position: { x: number; y: number; z: number } | null): boolean;
1025
+
1026
+ /**
1027
+ * Asks to fast travel to a reference, as picking it on the Pip-Boy map does: the server's `playerFastTravel` decides, and the player travels when no script refuses.
1028
+ * @param destination The reference to arrive at: a map marker, or any other placed reference.
1029
+ * @returns True when asked; false when the reference is not here or the player does not stand in the world.
1030
+ */
1031
+ fastTravel(destination: number | string): boolean;
1032
+
1033
+ /**
1034
+ * Draws the player's body more or less see-through in this game, as Actor.SetAlpha does. Other players' games are not told.
1035
+ * @param alpha 0, invisible, to 1, opaque.
1036
+ * @param fade Fade there rather than cut (default false).
1037
+ * @returns False before the player stands in the world.
1038
+ */
1039
+ setAlpha(alpha: number, fade?: boolean): boolean;
1040
+
1041
+ /**
1042
+ * Whether the game holds the player invulnerable: setInvulnerable, or the game's own god mode.
1043
+ * @returns False before the player exists.
1044
+ */
1045
+ isInvulnerable(): boolean;
1046
+
1047
+ /**
1048
+ * Makes the player a ghost, as Actor.SetGhost does: attacks in their own game pass through them, and their game refuses the hits other players' games land on them.
1049
+ * @param invulnerable The flag.
1050
+ * @returns False before the player exists.
1051
+ */
1052
+ setInvulnerable(invulnerable: boolean): boolean;
1053
+
751
1054
  /**
752
1055
  * The power armor frame the player wears.
753
1056
  * @returns Null when they wear none, and outside a session.
@@ -851,6 +1154,30 @@ declare global {
851
1154
  counterpart: number | null;
852
1155
  }
853
1156
 
1157
+ /**
1158
+ * The local player's workshop mode: the settlement build mode a workbench opens.
1159
+ */
1160
+ const Workshop: {
1161
+ /**
1162
+ * The workbench the player's workshop mode runs on, its reference's form ID.
1163
+ * @returns Null outside workshop mode.
1164
+ */
1165
+ getCurrent(): number | null;
1166
+
1167
+ /**
1168
+ * Puts the player in workshop mode on a workbench, wherever they stand, as ObjectReference.StartWorkshop does.
1169
+ * @param workbench A workbench reference loaded in this game.
1170
+ * @returns False when it is no loaded workbench or the player is in workshop mode already.
1171
+ */
1172
+ enter(workbench: number | string): boolean;
1173
+
1174
+ /**
1175
+ * Ends workshop mode, as leaving its menu does; the game does it on its next frame.
1176
+ * @returns False outside workshop mode.
1177
+ */
1178
+ leave(): boolean;
1179
+ };
1180
+
854
1181
  /**
855
1182
  * The server's clock and sky, as this client holds them. Read-only: the server's `World` sets them.
856
1183
  */
@@ -872,6 +1199,13 @@ declare global {
872
1199
  * @returns Null while the region decides the weather, and before the server's world streams in.
873
1200
  */
874
1201
  getWeather(): number | null;
1202
+
1203
+ /**
1204
+ * What a weather is, from this game's data: its kind, its wind from 0 to 1, where its fog starts and ends by day and by night in game units, and the precipitation and screen effect it comes with.
1205
+ * @param weather A weather (WTHR) by form ID; the one the sky is in or moving to when left out.
1206
+ * @returns Null when the form is not a weather, or the sky has none yet.
1207
+ */
1208
+ getWeatherInfo(weather?: number | string): { weather: number; kind: "none" | "pleasant" | "cloudy" | "rain" | "snow"; windSpeed: number; fog: { dayNear: number; dayFar: number; nightNear: number; nightFar: number; dayPower: number; nightPower: number; dayMax: number; nightMax: number }; precipitation: number | null; visualEffect: number | null } | null;
875
1209
  };
876
1210
 
877
1211
  /**
@@ -883,6 +1217,241 @@ declare global {
883
1217
  * @returns One entry per station, in no particular order; empty outside a session.
884
1218
  */
885
1219
  getStations(): { name: string; frequency: number }[];
1220
+
1221
+ /**
1222
+ * Whether the player's Pip-Boy radio is on, as Game.IsPlayerRadioOn reads it.
1223
+ * @returns False while it is off or the player has no radio.
1224
+ */
1225
+ isOn(): boolean;
1226
+
1227
+ /**
1228
+ * Turns the player's Pip-Boy radio on or off, as Game.TurnPlayerRadioOn does.
1229
+ * @param on On or off.
1230
+ */
1231
+ setOn(on: boolean): void;
1232
+
1233
+ /**
1234
+ * The frequency the player's Pip-Boy radio is tuned to, as Game.GetPlayerRadioFrequency reads it.
1235
+ * @returns 0 while the player has no radio.
1236
+ */
1237
+ getFrequency(): number;
1238
+
1239
+ /**
1240
+ * Tunes the player's Pip-Boy radio, as Game.SetPlayerRadioFrequency does.
1241
+ * @param frequency A station's frequency, as getStations lists it.
1242
+ */
1243
+ setFrequency(frequency: number): void;
1244
+ };
1245
+
1246
+ /**
1247
+ * The state of a placed reference in this player's game alone. Nothing here reaches another player: a script that wants everyone to agree tells each client.
1248
+ */
1249
+ const References: {
1250
+ /**
1251
+ * Has the local player activate the reference, wherever they stand, as ObjectReference.Activate does: a door opens, an item is picked up, a container shows its menu. Raises `activate` like any other.
1252
+ * @param ref The reference's form ID.
1253
+ * @param defaultProcessingOnly Skip what the reference's own scripts would do about it (default false).
1254
+ * @returns False when the reference is not loaded here or the game activated nothing.
1255
+ */
1256
+ activate(ref: number | string, defaultProcessingOnly?: boolean): boolean;
1257
+
1258
+ /**
1259
+ * What a reference is and where it stands: the form ID of the base object it is placed from, its position in world units and its rotation in radians about the X, Y and Z axes.
1260
+ * @param ref The reference's form ID.
1261
+ * @returns Null when the reference is not here.
1262
+ */
1263
+ getInfo(ref: number | string): { base: number; position: { x: number; y: number; z: number }; rotation: { x: number; y: number; z: number } } | null;
1264
+
1265
+ /**
1266
+ * The placed references around the player, nearest first: what a script looks the world up by before it reads or changes a reference. It walks the cells loaded in this game, so call it when needed, not every frame. Actors are not references here.
1267
+ * @param base The base object the references are placed from, such as a container's or a door's form ID; null for any.
1268
+ * @param radius How far from the player, in world units.
1269
+ * @param limit How many at most (default 32, never more than 512).
1270
+ * @returns Empty before the player stands in the world, or when the base is no form.
1271
+ */
1272
+ find(base: number | string | null, radius: number, limit?: number): number[];
1273
+
1274
+ /**
1275
+ * Sends an animation event to the reference's behavior graph, as ObjectReference.PlayAnimation does: a machine starts, a prop moves, without the activation and what it would trigger. Seen in this game alone. Only objects animated by a behavior graph take one; `getAnimationGraph` tells which are.
1276
+ * @param ref The reference's form ID.
1277
+ * @param event The animation event's name, as the object's behavior graph knows it.
1278
+ * @returns False when the reference is not loaded here or no graph of its took the event.
1279
+ */
1280
+ playAnimation(ref: number | string, event: string): boolean;
1281
+
1282
+ /**
1283
+ * The name of the behavior graph that animates the reference, the one `playAnimation` sends its events to.
1284
+ * @param ref The reference's form ID.
1285
+ * @returns Null when the reference is not loaded here or no behavior graph animates it.
1286
+ */
1287
+ getAnimationGraph(ref: number | string): string | null;
1288
+
1289
+ /**
1290
+ * Says whether the physics moves an object, as ObjectReference.SetMotionType does: freeze a crate in mid-air, or let a fixed prop fall. In this game alone.
1291
+ * @param ref The reference's form ID.
1292
+ * @param type Dynamic: the physics moves it, so it falls and can be pushed. Keyframed: it stays where it is put, whatever hits it.
1293
+ * @returns False when the reference is not loaded here or its model has no physics.
1294
+ */
1295
+ setMotionType(ref: number | string, type: "dynamic" | "keyframed"): boolean;
1296
+
1297
+ /**
1298
+ * Pushes an object the physics moves, as ObjectReference.ApplyHavokImpulse does: a can flies, a crate slides. In this game alone, as its physics are.
1299
+ * @param ref The reference's form ID.
1300
+ * @param direction Which way to push, in world axes; its length does not matter.
1301
+ * @param magnitude How hard, as ObjectReference.ApplyHavokImpulse takes it; the game scales it by the object's mass.
1302
+ * @returns False when the reference is not loaded here or nothing of it is a physics body. A body the physics holds fixed takes the push and stays where it is.
1303
+ */
1304
+ applyImpulse(ref: number | string, direction: { x: number; y: number; z: number }, magnitude: number): boolean;
1305
+
1306
+ /**
1307
+ * The form ID of the actor that stands for another player or an NPC in this game: what `openTrade` and `showBarterMenu` take. A session's players and NPCs are this game's own copies, so the reference ID the server knows an NPC by is not theirs; this one is good only here and only while the body is loaded.
1308
+ * @param entityId The network ID of a player or an NPC, as the server knows it (`player.id`, `npc.id`).
1309
+ * @returns Null for the local player and for an entity with no body loaded here.
1310
+ */
1311
+ getEntityBody(entityId: number): number | null;
1312
+
1313
+ /**
1314
+ * Holds an actor in place, as Actor.SetRestrained does: it stays as it is and its own behavior stops until it is let go. It holds while this game simulates the actor.
1315
+ * @param actor The actor's form ID in this game, as `getEntityBody` gives it.
1316
+ * @param restrained Held, or let go.
1317
+ * @returns False when the actor is not loaded here, or is down or dead.
1318
+ */
1319
+ setActorRestrained(actor: number | string, restrained: boolean): boolean;
1320
+
1321
+ /**
1322
+ * Puts an actor into a piece of furniture at once, without walking to it, as Actor.SnapIntoInteraction does: a chair seats it, a bed lays it down asleep. It lasts while this game simulates the actor and its own behavior leaves it there.
1323
+ * @param actor The actor's form ID in this game, as `getEntityBody` gives it.
1324
+ * @param furniture The furniture reference: a chair, a bed, a workbench.
1325
+ * @returns False when the actor or the furniture is not loaded here, or the furniture would not take it.
1326
+ */
1327
+ useFurniture(actor: number | string, furniture: number | string): boolean;
1328
+
1329
+ /**
1330
+ * Opens the game's container menu on a container, wherever the player stands, as activating it does but without its lock or its opening animation. In a session the server's `containerOpen` runs first and the menu opens once it lets the player in, holding what a server script filled the container with there: a stash or a shop of the player's own.
1331
+ * @param ref The reference's form ID.
1332
+ * @returns False when the reference is not loaded here or is no container, when another player has it open, or while this player has a container open.
1333
+ */
1334
+ openContainer(ref: number | string): boolean;
1335
+
1336
+ /**
1337
+ * Opens the give-and-take screen on an actor, the one the game shows for a companion, as Actor.OpenInventory does when forced.
1338
+ * @param ref The reference's form ID.
1339
+ * @returns False when the reference is no actor loaded here.
1340
+ */
1341
+ openTrade(ref: number | string): boolean;
1342
+
1343
+ /**
1344
+ * Opens the game's barter screen on an actor, as Actor.ShowBarterMenu does: it sells what the game works out as that actor's vendor stock.
1345
+ * @param ref The reference's form ID.
1346
+ * @returns False when the reference is no actor loaded here.
1347
+ */
1348
+ showBarterMenu(ref: number | string): boolean;
1349
+
1350
+ /**
1351
+ * An actor value on the reference, as ObjectReference.GetValue reads it. A workbench keeps its settlement's figures this way: its build budget, its population, its power.
1352
+ * @param ref The reference's form ID.
1353
+ * @param value An ActorValueInfo form ID.
1354
+ * @returns Null when the reference is not here or the form ID is no actor value.
1355
+ */
1356
+ getValue(ref: number | string, value: number | string): number | null;
1357
+
1358
+ /**
1359
+ * Sets an actor value on the reference, as ObjectReference.SetValue does.
1360
+ * @param ref The reference's form ID.
1361
+ * @param value An ActorValueInfo form ID.
1362
+ * @param amount The new value.
1363
+ * @returns False when the reference is not here or the form ID is no actor value.
1364
+ */
1365
+ setValue(ref: number | string, value: number | string, amount: number): boolean;
1366
+
1367
+ /**
1368
+ * A map marker's state on this player's map: whether it shows, whether it is a fast travel destination, and its icon type. The server changes it with `Player.discoverLocations` and `forgetLocations`.
1369
+ * @param ref The reference's form ID.
1370
+ * @returns Null when the reference is not here or is no map marker.
1371
+ */
1372
+ getMapMarker(ref: number | string): { visible: boolean; canTravel: boolean; type: number } | null;
1373
+
1374
+ /**
1375
+ * Whether the reference is in this game with its 3D loaded.
1376
+ * @param ref The reference's form ID.
1377
+ * @returns False when it is not here.
1378
+ */
1379
+ isLoaded(ref: number | string): boolean;
1380
+
1381
+ /**
1382
+ * The reference's scale, 1 being its normal size.
1383
+ * @param ref The reference's form ID.
1384
+ * @returns Null when it is not here.
1385
+ */
1386
+ getScale(ref: number | string): number | null;
1387
+
1388
+ /**
1389
+ * Scales the reference.
1390
+ * @param ref The reference's form ID.
1391
+ * @param scale 0.01 to 10.
1392
+ * @returns False when it is not here.
1393
+ */
1394
+ setScale(ref: number | string, scale: number): boolean;
1395
+
1396
+ /**
1397
+ * The level a pick attempt on the reference's lock faces.
1398
+ * @param ref The reference's form ID.
1399
+ * @returns Null when it is not here or has no lock.
1400
+ */
1401
+ getLockLevel(ref: number | string): number | null;
1402
+
1403
+ /**
1404
+ * Sets the level of the reference's lock; one with no lock gets an unlocked one.
1405
+ * @param ref The reference's form ID.
1406
+ * @param level 0 to 255.
1407
+ * @returns False when it is not here.
1408
+ */
1409
+ setLockLevel(ref: number | string, level: number): boolean;
1410
+
1411
+ /**
1412
+ * The game's destroyed flag.
1413
+ * @param ref The reference's form ID.
1414
+ * @returns False when it is not here.
1415
+ */
1416
+ isDestroyed(ref: number | string): boolean;
1417
+
1418
+ /**
1419
+ * Sets the game's destroyed flag: a destroyed reference cannot be activated.
1420
+ * @param ref The reference's form ID.
1421
+ * @param destroyed The flag.
1422
+ * @returns False when it is not here.
1423
+ */
1424
+ setDestroyed(ref: number | string, destroyed: boolean): boolean;
1425
+
1426
+ /**
1427
+ * Whether a flora or produce reference is picked.
1428
+ * @param ref The reference's form ID.
1429
+ * @returns False when it is not here.
1430
+ */
1431
+ isHarvested(ref: number | string): boolean;
1432
+
1433
+ /**
1434
+ * Shows a flora or produce reference picked, or grown back.
1435
+ * @param ref The reference's form ID.
1436
+ * @param harvested The flag.
1437
+ * @returns False when it is not here or is neither.
1438
+ */
1439
+ setHarvested(ref: number | string, harvested: boolean): boolean;
1440
+
1441
+ /**
1442
+ * Whether activating the reference is refused.
1443
+ * @param ref The reference's form ID.
1444
+ * @returns False when it is not here.
1445
+ */
1446
+ isActivationBlocked(ref: number | string): boolean;
1447
+
1448
+ /**
1449
+ * Blocks or allows activating the reference.
1450
+ * @param ref The reference's form ID.
1451
+ * @param blocked The flag.
1452
+ * @returns False when it is not here.
1453
+ */
1454
+ setActivationBlocked(ref: number | string, blocked: boolean): boolean;
886
1455
  };
887
1456
 
888
1457
  /**
@@ -1695,7 +2264,7 @@ declare global {
1695
2264
  /**
1696
2265
  * Sends a named event from this client to the server's isolated onClient handlers.
1697
2266
  * @param eventName Server-side client-event name.
1698
- * @param payload Optional string payload sent verbatim; other values are JSON-serialized.
2267
+ * @param payload Optional payload. A string is sent as is and must already be JSON text: the server parses it and drops an event that does not parse. Other values are JSON-serialized.
1699
2268
  */
1700
2269
  emitServer(eventName: string, payload?: unknown): void;
1701
2270
  }
@@ -2436,6 +3005,12 @@ declare global {
2436
3005
  */
2437
3006
  getUserId(): string;
2438
3007
 
3008
+ /**
3009
+ * Returns the signed-in Discord user's username.
3010
+ * @returns Username string, or an empty string until available.
3011
+ */
3012
+ getUsername(): string;
3013
+
2439
3014
  /**
2440
3015
  * Checks whether Discord is connected and can publish presence.
2441
3016
  * @returns True when rich presence is initialized.
@@ -2514,7 +3089,7 @@ declare global {
2514
3089
  getPushToTalkKey(): string;
2515
3090
 
2516
3091
  /**
2517
- * Sets how long transmission continues after push-to-talk is released, so letting go slightly early does not clip the end of a word. Muting, turning voice off and losing input focus still stop it at once.
3092
+ * Sets how long transmission continues after push-to-talk is released, so letting go slightly early does not clip the end of a word. Muting, turning voice off and starting to type into a text field still stop it at once.
2518
3093
  * @param milliseconds How long to keep transmitting after the key goes up. Clamped to 0..2000.
2519
3094
  */
2520
3095
  setPushToTalkReleaseDelay(milliseconds: number): void;
@@ -2562,8 +3137,8 @@ declare global {
2562
3137
  getActivationThreshold(): number;
2563
3138
 
2564
3139
  /**
2565
- * Reads how loud the microphone is right now, whether or not anything is being sent -- the value to draw a level meter from and to tune the activation threshold against.
2566
- * @returns Smoothed level from 0 to 1; 0 while no microphone is open.
3140
+ * Reads how loud the microphone is while this player is sending voice. The microphone stays open for the whole session, so what it hears the rest of the time is not given to scripts.
3141
+ * @returns Smoothed level from 0 to 1 while isTalking is true; 0 otherwise.
2567
3142
  */
2568
3143
  getInputLevel(): number;
2569
3144
 
@@ -55,6 +55,11 @@ declare global {
55
55
  */
56
56
  playerReload: [player: Player, event: string];
57
57
 
58
+ /**
59
+ * Dispatched when a player swings a melee weapon or their fists, before it is shown to the players around them. `event` is the animation event their game took, `meleeattackStart` among others.
60
+ */
61
+ playerAttack: [player: Player, event: string];
62
+
58
63
  /**
59
64
  * Dispatched when a player's game sets off an explosion: a grenade, a mine, a missile, an explosive round, or one an NPC it simulates set off (`npc`, its network ID). `explosion` is the BGSExplosion form ID. Return `false` to refuse it: nobody else sees it and its blast lands on no one.
60
65
  */
@@ -165,6 +170,156 @@ declare global {
165
170
  */
166
171
  playerValueChange: [player: Player, value: string, base: number, previous: number];
167
172
 
173
+ /**
174
+ * Dispatched when a player's game is about to fast travel: a marker picked on the Pip-Boy map, or the game's own scripts. `destination` is the reference they would arrive at, a map marker's form ID. Their game waits for the answer. Return `false` to refuse it: they stay where they are. Otherwise they travel.
175
+ */
176
+ playerFastTravel: [player: Player, destination: number];
177
+
178
+ /**
179
+ * Dispatched when a player's game moves them into another named location (a BGSLocation form ID), or out into the open (null). `previous` is null for the first one they report after joining.
180
+ */
181
+ playerLocationChange: [player: Player, location: number | null, previous: number | null];
182
+
183
+ /**
184
+ * Dispatched when a player drops their own marker on the Pip-Boy map, or removes it (`position` null). Return `false` to refuse it: their game puts back what they had.
185
+ */
186
+ playerMapWaypoint: [player: Player, position: Vector3 | null];
187
+
188
+ /**
189
+ * Dispatched when a player hacks a terminal: the password was found. `terminal` is the terminal reference's form ID. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
190
+ */
191
+ playerTerminalHack: [player: Player, terminal: number | null];
192
+
193
+ /**
194
+ * Dispatched when a player picks a lock in the lockpicking minigame. `lockChange` follows with the reference. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
195
+ */
196
+ playerLockPick: [player: Player];
197
+
198
+ /**
199
+ * Dispatched when a player makes something at a workbench: cooking, chemistry, or a weapon or armor mod. `workbench` is the bench's base furniture, `recipe` the constructible object used, `item` what it makes and `count` how many, as the recipe says. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
200
+ */
201
+ playerCraft: [player: Player, workbench: number | null, recipe: number | null, item: number | null, count: number];
202
+
203
+ /**
204
+ * Dispatched when a player takes something from a container. `container` is the container reference's form ID. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
205
+ */
206
+ playerContainerLoot: [player: Player, container: number | null];
207
+
208
+ /**
209
+ * Dispatched when a player reads a book or magazine, the TESObjectBOOK form ID. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
210
+ */
211
+ playerBookRead: [player: Player, book: number | null];
212
+
213
+ /**
214
+ * Dispatched when a player takes an item by pickpocketing. `victim` is the actor robbed. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
215
+ */
216
+ playerPickpocket: [player: Player, victim: number | null, success: boolean];
217
+
218
+ /**
219
+ * Dispatched when a player disarms a mine. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
220
+ */
221
+ playerMineDisarm: [player: Player];
222
+
223
+ /**
224
+ * Dispatched when a player passes a speech challenge in a dialogue. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
225
+ */
226
+ playerSpeechChallenge: [player: Player];
227
+
228
+ /**
229
+ * Dispatched when a player's game counts a theft: items taken that belong to someone else. `count` is how many. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
230
+ */
231
+ playerSteal: [player: Player, count: number];
232
+
233
+ /**
234
+ * Dispatched when a player becomes addicted. `item` is the chem or drink that did it. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
235
+ */
236
+ playerAddicted: [player: Player, item: number | null];
237
+
238
+ /**
239
+ * Dispatched when a player is caught trespassing by the game's own crime system. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
240
+ */
241
+ playerTrespass: [player: Player];
242
+
243
+ /**
244
+ * Dispatched when the game's crime system records an assault by a player on one of its NPCs. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
245
+ */
246
+ playerAssault: [player: Player];
247
+
248
+ /**
249
+ * Dispatched when the game's crime system records a murder by a player. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
250
+ */
251
+ playerMurder: [player: Player];
252
+
253
+ /**
254
+ * Dispatched when the game marks the location a player is in as cleared; `Player.getLocation` names it. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
255
+ */
256
+ playerLocationCleared: [player: Player];
257
+
258
+ /**
259
+ * Dispatched when a player lands a sneak attack (`critical` false) or a critical hit (true) on an actor, as their HUD says it. `weapon` is the weapon's form ID, null for bare hands. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
260
+ */
261
+ playerCriticalHit: [player: Player, weapon: number | null, critical: boolean];
262
+
263
+ /**
264
+ * Dispatched when a player discovers a location by coming up to it. `marker` is the map marker reference, the one `Player.discoverLocations` takes; what a script reveals that way is not reported. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
265
+ */
266
+ playerLocationDiscover: [player: Player, marker: number | null];
267
+
268
+ /**
269
+ * Dispatched when a fusion core runs out in a player's game: their power armor's, or the last shot of one they fired. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
270
+ */
271
+ playerFusionCoreConsume: [player: Player];
272
+
273
+ /**
274
+ * Dispatched when a fusion core is ejected from power armor in a player's game. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
275
+ */
276
+ playerFusionCoreEject: [player: Player];
277
+
278
+ /**
279
+ * Dispatched when junk enters a player's inventory, picked up or given, with the count their game adds to its junk collected stat. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
280
+ */
281
+ playerJunkFound: [player: Player, count: number];
282
+
283
+ /**
284
+ * Dispatched when a player's holotape starts, pauses, resumes or stops: `holotape` is the tape's form ID and `playing` whether it runs now. A tape that plays a recording; one that opens a terminal or a game is not reported. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
285
+ */
286
+ playerHolotape: [player: Player, holotape: number | null, playing: boolean];
287
+
288
+ /**
289
+ * Dispatched when a player kills a sleeping actor with the Mister Sandman kill. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
290
+ */
291
+ playerSandmanKill: [player: Player];
292
+
293
+ /**
294
+ * Dispatched when a player feeds on a corpse, as the Cannibal perk lets them. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
295
+ */
296
+ playerCorpseEat: [player: Player];
297
+
298
+ /**
299
+ * Dispatched when a player invests caps in one of the game's vendors. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
300
+ */
301
+ playerInvest: [player: Player];
302
+
303
+ /**
304
+ * Dispatched when a shot at a player bounces back and kills the shooter, the Ricochet perk's doing. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
305
+ */
306
+ playerRicochet: [player: Player];
307
+
308
+ /**
309
+ * Dispatched when the Mysterious Stranger turns up for a player in VATS. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
310
+ */
311
+ playerMysteriousStranger: [player: Player];
312
+
313
+ /**
314
+ * Dispatched when a player knocks the weapon out of an actor's hands. `target` is the actor disarmed. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
315
+ */
316
+ playerDisarm: [player: Player, target: number | null];
317
+
318
+ /**
319
+ * Dispatched when a player collects a bobblehead. Reported by the player's game after the fact: it cannot be refused, and the form IDs are the client's word.
320
+ */
321
+ playerBobblehead: [player: Player];
322
+
168
323
  /**
169
324
  * Dispatched once a player's mine settles and is armed. Return `false` to refuse: it leaves the world unexploded.
170
325
  */
@@ -220,6 +375,16 @@ declare global {
220
375
  */
221
376
  workshopMove: [player: Player, item: WorkshopItem, position: Vector3, angle: Vector3];
222
377
 
378
+ /**
379
+ * Dispatched when a player enters workshop mode at a workbench, the workbench reference's form ID.
380
+ */
381
+ workshopEnter: [player: Player, workbench: number];
382
+
383
+ /**
384
+ * Dispatched when a player leaves workshop mode, or enters it at another workbench.
385
+ */
386
+ workshopLeave: [player: Player, workbench: number];
387
+
223
388
  /**
224
389
  * Dispatched when a player scraps or stores a built object, before it goes for everyone. Return `false` to refuse: the object is put back for everyone, as a new `WorkshopItem`, and the old handle reads nothing. The player keeps what their game gave them for it.
225
390
  */
@@ -246,34 +411,28 @@ declare global {
246
411
  consoleCommand: [command: string, args: string[]];
247
412
 
248
413
  /**
249
- * 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.
414
+ * Dispatched when a player starts speaking, as isPlayerTalking turns true.
250
415
  */
251
- playerConnecting: [connection: PendingConnection];
252
- }
253
-
254
- /** Names of native events available in this scripting environment. */
255
- type EventName = keyof EventMap;
416
+ playerVoiceStart: [player: Player];
256
417
 
257
- /**
258
- * The game this server runs, and the systems only some games have.
259
- */
260
- const Game: {
261
418
  /**
262
- * The game, as server.json's `mod.game` names it.
419
+ * Dispatched shortly after a player's last voice frame, as isPlayerTalking turns false. A player who disconnects while talking gets no stop, so clear them on disconnect too.
263
420
  */
264
- readonly id: "fo4" | "fo76";
421
+ playerVoiceStop: [player: Player];
265
422
 
266
423
  /**
267
- * The game's display name: "Fallout 4" or "Fallout 76".
424
+ * Dispatched when a player switches voice tier themselves: 0 whisper, 1 normal, 2 shout. setPlayerTier does not raise it.
268
425
  */
269
- readonly name: string;
426
+ playerVoiceTierChange: [player: Player, tier: number];
270
427
 
271
428
  /**
272
- * Whether this game has the system. Settlements, companions, the perk chart and the SPECIAL creation menu are Fallout 4's; C.A.M.P., perk cards, teams and mutations are Fallout 76's. Every other binding exists on both.
273
- * @param feature A system only some games have.
429
+ * 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.
274
430
  */
275
- has(feature: "settlements" | "companions" | "perkChart" | "specialMenu" | "camp" | "perkCards" | "teams" | "mutations"): boolean;
276
- };
431
+ playerConnecting: [connection: PendingConnection];
432
+ }
433
+
434
+ /** Names of native events available in this scripting environment. */
435
+ type EventName = keyof EventMap;
277
436
 
278
437
  /**
279
438
  * Where a player is: the worldspace it stands in, or the interior cell, which has none.
@@ -400,6 +559,16 @@ declare global {
400
559
  */
401
560
  readonly armor: number;
402
561
 
562
+ /**
563
+ * Whether the player is knocked down, alive: in their ragdoll or getting up, after a blast or a client script's `LocalPlayer.knockDown`.
564
+ */
565
+ readonly isKnockedDown: boolean;
566
+
567
+ /**
568
+ * Whether the player is in the game's bleedout: down on the ground and alive, where a client script put them with `LocalPlayer.setBleedingOut`.
569
+ */
570
+ readonly isBleedingOut: boolean;
571
+
403
572
  /**
404
573
  * Whether the player is dead. A dead player stays down until `respawn`.
405
574
  */
@@ -654,6 +823,19 @@ declare global {
654
823
  */
655
824
  equipItem(form: number | string): boolean;
656
825
 
826
+ /**
827
+ * How long the player has neither moved nor turned their view, in seconds, as the server measures it from what their game reports: what an AFK check reads.
828
+ * @returns 0 for one who is moving or looking around, or who is gone.
829
+ */
830
+ getIdleTime(): number;
831
+
832
+ /**
833
+ * Has the player put a weapon away for good or take an armor piece off: they keep carrying it.
834
+ * @param form A weapon or armor piece the player carries.
835
+ * @returns True when sent; false when the server's record has none of it or the player is gone.
836
+ */
837
+ unequipItem(form: number | string): boolean;
838
+
657
839
  /**
658
840
  * Plays an idle animation on the player, as `Actor.PlayIdle` does; everyone around them sees it. The idle's own conditions apply, so one meant for another skeleton, a piece of furniture or a state the player is not in does nothing. Moving ends most idles; `stopIdle` ends any.
659
841
  * @param idle An idle animation from the game's data (an IDLE record): its editor ID, such as `"Salute"`, or its form ID.
@@ -860,6 +1042,55 @@ declare global {
860
1042
  */
861
1043
  removeFromAllFactions(): boolean;
862
1044
 
1045
+ /**
1046
+ * Has the player's game fast travel to a reference, through the game's own fast travel, as `Game.FastTravel` does. `playerFastTravel` is not raised: the script decided already.
1047
+ * @param destination The reference to arrive at: a map marker, or any other placed reference.
1048
+ * @returns True when sent; false when the player is gone.
1049
+ */
1050
+ fastTravel(destination: number | string): boolean;
1051
+
1052
+ /**
1053
+ * The named location the player is in, a BGSLocation form ID, as their game last reported it.
1054
+ * @returns Null in the open, before their first report, or when the player is gone.
1055
+ */
1056
+ getLocation(): number | null;
1057
+
1058
+ /**
1059
+ * Where the player's own map marker is: the waypoint they dropped on the Pip-Boy map, or the one a script set.
1060
+ * @returns The position, in the space they stood in; null while they have none or when the player is gone.
1061
+ */
1062
+ getMapWaypoint(): Vector3 | null;
1063
+
1064
+ /**
1065
+ * Places the player's own map marker, which their compass and Pip-Boy map show, or takes it off. `playerMapWaypoint` is not raised: the script decided already.
1066
+ * @param position Where to, in the space the player stands in; null takes it off.
1067
+ * @returns True when sent; false when the player is gone.
1068
+ */
1069
+ setMapWaypoint(position: Vector3 | null): boolean;
1070
+
1071
+ /**
1072
+ * Puts map markers on the player's map, as `ObjectReference.AddToMap` does, without its notice. The map is their game's own: the server keeps no copy, so send it again when they join.
1073
+ * @param markers Map marker references, each a form ID as a number or hex string; up to 4096.
1074
+ * @param canTravel Also fast travel destinations (default true); false shows them on the map only.
1075
+ * @returns True when sent; false when the player is gone.
1076
+ */
1077
+ discoverLocations(markers: (number | string)[], canTravel?: boolean): boolean;
1078
+
1079
+ /**
1080
+ * Takes map markers off the player's map; they stop being fast travel destinations.
1081
+ * @param markers Map marker references, each a form ID as a number or hex string; up to 4096.
1082
+ * @returns True when sent; false when the player is gone.
1083
+ */
1084
+ forgetLocations(markers: (number | string)[]): boolean;
1085
+
1086
+ /**
1087
+ * Changes one of the game's own tuning values (a game setting, GMST) in the player's game, where it takes effect at once and lasts until they leave. The server keeps no copy: to make it a rule, set it for each player as they join. A name their game has not, or a value of the wrong kind, changes nothing there.
1088
+ * @param name The setting's name as the game's data defines it: "fJumpHeightMin", "fSprintSpeedMult".
1089
+ * @param value The new value, of the setting's kind: a boolean for a b setting, a number for the others.
1090
+ * @returns True when sent; false when the player is gone.
1091
+ */
1092
+ setGameSetting(name: string, value: number | boolean): boolean;
1093
+
863
1094
  /**
864
1095
  * Every connected player.
865
1096
  * @returns One handle per player, in no particular order.
@@ -938,6 +1169,20 @@ declare global {
938
1169
  */
939
1170
  isLocked(ref: number | string): boolean | null;
940
1171
 
1172
+ /**
1173
+ * Whether a script blocked activating a reference.
1174
+ * @param ref The placed reference's form ID.
1175
+ * @returns Null when no script decided this session: the game's own state stands, which blocks a settlement's workbench until its quest gives it to the player.
1176
+ */
1177
+ isActivationBlocked(ref: number | string): boolean | null;
1178
+
1179
+ /**
1180
+ * Blocks or allows activating a reference for everyone, players who join later included. Allowing a settlement's workbench lets players enter its build mode.
1181
+ * @param ref The placed reference's form ID.
1182
+ * @param blocked Blocked or allowed.
1183
+ */
1184
+ setActivationBlocked(ref: number | string, blocked: boolean): void;
1185
+
941
1186
  /**
942
1187
  * Opens or closes a door for everyone, players who join later included.
943
1188
  * @param ref The placed reference's form ID.
@@ -1140,6 +1385,70 @@ declare global {
1140
1385
  clearReaction(faction: number | string, other: number | string, mutual?: boolean): boolean;
1141
1386
  };
1142
1387
 
1388
+ /**
1389
+ * The game's own quests, given to players as scripts decide. A player's game lists the quests they have in the Pip-Boy, and tracks the active ones on the HUD with the data files' quest name and objective texts. There is no quest logic here: scripts decide which quest a player has, which objectives they see, and when each is done. A player's quests go when they disconnect.
1390
+ */
1391
+ const Quests: {
1392
+ /**
1393
+ * Gives the player the quest, with no objectives and not active. Nothing changes when they have it already.
1394
+ * @param player A connected player.
1395
+ * @param quest The quest's form ID (QUST) in the game's data files.
1396
+ * @returns False when the player is gone.
1397
+ */
1398
+ show(player: Player, quest: number): boolean;
1399
+
1400
+ /**
1401
+ * Takes the quest and its objectives off the player.
1402
+ * @param player A connected player.
1403
+ * @param quest The quest's form ID (QUST) in the game's data files.
1404
+ * @returns False when they did not have it.
1405
+ */
1406
+ hide(player: Player, quest: number): boolean;
1407
+
1408
+ /**
1409
+ * Tracks the quest on the player's HUD, or stops tracking it.
1410
+ * @param player A connected player.
1411
+ * @param quest The quest's form ID (QUST) in the game's data files.
1412
+ * @param active Whether the HUD tracks it.
1413
+ * @returns False when they do not have the quest.
1414
+ */
1415
+ setActive(player: Player, quest: number, active: boolean): boolean;
1416
+
1417
+ /**
1418
+ * Sets one of the quest's objectives for the player. A quest holds 32 objectives at most.
1419
+ * @param player A connected player.
1420
+ * @param quest The quest's form ID (QUST) in the game's data files.
1421
+ * @param index The objective's index in the quest (its QOBJ value, as the data files give it).
1422
+ * @param state 'displayed' shows it on the HUD tracker; 'completed' and 'failed' mark it in the Pip-Boy; 'hidden' takes it off.
1423
+ * @returns False when they do not have the quest, or it holds 32 objectives already.
1424
+ */
1425
+ setObjective(player: Player, quest: number, index: number, state: 'hidden' | 'displayed' | 'completed' | 'failed'): boolean;
1426
+
1427
+ /**
1428
+ * The quests the player has, by form ID.
1429
+ * @param player A connected player.
1430
+ * @returns Empty when they have none.
1431
+ */
1432
+ getShown(player: Player): number[];
1433
+
1434
+ /**
1435
+ * Whether the player's HUD tracks the quest.
1436
+ * @param player A connected player.
1437
+ * @param quest The quest's form ID (QUST) in the game's data files.
1438
+ * @returns Null when they do not have it.
1439
+ */
1440
+ isActive(player: Player, quest: number): boolean | null;
1441
+
1442
+ /**
1443
+ * The state of one of the quest's objectives for the player.
1444
+ * @param player A connected player.
1445
+ * @param quest The quest's form ID (QUST) in the game's data files.
1446
+ * @param index The objective's index in the quest (its QOBJ value, as the data files give it).
1447
+ * @returns Null when they do not have the quest.
1448
+ */
1449
+ getObjective(player: Player, quest: number, index: number): 'hidden' | 'displayed' | 'completed' | 'failed' | null;
1450
+ };
1451
+
1143
1452
  /**
1144
1453
  * An armed mine a player laid. Its owner's game holds the mine and sets it off; the server decides when. Once it goes off or is removed the handle reads nothing. Mines go with their owner when they leave.
1145
1454
  */
@@ -1303,6 +1612,16 @@ declare global {
1303
1612
  */
1304
1613
  readonly form: number;
1305
1614
 
1615
+ /**
1616
+ * The editor ID of its TESNPC record, such as "EncRaider01"; empty when the record has none. The game's display names are localized in each player's own files, so the server has none to give.
1617
+ */
1618
+ readonly editorId: string;
1619
+
1620
+ /**
1621
+ * The level its TESNPC record gives it. A record that scales with the player's level has none of its own: the lowest level it can have is given.
1622
+ */
1623
+ readonly level: number;
1624
+
1306
1625
  /**
1307
1626
  * Current health, as its simulator last measured it. 0 until a client has run it: the server cannot work it out from the records.
1308
1627
  */
@@ -2306,31 +2625,31 @@ declare global {
2306
2625
  /**
2307
2626
  * Broadcasts a named event to every connected client's shared Events handlers.
2308
2627
  * @param eventName Client shared-event name.
2309
- * @param payload Optional string payload sent verbatim; other values are JSON-serialized.
2628
+ * @param payload Optional payload. A string is sent as is and must already be JSON text: each client parses it and drops an event that does not parse. Other values are JSON-serialized.
2310
2629
  */
2311
2630
  emitAllClients(eventName: string, payload?: unknown): void;
2312
2631
 
2313
2632
  /**
2314
2633
  * Registers a persistent server handler for events originating from clients; this namespace is isolated from native events.
2315
2634
  * @param eventName Case-sensitive event name.
2316
- * @param handler Resource-owned callback invoked with the emitted arguments.
2635
+ * @param handler Resource-owned callback invoked with the sending player and the parsed payload, which is absent when the client sent none. The payload is untrusted.
2317
2636
  * @returns Function that removes this exact subscription.
2318
2637
  */
2319
- onClient(eventName: string, handler: EventHandler): Unsubscribe;
2638
+ onClient(eventName: string, handler: (player: Player, payload?: unknown) => unknown | Promise<unknown>): Unsubscribe;
2320
2639
 
2321
2640
  /**
2322
2641
  * Registers a one-shot server handler for a client-originated event.
2323
2642
  * @param eventName Case-sensitive event name.
2324
- * @param handler Resource-owned callback invoked with the emitted arguments.
2643
+ * @param handler Resource-owned callback invoked with the sending player and the parsed payload, which is absent when the client sent none. The payload is untrusted.
2325
2644
  */
2326
- onceClient(eventName: string, handler: EventHandler): void;
2645
+ onceClient(eventName: string, handler: (player: Player, payload?: unknown) => unknown | Promise<unknown>): void;
2327
2646
 
2328
2647
  /**
2329
2648
  * Removes a matching client-originated event handler owned by the calling resource.
2330
2649
  * @param eventName Case-sensitive event name.
2331
- * @param handler Resource-owned callback invoked with the emitted arguments.
2650
+ * @param handler Resource-owned callback invoked with the sending player and the parsed payload, which is absent when the client sent none. The payload is untrusted.
2332
2651
  */
2333
- offClient(eventName: string, handler: EventHandler): void;
2652
+ offClient(eventName: string, handler: (player: Player, payload?: unknown) => unknown | Promise<unknown>): void;
2334
2653
  }
2335
2654
 
2336
2655
  /**
@@ -2621,6 +2940,11 @@ declare global {
2621
2940
  */
2622
2941
  readonly discordId: string;
2623
2942
 
2943
+ /**
2944
+ * Discord username the client reported, or an empty string when it had none.
2945
+ */
2946
+ readonly discordName: string;
2947
+
2624
2948
  /**
2625
2949
  * Framework hardware identifier the client reported, or an empty string when it had none.
2626
2950
  */
@@ -2791,6 +3115,11 @@ declare global {
2791
3115
  */
2792
3116
  readonly discordId: string;
2793
3117
 
3118
+ /**
3119
+ * Discord username the client reported, not verified by the server, or an empty string when unavailable.
3120
+ */
3121
+ readonly discordName: string;
3122
+
2794
3123
  /**
2795
3124
  * Framework hardware identifier, or an empty string when unavailable.
2796
3125
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@falloutmp/types",
3
- "version": "0.2.5",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript declarations for the Fallout Multiplayer scripting API: @falloutmp/types/server and @falloutmp/types/client",
5
5
  "license": "UNLICENSED",
6
6
  "exports": {