@falloutmp/types 0.2.5 → 0.3.2

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.
@@ -46,15 +46,25 @@ declare global {
46
46
  playerAppearanceChange: [player: Player];
47
47
 
48
48
  /**
49
- * Dispatched when a player's game lands a hit on another player, before the victim takes it. Return `false` to drop the hit. `damage` is the attacker's game's own. `kind` is a shot or a blow, an explosion's blast, or a hazard the attacker left (a radiation or gas cloud), which casts its spell and carries no damage figure.
49
+ * Dispatched when a player's game lands a hit on another player, before the victim takes it. Return `false` to drop the hit. `damage` is the attacker's game's own. `kind` is a shot or a blow, an explosion's blast, a hazard the attacker left (a radiation or gas cloud), which casts its spell and carries no damage figure, or a shot of a VATS attack, whose hit the attacker's game rolled against the chance it showed: refusing one decides VATS hits on the server (their chances are the game's fVATS* settings, `setGameSetting`). `vatsChance` is the chance the attacker's VATS showed for the shot, 0 to 1, and 0 for any other kind; with `setVatsRolledByServer` every such shot strikes on the attacker's screen, and the handler rolls it, as `Math.random() < vatsChance`.
50
50
  */
51
- playerHit: [attacker: Player, victim: Player, damage: number, kind: "direct" | "blast" | "hazard"];
51
+ playerHit: [attacker: Player, victim: Player, damage: number, kind: "direct" | "blast" | "hazard" | "vats", vatsChance: number];
52
+
53
+ /**
54
+ * Dispatched when a player activates another player's body, the Activate button on them: where a trade, a search, a handover or any player-to-player interaction starts. The two stand within reach in the same space.
55
+ */
56
+ playerActivatePlayer: [player: Player, target: Player];
52
57
 
53
58
  /**
54
59
  * Dispatched when a player starts a reload, before it is shown to the players around them. `event` is the animation event their game played.
55
60
  */
56
61
  playerReload: [player: Player, event: string];
57
62
 
63
+ /**
64
+ * 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.
65
+ */
66
+ playerAttack: [player: Player, event: string];
67
+
58
68
  /**
59
69
  * 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
70
  */
@@ -90,6 +100,21 @@ declare global {
90
100
  */
91
101
  worldHourChange: [hour: number];
92
102
 
103
+ /**
104
+ * Dispatched when the server strikes lightning on its own, for a thundery weather a sky is held to: the World's, or one a player was given. `World.strikeLightning` does not raise it.
105
+ */
106
+ worldLightning: [weather: number];
107
+
108
+ /**
109
+ * Dispatched when a player's game finds them under another weather region, as they change cell: `region` is the TESRegion form ID, 0 for none. Its weathers come from `World.getRegionWeathers`.
110
+ */
111
+ playerWeatherRegionChange: [player: Player, region: number, previous: number];
112
+
113
+ /**
114
+ * Dispatched when the running clock passes midnight into a new day, with the new date and day count. `World.setDate` and `World.setDaysPassed` do not raise it.
115
+ */
116
+ worldDayChange: [date: WorldDate, daysPassed: number];
117
+
93
118
  /**
94
119
  * Dispatched when a player opens or closes a door. Return `false` to refuse: their door swings back.
95
120
  */
@@ -165,6 +190,166 @@ declare global {
165
190
  */
166
191
  playerValueChange: [player: Player, value: string, base: number, previous: number];
167
192
 
193
+ /**
194
+ * Dispatched when a player comes into a zone `Zone.create` made, or is in it when it is made.
195
+ */
196
+ zoneEnter: [player: Player, zone: number, name: string];
197
+
198
+ /**
199
+ * Dispatched when a player goes out of a zone, or the zone is removed around them. A player who leaves the server is not told.
200
+ */
201
+ zoneLeave: [player: Player, zone: number, name: string];
202
+
203
+ /**
204
+ * 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.
205
+ */
206
+ playerFastTravel: [player: Player, destination: number];
207
+
208
+ /**
209
+ * 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.
210
+ */
211
+ playerLocationChange: [player: Player, location: number | null, previous: number | null];
212
+
213
+ /**
214
+ * 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.
215
+ */
216
+ playerMapWaypoint: [player: Player, position: Vector3 | null];
217
+
218
+ /**
219
+ * 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.
220
+ */
221
+ playerTerminalHack: [player: Player, terminal: number | null];
222
+
223
+ /**
224
+ * 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.
225
+ */
226
+ playerLockPick: [player: Player];
227
+
228
+ /**
229
+ * 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.
230
+ */
231
+ playerCraft: [player: Player, workbench: number | null, recipe: number | null, item: number | null, count: number];
232
+
233
+ /**
234
+ * 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.
235
+ */
236
+ playerContainerLoot: [player: Player, container: number | null];
237
+
238
+ /**
239
+ * 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.
240
+ */
241
+ playerBookRead: [player: Player, book: number | null];
242
+
243
+ /**
244
+ * 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.
245
+ */
246
+ playerPickpocket: [player: Player, victim: number | null, success: boolean];
247
+
248
+ /**
249
+ * 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.
250
+ */
251
+ playerMineDisarm: [player: Player];
252
+
253
+ /**
254
+ * 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.
255
+ */
256
+ playerSpeechChallenge: [player: Player];
257
+
258
+ /**
259
+ * 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.
260
+ */
261
+ playerSteal: [player: Player, count: number];
262
+
263
+ /**
264
+ * 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.
265
+ */
266
+ playerAddicted: [player: Player, item: number | null];
267
+
268
+ /**
269
+ * 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.
270
+ */
271
+ playerTrespass: [player: Player];
272
+
273
+ /**
274
+ * 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.
275
+ */
276
+ playerAssault: [player: Player];
277
+
278
+ /**
279
+ * 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.
280
+ */
281
+ playerMurder: [player: Player];
282
+
283
+ /**
284
+ * 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.
285
+ */
286
+ playerLocationCleared: [player: Player];
287
+
288
+ /**
289
+ * 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.
290
+ */
291
+ playerCriticalHit: [player: Player, weapon: number | null, critical: boolean];
292
+
293
+ /**
294
+ * 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.
295
+ */
296
+ playerLocationDiscover: [player: Player, marker: number | null];
297
+
298
+ /**
299
+ * 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.
300
+ */
301
+ playerFusionCoreConsume: [player: Player];
302
+
303
+ /**
304
+ * 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.
305
+ */
306
+ playerFusionCoreEject: [player: Player];
307
+
308
+ /**
309
+ * 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.
310
+ */
311
+ playerJunkFound: [player: Player, count: number];
312
+
313
+ /**
314
+ * 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.
315
+ */
316
+ playerHolotape: [player: Player, holotape: number | null, playing: boolean];
317
+
318
+ /**
319
+ * 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.
320
+ */
321
+ playerSandmanKill: [player: Player];
322
+
323
+ /**
324
+ * 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.
325
+ */
326
+ playerCorpseEat: [player: Player];
327
+
328
+ /**
329
+ * 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.
330
+ */
331
+ playerInvest: [player: Player];
332
+
333
+ /**
334
+ * 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.
335
+ */
336
+ playerRicochet: [player: Player];
337
+
338
+ /**
339
+ * 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.
340
+ */
341
+ playerMysteriousStranger: [player: Player];
342
+
343
+ /**
344
+ * 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.
345
+ */
346
+ playerDisarm: [player: Player, target: number | null];
347
+
348
+ /**
349
+ * 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.
350
+ */
351
+ playerBobblehead: [player: Player];
352
+
168
353
  /**
169
354
  * Dispatched once a player's mine settles and is armed. Return `false` to refuse: it leaves the world unexploded.
170
355
  */
@@ -181,9 +366,9 @@ declare global {
181
366
  mineRemove: [mine: Mine];
182
367
 
183
368
  /**
184
- * Dispatched when a player's game lands a hit on an NPC, before the NPC takes it. Return `false` to drop the hit. `damage` is the attacker's game's own; `kind` is a shot or a blow, or an explosion's blast.
369
+ * Dispatched when a player's game lands a hit on an NPC, before the NPC takes it. Return `false` to drop the hit, except on an NPC the attacker's own game runs (`getSimulator`), which took it already: that one is told so scripts learn who hit it, and the attacker is still the killer `npcDeath` names. `damage` is the attacker's game's own; `kind` is a shot or a blow, an explosion's blast, or a shot of a VATS attack, whose hit the attacker's game rolled against the chance it showed: refusing one decides VATS hits on the server. `vatsChance` is the chance the attacker's VATS showed, 0 to 1, and 0 for any other kind, as for `playerHit`.
185
370
  */
186
- npcHit: [attacker: Player, npc: Npc, damage: number, kind: "direct" | "blast"];
371
+ npcHit: [attacker: Player, npc: Npc, damage: number, kind: "direct" | "blast" | "vats", vatsChance: number];
187
372
 
188
373
  /**
189
374
  * Dispatched when an NPC lands a hit on a player, before the victim takes it. Return `false` to drop the hit. `damage` is the game's own, from the client that runs the NPC.
@@ -195,6 +380,21 @@ declare global {
195
380
  */
196
381
  npcDeath: [npc: Npc, killer: Player | null];
197
382
 
383
+ /**
384
+ * Dispatched when a player activates an NPC, the Activate button on its body: what a shopkeeper, a quest giver or any interaction starts from. Raised whether or not `setActivationBlocked` stops the game's own greeting and dialogue.
385
+ */
386
+ npcActivate: [player: Player, npc: Npc];
387
+
388
+ /**
389
+ * Dispatched when the player or NPC an NPC fights changes, as the game that runs it decides: it noticed an enemy, switched to another, or stopped fighting (`target` null, also on its death). Where aggro, bounties and wanted levels start.
390
+ */
391
+ npcTarget: [npc: Npc, target: Player | Npc | null];
392
+
393
+ /**
394
+ * Dispatched once when an NPC reaches where `goTo` sent it; it then stands there until `stopGoing` or the next `goTo`. Sent after a body, it is raised again each time it catches up after the body walked off.
395
+ */
396
+ npcArrive: [npc: Npc];
397
+
198
398
  /**
199
399
  * Dispatched when an NPC is back at its placement, whole: on its own after its death, or from `respawn`.
200
400
  */
@@ -220,6 +420,16 @@ declare global {
220
420
  */
221
421
  workshopMove: [player: Player, item: WorkshopItem, position: Vector3, angle: Vector3];
222
422
 
423
+ /**
424
+ * Dispatched when a player enters workshop mode at a workbench, the workbench reference's form ID.
425
+ */
426
+ workshopEnter: [player: Player, workbench: number];
427
+
428
+ /**
429
+ * Dispatched when a player leaves workshop mode, or enters it at another workbench.
430
+ */
431
+ workshopLeave: [player: Player, workbench: number];
432
+
223
433
  /**
224
434
  * 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
435
  */
@@ -246,34 +456,28 @@ declare global {
246
456
  consoleCommand: [command: string, args: string[]];
247
457
 
248
458
  /**
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.
459
+ * Dispatched when a player starts speaking, as isPlayerTalking turns true.
250
460
  */
251
- playerConnecting: [connection: PendingConnection];
252
- }
253
-
254
- /** Names of native events available in this scripting environment. */
255
- type EventName = keyof EventMap;
461
+ playerVoiceStart: [player: Player];
256
462
 
257
- /**
258
- * The game this server runs, and the systems only some games have.
259
- */
260
- const Game: {
261
463
  /**
262
- * The game, as server.json's `mod.game` names it.
464
+ * 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
465
  */
264
- readonly id: "fo4" | "fo76";
466
+ playerVoiceStop: [player: Player];
265
467
 
266
468
  /**
267
- * The game's display name: "Fallout 4" or "Fallout 76".
469
+ * Dispatched when a player switches voice tier themselves: 0 whisper, 1 normal, 2 shout. setPlayerTier does not raise it.
268
470
  */
269
- readonly name: string;
471
+ playerVoiceTierChange: [player: Player, tier: number];
270
472
 
271
473
  /**
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.
474
+ * 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
475
  */
275
- has(feature: "settlements" | "companions" | "perkChart" | "specialMenu" | "camp" | "perkCards" | "teams" | "mutations"): boolean;
276
- };
476
+ playerConnecting: [connection: PendingConnection];
477
+ }
478
+
479
+ /** Names of native events available in this scripting environment. */
480
+ type EventName = keyof EventMap;
277
481
 
278
482
  /**
279
483
  * Where a player is: the worldspace it stands in, or the interior cell, which has none.
@@ -400,6 +604,21 @@ declare global {
400
604
  */
401
605
  readonly armor: number;
402
606
 
607
+ /**
608
+ * Whether `setInvulnerable` made the player unhurtable.
609
+ */
610
+ readonly isInvulnerable: boolean;
611
+
612
+ /**
613
+ * Whether the player is knocked down, alive: in their ragdoll or getting up, after a blast or a client script's `LocalPlayer.knockDown`.
614
+ */
615
+ readonly isKnockedDown: boolean;
616
+
617
+ /**
618
+ * Whether the player is in the game's bleedout: down on the ground and alive, where a client script put them with `LocalPlayer.setBleedingOut`.
619
+ */
620
+ readonly isBleedingOut: boolean;
621
+
403
622
  /**
404
623
  * Whether the player is dead. A dead player stays down until `respawn`.
405
624
  */
@@ -520,6 +739,34 @@ declare global {
520
739
  */
521
740
  fire(shots?: number): boolean;
522
741
 
742
+ /**
743
+ * Holds the player's weapon out or away, as FiveM's SetCurrentPedWeapon forces a ped's: their game draws or holsters it at once and keeps it so against their own ready-weapon key and the game's. Away for a safe zone, out for a scripted scene. With no weapon in hand, out raises their fists. To stop attacks too, a client script turns off `Controls` "fighting".
744
+ * @param drawn True to hold their weapon out, false to keep it away, null to hand it back to them.
745
+ * @returns True when sent; false when the player is gone.
746
+ */
747
+ setWeaponDrawn(drawn: boolean | null): boolean;
748
+
749
+ /**
750
+ * Loads rounds into the player's weapon, as FiveM's SetAmmoInClip does a ped's. The rounds come from those they carry, as a reload takes them: never more than they have, so `giveItem` the ammo first. Their game ignores it without a weapon that loads ammo in hand.
751
+ * @param rounds The rounds to load, 0 to 100000; more than the weapon's clip loads a full clip.
752
+ * @returns True when sent; false when the player is gone.
753
+ */
754
+ setClipAmmo(rounds: number): boolean;
755
+
756
+ /**
757
+ * Takes the player's collision away or gives it back, as FiveM's SetEntityCollision does a ped and the console's tcl the player: without it they move along where they look, through walls and floors, without gravity. An admin's noclip on foot; everyone else sees their body pass through. It ends with their session.
758
+ * @param enabled False to take their collision away, true to give it back.
759
+ * @returns True when sent; false when the player is gone.
760
+ */
761
+ setCollision(enabled: boolean): boolean;
762
+
763
+ /**
764
+ * Rebuilds the player on another race, as the console's setrace and Actor.SetRace do: a ghoul. Their skin and body become the race's, their head parts stay their own, and every other player sees their puppet rebuilt the same way. Only human and ghoul are supported; any other race is refused. The race they had comes back with null, and when their session ends.
765
+ * @param race 0x13746 (HumanRace) or 0xEAFB6 (GhoulRace); null for the race they had.
766
+ * @returns True when sent; false when the player is gone.
767
+ */
768
+ setRace(race: number | string | null): boolean;
769
+
523
770
  /**
524
771
  * Places a power armor frame where the player stands and puts them into it at once, as `Actor.SwitchToPowerArmor` does. `playerPowerArmor` follows. The suit's pieces are the frame's; dress them with `setOutfit`.
525
772
  * @param frame The TESFurniture of the frame to place; the game's empty frame when left out.
@@ -654,6 +901,63 @@ declare global {
654
901
  */
655
902
  equipItem(form: number | string): boolean;
656
903
 
904
+ /**
905
+ * 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.
906
+ * @returns 0 for one who is moving or looking around, or who is gone.
907
+ */
908
+ getIdleTime(): number;
909
+
910
+ /**
911
+ * Has the player put a weapon away for good or take an armor piece off: they keep carrying it.
912
+ * @param form A weapon or armor piece the player carries.
913
+ * @returns True when sent; false when the server's record has none of it or the player is gone.
914
+ */
915
+ unequipItem(form: number | string): boolean;
916
+
917
+ /**
918
+ * Makes the player unhurtable, as FiveM's SetPlayerInvincible does: their game makes them a ghost, which shots, blows and explosions pass over, and turns on the game's immortal mode, so a fall or radiation never takes their last point of health; the server drops every hit still reported on them, from players and NPCs, before `playerHit` or `npcAttack`. It lasts until undone or they leave.
919
+ * @param invulnerable True to make them unhurtable, false to make them hurtable again.
920
+ * @returns True when sent; false when the player is gone.
921
+ */
922
+ setInvulnerable(invulnerable: boolean): boolean;
923
+
924
+ /**
925
+ * Has the player's character speak, voice and subtitle, as FiveM's PlayAmbientSpeechNative does a player's ped: their own game says it, picking a topic's line among those whose conditions pass, and every other player's game hears their puppet say the same line in the player voice of their sex. Lines the character says on its own, in dialogue or in a fight, are heard the same way.
926
+ * @param line A dialogue topic (DIAL) by form ID or editor ID, such as `0x1B40FA`, the player's combat lines, or one of its lines (INFO) by form ID.
927
+ * @returns True when sent; false when the player is gone. Throws for a form no DIAL or INFO record has.
928
+ */
929
+ say(line: number | string): boolean;
930
+
931
+ /**
932
+ * Knocks the player off their feet into their ragdoll from the server, as FiveM's SetPedToRagdoll does a player's ped: their game pushes them, as `LocalPlayer.knockDown` does, they lie a moment and get up by themselves, and every other player sees them fall. A player who is down, dead, held in place or in furniture is left as they are.
933
+ * @param force How hard they are thrown, as ObjectReference.PushActorAway takes it: small numbers, 1 to 50 (600 threw an NPC 8,700 units); 0, the default, drops them where they stand.
934
+ * @param from The point they are thrown away from; where they stand by default.
935
+ * @returns True when sent; false when the player is gone.
936
+ */
937
+ knockDown(force?: number, from?: Vector3): boolean;
938
+
939
+ /**
940
+ * Scales the player in every game, as ObjectReference.SetScale does: their own game scales their character, and every other game their body. It lasts until set again or they leave.
941
+ * @param scale 1 for their normal size, from 0.01 to 10.
942
+ * @returns True when sent; false when the player is gone.
943
+ */
944
+ setScale(scale: number): boolean;
945
+
946
+ /**
947
+ * Draws the player more or less see-through for everyone, as FiveM's SetEntityAlpha and SetEntityVisible do a player's ped: their own game sets it, as `LocalPlayer.setAlpha` does, and every other game draws their body the same. At 0 no game shows their nametag either. An admin's invisibility, a spectator, a spawn's protection.
948
+ * @param alpha 0, invisible, to 1, solid.
949
+ * @param fade Fade there rather than cut (default false).
950
+ * @returns True when sent; false when the player is gone.
951
+ */
952
+ setAlpha(alpha: number, fade?: boolean): boolean;
953
+
954
+ /**
955
+ * Holds the player in place from the server, as FiveM's FreezeEntityPosition does a player's ped and Actor.SetRestrained an actor: their game keeps them standing where they are, neither moving nor acting, until let go. Cuffs, an arrest, an admin freeze, a cutscene. A player who is down or dead is left as they are.
956
+ * @param restrained True to hold them where they stand, false to let them go.
957
+ * @returns True when sent; false when the player is gone.
958
+ */
959
+ setRestrained(restrained: boolean): boolean;
960
+
657
961
  /**
658
962
  * 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
963
  * @param idle An idle animation from the game's data (an IDLE record): its editor ID, such as `"Salute"`, or its form ID.
@@ -861,96 +1165,481 @@ declare global {
861
1165
  removeFromAllFactions(): boolean;
862
1166
 
863
1167
  /**
864
- * Every connected player.
865
- * @returns One handle per player, in no particular order.
1168
+ * 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.
1169
+ * @param destination The reference to arrive at: a map marker, or any other placed reference.
1170
+ * @returns True when sent; false when the player is gone.
866
1171
  */
867
- static all(): Player[];
1172
+ fastTravel(destination: number | string): boolean;
868
1173
 
869
1174
  /**
870
- * Looks a player up by network ID.
871
- * @param id Network entity identifier.
872
- * @returns The handle, or null when no connected player has that ID.
1175
+ * The named location the player is in, a BGSLocation form ID, as their game last reported it.
1176
+ * @returns Null in the open, before their first report, or when the player is gone.
873
1177
  */
874
- static getById(id: number): Player | null;
875
- }
876
-
877
- interface Player extends BasePlayer {}
1178
+ getLocation(): number | null;
878
1179
 
879
- /**
880
- * The server's clock and weather, which every client follows.
881
- */
882
- const World: {
883
1180
  /**
884
- * The hour of the day, from 0 up to but not including 24, with the minutes as the fraction: 13.5 is half past one.
1181
+ * Where the player's own map marker is: the waypoint they dropped on the Pip-Boy map, or the one a script set.
1182
+ * @returns The position, in the space they stood in; null while they have none or when the player is gone.
885
1183
  */
886
- readonly hour: number;
1184
+ getMapWaypoint(): Vector3 | null;
887
1185
 
888
1186
  /**
889
- * Game minutes per real minute. 20 is the game's own pace; 0 holds the clock.
1187
+ * 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.
1188
+ * @param position Where to, in the space the player stands in; null takes it off.
1189
+ * @returns True when sent; false when the player is gone.
890
1190
  */
891
- readonly timeScale: number;
1191
+ setMapWaypoint(position: Vector3 | null): boolean;
892
1192
 
893
1193
  /**
894
- * The TESWeather form ID every client shows.
1194
+ * 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.
1195
+ * @param markers Map marker references, each a form ID as a number or hex string; up to 4096.
1196
+ * @param canTravel Also fast travel destinations (default true); false shows them on the map only.
1197
+ * @returns True when sent; false when the player is gone.
895
1198
  */
896
- readonly weather: number;
1199
+ discoverLocations(markers: (number | string)[], canTravel?: boolean): boolean;
897
1200
 
898
1201
  /**
899
- * Whether the weather was swapped in at once rather than transitioned to.
1202
+ * Takes map markers off the player's map; they stop being fast travel destinations.
1203
+ * @param markers Map marker references, each a form ID as a number or hex string; up to 4096.
1204
+ * @returns True when sent; false when the player is gone.
900
1205
  */
901
- readonly weatherForced: boolean;
1206
+ forgetLocations(markers: (number | string)[]): boolean;
902
1207
 
903
1208
  /**
904
- * Sets the clock. Every client jumps to it.
905
- * @param hour The hour, wrapped into 0-24; 13.5 is half past one.
1209
+ * 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.
1210
+ * @param name The setting's name as the game's data defines it: "fJumpHeightMin", "fSprintSpeedMult".
1211
+ * @param value The new value, of the setting's kind: a boolean for a b setting, a number for the others.
1212
+ * @returns True when sent; false when the player is gone.
906
1213
  */
907
- setHour(hour: number): void;
1214
+ setGameSetting(name: string, value: number | boolean): boolean;
908
1215
 
909
1216
  /**
910
- * Sets how fast the clock runs.
911
- * @param scale Game minutes per real minute, 0 or more; 0 holds the clock.
1217
+ * Moves the roll of the player's VATS hits to the server. Their game rolls each queued shot against the chance it shows; while this is on, every shot with a chance above 0 strikes instead, and its hit reaches `playerHit` or `npcHit` as kind "vats" with that chance: the handler rolls it (`Math.random() < vatsChance`) and returns `false` for a miss. Lasts until they leave; set it again for each player as they join.
1218
+ * @param enabled True to roll the player's VATS hits on the server, false to leave them to their game.
1219
+ * @returns True when sent; false when the player is gone.
912
1220
  */
913
- setTimeScale(scale: number): void;
1221
+ setVatsRolledByServer(enabled: boolean): boolean;
914
1222
 
915
1223
  /**
916
- * Sets the weather every client shows. Only a client's data files can tell whether the form is a weather, so a wrong one leaves the sky as it is.
917
- * @param weather A TESWeather form ID, as a number or hex string; null for the server's default, CommonwealthClear.
1224
+ * Gives the player a sky of their own, over the one `World` holds for everyone: the weather of the worldspace they stand in, a storm over one quest, a clear sky for a cutscene. The server strikes its lightning as for the World's. Lasts until they leave: to make it a rule, set it on `playerSpaceChange`, `playerWeatherRegionChange` or as they join.
1225
+ * @param weather A TESWeather form ID for this player alone; null to follow `World.weather` again.
918
1226
  * @param force Swap it in at once rather than transition to it.
1227
+ * @returns True when sent; false when the player is gone.
919
1228
  */
920
- setWeather(weather: number | string | null, force?: boolean): void;
921
- };
1229
+ setWeather(weather: number | string | null, force?: boolean): boolean;
922
1230
 
923
- /**
924
- * Doors, locks and containers, by the form ID of their placed reference. The server knows only what changed this session; the rest is as the data files place it, which only a client loads.
925
- */
926
- const Objects: {
927
1231
  /**
928
- * Whether a door stands open.
929
- * @param ref The placed reference's form ID.
930
- * @returns Null when nobody moved it this session.
1232
+ * Holds the player's clock, and the sun and the sky with it, at an hour of their own until it is released. Their game's day count and date stay the world's. Lasts until they leave.
1233
+ * @param hour The hour to hold the player's clock at, wrapped into 0-24; null to follow `World.hour` again.
1234
+ * @returns True when sent; false when the player is gone.
931
1235
  */
932
- isDoorOpen(ref: number | string): boolean | null;
1236
+ setHour(hour: number | null): boolean;
933
1237
 
934
1238
  /**
935
- * Whether a door or container is locked.
936
- * @param ref The placed reference's form ID.
937
- * @returns Null when nobody changed its lock this session.
1239
+ * The weather `setWeather` gave the player alone.
1240
+ * @returns Null while they follow `World.weather`, or once they are gone.
938
1241
  */
939
- isLocked(ref: number | string): boolean | null;
1242
+ getWeather(): number | null;
940
1243
 
941
1244
  /**
942
- * Opens or closes a door for everyone, players who join later included.
943
- * @param ref The placed reference's form ID.
944
- * @param open Open or closed.
1245
+ * Strikes lightning in the player's sky alone: a flash and a thunderclap, if their sky is in a weather that thunders. In a session the game's own strikes come from the server (`World.setLightningEnabled`).
1246
+ * @returns True when sent; false when the player is gone.
945
1247
  */
946
- setDoorOpen(ref: number | string, open: boolean): void;
1248
+ strikeLightning(): boolean;
947
1249
 
948
1250
  /**
949
- * Locks or unlocks a door or container for everyone.
950
- * @param ref The placed reference's form ID.
951
- * @param locked Locked or not.
1251
+ * The region whose weathers the player's game would roll where they stand, as their game finds it each time they change cell: the TESRegion form ID, for `World.getRegionWeathers`.
1252
+ * @returns 0 when they stand in no region with weathers, or their game has not said yet.
952
1253
  */
953
- setLocked(ref: number | string, locked: boolean): void;
1254
+ getWeatherRegion(): number;
1255
+
1256
+ /**
1257
+ * The players around a point, a player or an NPC, nearest first, as FiveM scripts run GetActivePlayers through a distance check: who hears a shout, who stands in a zone, who is close enough to trade. Positions are the ones the players' games last reported.
1258
+ * @param center A point, or a player or an NPC, whose position and space are then the search's; a player is not counted among its own.
1259
+ * @param radius How far from it, in game units.
1260
+ * @param options `space`: where a point is, the Commonwealth when left out. `limit`: how many at most, 32 by default, never more than 512.
1261
+ * @returns Empty when nobody is in range, or the center is gone. Throws for a center that is none of these, or a negative radius.
1262
+ */
1263
+ static getInRange(center: Vector3 | Player | Npc, radius: number, options?: { space?: { worldSpace: number } | { interiorCell: number }; limit?: number }): Player[];
1264
+
1265
+ /**
1266
+ * Every connected player.
1267
+ * @returns One handle per player, in no particular order.
1268
+ */
1269
+ static all(): Player[];
1270
+
1271
+ /**
1272
+ * Looks a player up by network ID.
1273
+ * @param id Network entity identifier.
1274
+ * @returns The handle, or null when no connected player has that ID.
1275
+ */
1276
+ static getById(id: number): Player | null;
1277
+ }
1278
+
1279
+ interface Player extends BasePlayer {}
1280
+
1281
+ /**
1282
+ * A calendar date as the game keeps it: twelve months of 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30 and 31 days, no leap years.
1283
+ */
1284
+ interface WorldDate {
1285
+ /**
1286
+ * The full year, 2000 to 2999.
1287
+ */
1288
+ year: number;
1289
+
1290
+ /**
1291
+ * 1 to 12.
1292
+ */
1293
+ month: number;
1294
+
1295
+ /**
1296
+ * 1 to the month's last.
1297
+ */
1298
+ day: number;
1299
+ }
1300
+
1301
+ /**
1302
+ * A weather the game's data files define.
1303
+ */
1304
+ interface WeatherRecord {
1305
+ /**
1306
+ * The TESWeather form ID.
1307
+ */
1308
+ weather: number;
1309
+
1310
+ /**
1311
+ * Its editor ID: "CommonwealthClear", "CommonwealthRadstorm".
1312
+ */
1313
+ editorId: string;
1314
+
1315
+ /**
1316
+ * Its classification, as the game's GetIsPleasant/Cloudy/Rain/Snow conditions read it.
1317
+ */
1318
+ kind: "none" | "pleasant" | "cloudy" | "rain" | "snow";
1319
+ }
1320
+
1321
+ /**
1322
+ * One weather a climate rolls.
1323
+ */
1324
+ interface ClimateWeather {
1325
+ /**
1326
+ * The TESWeather form ID.
1327
+ */
1328
+ weather: number;
1329
+
1330
+ /**
1331
+ * Its weight among the climate's weathers, as the data files give it (they sum to 100 in the official climates).
1332
+ */
1333
+ chance: number;
1334
+ }
1335
+
1336
+ /**
1337
+ * The weathers a worldspace's sky rolls once a weather has run its course.
1338
+ */
1339
+ interface Climate {
1340
+ /**
1341
+ * The climate's editor ID.
1342
+ */
1343
+ editorId: string;
1344
+
1345
+ /**
1346
+ * Its weathers and their chances.
1347
+ */
1348
+ weathers: ClimateWeather[];
1349
+ }
1350
+
1351
+ /**
1352
+ * The server's clock, calendar and weather, which every client follows, and what the game's data files say of weathers and climates.
1353
+ */
1354
+ const World: {
1355
+ /**
1356
+ * The hour of the day, from 0 up to but not including 24, with the minutes as the fraction: 13.5 is half past one.
1357
+ */
1358
+ readonly hour: number;
1359
+
1360
+ /**
1361
+ * Game minutes per real minute. 20 is the game's own pace; 0 holds the clock.
1362
+ */
1363
+ readonly timeScale: number;
1364
+
1365
+ /**
1366
+ * The calendar date every client's game shows. It turns over at midnight as the clock runs.
1367
+ */
1368
+ readonly date: WorldDate;
1369
+
1370
+ /**
1371
+ * Whole days the clock has run, the game's GameDaysPassed: what its timers, vendors' restocks and crops count in.
1372
+ */
1373
+ readonly daysPassed: number;
1374
+
1375
+ /**
1376
+ * The TESWeather form ID every client shows.
1377
+ */
1378
+ readonly weather: number;
1379
+
1380
+ /**
1381
+ * Whether the weather was swapped in at once rather than transitioned to.
1382
+ */
1383
+ readonly weatherForced: boolean;
1384
+
1385
+ /**
1386
+ * The weather the sky is still moving away from, 0 once the move is over: up to two game hours after `setWeather`, past the game's longest transition.
1387
+ */
1388
+ readonly previousWeather: number;
1389
+
1390
+ /**
1391
+ * Whether the server strikes lightning on its own while `weather` thunders, at the pace the game would. In a session the game strikes only on the server's word, so every player sees the same strikes.
1392
+ */
1393
+ readonly lightningEnabled: boolean;
1394
+
1395
+ /**
1396
+ * Sets the clock. Every client jumps to it. The date stays as it is.
1397
+ * @param hour The hour, wrapped into 0-24; 13.5 is half past one.
1398
+ */
1399
+ setHour(hour: number): void;
1400
+
1401
+ /**
1402
+ * Sets how fast the clock runs.
1403
+ * @param scale Game minutes per real minute, 0 or more; 0 holds the clock.
1404
+ */
1405
+ setTimeScale(scale: number): void;
1406
+
1407
+ /**
1408
+ * Sets the calendar date every client's Pip-Boy shows. The hour and the day count stay as they are.
1409
+ * @param year The full year, 2000 to 2999.
1410
+ * @param month 1 to 12.
1411
+ * @param day 1 to the month's last; the calendar has no leap years.
1412
+ */
1413
+ setDate(year: number, month: number, day: number): void;
1414
+
1415
+ /**
1416
+ * Sets how many days the clock has run, which the game's timers count in. The date stays as it is.
1417
+ * @param days Whole days, 0 or more.
1418
+ */
1419
+ setDaysPassed(days: number): void;
1420
+
1421
+ /**
1422
+ * Sets the weather every client shows. A transition runs on the game clock, so every client fades at the same point, one that joins during it included. Only a client's data files can tell whether the form is a weather, so a wrong one leaves the sky as it is.
1423
+ * @param weather A TESWeather form ID, as a number or hex string; null for the server's default, CommonwealthClear.
1424
+ * @param force Swap it in at once rather than transition to it.
1425
+ */
1426
+ setWeather(weather: number | string | null, force?: boolean): void;
1427
+
1428
+ /**
1429
+ * Every weather the game's official masters define, by form ID.
1430
+ * @returns Empty when the server could not read the game's data files.
1431
+ */
1432
+ getWeathers(): WeatherRecord[];
1433
+
1434
+ /**
1435
+ * Starts or stops the server's own lightning.
1436
+ * @param enabled On, or off: no lightning but what scripts strike.
1437
+ */
1438
+ setLightningEnabled(enabled: boolean): void;
1439
+
1440
+ /**
1441
+ * Strikes lightning in every player's sky that thunders: a flash and a thunderclap, at the same moment for all.
1442
+ * @param weather Only for skies in this weather; any weather that thunders when left out.
1443
+ */
1444
+ strikeLightning(weather?: number | string): void;
1445
+
1446
+ /**
1447
+ * The weathers a region rolls, as the data files give it: the game takes them over the worldspace's climate while the player stands in the region.
1448
+ * @param region A TESRegion form ID, as `Player.getWeatherRegion` gives it.
1449
+ * @returns Null when the region has no weathers, or the form is not one.
1450
+ */
1451
+ getRegionWeathers(region: number | string): Climate | null;
1452
+
1453
+ /**
1454
+ * The climate a worldspace's sky rolls its weathers from, as the data files give it: the base a script rolls its own weather cycle on.
1455
+ * @param worldSpace A TESWorldSpace form ID.
1456
+ * @returns Null when the worldspace has none, or the form is not one.
1457
+ */
1458
+ getClimate(worldSpace: number | string): Climate | null;
1459
+ };
1460
+
1461
+ /**
1462
+ * Explosions set off in every player's game at once, as the game sets off its own: the blast, its light, sound, debris and decals, and whatever the explosion leaves behind. An explosion is named by form ID (a number or hex string) or by its editor ID in the official masters ("FragGrenadeExplosion").
1463
+ */
1464
+ const Explosion: {
1465
+ /**
1466
+ * Sets off an explosion in the game of every player in that space whose game has the spot loaded. Each game's blast hurts what that game simulates: its own player, the NPCs it runs.
1467
+ * @param explosion A BGSExplosion (EXPL) form ID: a frag grenade's, a mini nuke's, a car's.
1468
+ * @param position Where it goes off.
1469
+ * @param options `space`: the worldspace or interior cell; the owner's when an owner is given, else the Commonwealth. `scale`: of its radii, 1 by default. `damage`: a multiplier of its damage, 0 for one that hurts nobody. `owner`: who it is credited to.
1470
+ */
1471
+ spawn(explosion: number | string, position: Vector3, options?: { space?: { worldSpace?: number | string; interiorCell?: number | string }; scale?: number; damage?: number; owner?: Player | Npc }): void;
1472
+ };
1473
+
1474
+ /**
1475
+ * Effects in every player's game: placed effects that stream like any entity, effect shaders and visual effects on bodies and references, and impacts. Forms are named by form ID (a number or hex string) or by their editor ID in the official masters; an editor ID made only of hex digits reads as a form ID.
1476
+ */
1477
+ const Effect: {
1478
+ /**
1479
+ * Places an effect every player near it sees, players who come near later included: each game places its own copy while they are in range. Attached, it is a prop: a box carried, a lantern on the back, a flame over a head.
1480
+ * @param form The base object to place: a fog patch, a smoke column or a fire (the game's FX statics, movable statics and activators), a hazard (HAZD), a light (LIGH), any other placeable object.
1481
+ * @param position Where it stands; null for an attached one, which starts where its body stands.
1482
+ * @param options `angle`: its rotation in radians. `space`: the worldspace or interior cell; the body's when attached, else the Commonwealth. `lifetime`: seconds until it is removed on its own; it stays until `remove` when left out. `range`: how near players must be to have it, 8192 units by default. `attach`: holds it on a body or a placed reference every frame, on the named node ("WEAPON", "RArm_Hand", "Head"; the root when left out), shifted by `offset` and turned by `rotation` (radians) in the node's frame; everyone in the space has it. Give it something without collision, or it pushes what it touches.
1483
+ * @returns The effect's ID, for `remove`; 0 when it could not be made.
1484
+ */
1485
+ spawn(form: number | string, position: Vector3 | null, options?: { angle?: Vector3; space?: { worldSpace?: number | string; interiorCell?: number | string }; lifetime?: number; range?: number; attach?: { to: Player | Npc | number | string; node?: string; offset?: Vector3; rotation?: Vector3 } }): number;
1486
+
1487
+ /**
1488
+ * Removes a placed effect from every game.
1489
+ * @param effect An ID `spawn` gave.
1490
+ * @returns False when there is no such effect.
1491
+ */
1492
+ remove(effect: number): boolean;
1493
+
1494
+ /**
1495
+ * Moves a placed effect in every game, players who come near later included: a lift, a gate, a prop a script carries. Each call is one step; call it each tick for a glide.
1496
+ * @param effect An ID `spawn` gave.
1497
+ * @param position Where it stands now.
1498
+ * @param angle Its rotation in radians; kept when left out.
1499
+ * @returns False when there is no such effect, or it is attached.
1500
+ */
1501
+ move(effect: number, position: Vector3, angle?: Vector3): boolean;
1502
+
1503
+ /**
1504
+ * Whether a placed effect is still there: its lifetime may have run out.
1505
+ * @param effect An ID `spawn` gave.
1506
+ */
1507
+ exists(effect: number): boolean;
1508
+
1509
+ /**
1510
+ * Plays an effect shader over a body or a reference in every game where it is loaded, as EffectShader.Play does.
1511
+ * @param target A player, an NPC, or a placed reference's form ID.
1512
+ * @param shader A TESEffectShader (EFSH) form ID: a glow, a burn, a membrane.
1513
+ * @param seconds How long; until `stopShader` when left out.
1514
+ */
1515
+ playShader(target: Player | Npc | number | string, shader: number | string, seconds?: number): void;
1516
+
1517
+ /**
1518
+ * Stops an effect shader on a body or a reference.
1519
+ * @param target A player, an NPC, or a placed reference's form ID.
1520
+ * @param shader The shader played.
1521
+ */
1522
+ stopShader(target: Player | Npc | number | string, shader: number | string): void;
1523
+
1524
+ /**
1525
+ * Attaches a visual effect to a body or a reference in every game where it is loaded, as VisualEffect.Play does.
1526
+ * @param target A player, an NPC, or a placed reference's form ID.
1527
+ * @param effect A BGSReferenceEffect (RFCT) form ID: an art object's particles or model, with or without a shader.
1528
+ * @param seconds How long; until `stopVisual` when left out.
1529
+ */
1530
+ playVisual(target: Player | Npc | number | string, effect: number | string, seconds?: number): void;
1531
+
1532
+ /**
1533
+ * Takes a visual effect off a body or a reference.
1534
+ * @param target A player, an NPC, or a placed reference's form ID.
1535
+ * @param effect The visual effect played.
1536
+ */
1537
+ stopVisual(target: Player | Npc | number | string, effect: number | string): void;
1538
+
1539
+ /**
1540
+ * Plays an impact where a ray from the target lands, in every game where the target is loaded, as ObjectReference.PlayImpactEffect does: the decal, particles and sound of the surface's material.
1541
+ * @param target A player, an NPC, or a placed reference's form ID.
1542
+ * @param impactSet A BGSImpactDataSet (IPDS) form ID: what each material shows when hit.
1543
+ * @param options The ray: from the named node of the target (its root when left out), along the direction (straight down by default), for the length in game units (512).
1544
+ */
1545
+ playImpact(target: Player | Npc | number | string, impactSet: number | string, options?: { node?: string; direction?: Vector3; length?: number }): void;
1546
+ };
1547
+
1548
+ /**
1549
+ * Sounds in every player's game at once, heard where each game places its listener.
1550
+ */
1551
+ const Sound: {
1552
+ /**
1553
+ * Plays a sound for every player near enough to hear it: the descriptor's own attenuation decides how far it carries.
1554
+ * @param sound A sound descriptor (SNDR) by form ID or editor ID.
1555
+ * @param at A spot, or a player, an NPC or a placed reference the sound follows as it moves.
1556
+ * @param options `space`: the spot's worldspace or interior cell, the Commonwealth when left out. `volume`: 0 to 1, 1 by default.
1557
+ * @returns The sound's number, for `stop`.
1558
+ */
1559
+ play(sound: number | string, at: Vector3 | Player | Npc | number | string, options?: { space?: { worldSpace?: number | string; interiorCell?: number | string }; volume?: number }): number;
1560
+
1561
+ /**
1562
+ * Stops a sound in every game still playing it.
1563
+ * @param sound A number `play` gave.
1564
+ */
1565
+ stop(sound: number): void;
1566
+ };
1567
+
1568
+ /**
1569
+ * Doors, locks and containers, by the form ID of their placed reference. The server knows only what changed this session; the rest is as the data files place it, which only a client loads.
1570
+ */
1571
+ const Objects: {
1572
+ /**
1573
+ * Whether a door stands open.
1574
+ * @param ref The placed reference's form ID.
1575
+ * @returns Null when nobody moved it this session.
1576
+ */
1577
+ isDoorOpen(ref: number | string): boolean | null;
1578
+
1579
+ /**
1580
+ * Whether a door or container is locked.
1581
+ * @param ref The placed reference's form ID.
1582
+ * @returns Null when nobody changed its lock this session.
1583
+ */
1584
+ isLocked(ref: number | string): boolean | null;
1585
+
1586
+ /**
1587
+ * Whether a script blocked activating a reference.
1588
+ * @param ref The placed reference's form ID.
1589
+ * @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.
1590
+ */
1591
+ isActivationBlocked(ref: number | string): boolean | null;
1592
+
1593
+ /**
1594
+ * Blocks or allows activating a reference for everyone, players who join later included. Allowing a settlement's workbench lets players enter its build mode.
1595
+ * @param ref The placed reference's form ID.
1596
+ * @param blocked Blocked or allowed.
1597
+ */
1598
+ setActivationBlocked(ref: number | string, blocked: boolean): void;
1599
+
1600
+ /**
1601
+ * Whether a script left a reference in the world or took it out.
1602
+ * @param ref The placed reference's form ID.
1603
+ * @returns Null when no script decided this session: the game's own state stands.
1604
+ */
1605
+ isEnabled(ref: number | string): boolean | null;
1606
+
1607
+ /**
1608
+ * Takes a reference the data files place out of every player's world, as ObjectReference.Disable does, or puts it back, players who join later included: a barricade torn down, a door bricked up, a prop shown for an event. Held against the game's own scripts and cell loads, which put references back as they please.
1609
+ * @param ref The placed reference's form ID.
1610
+ * @param enabled In the world, or out of it.
1611
+ */
1612
+ setEnabled(ref: number | string, enabled: boolean): void;
1613
+
1614
+ /**
1615
+ * Moves a placed reference for everyone, players who join later included, as a player moving it in a settlement's build mode does: the power it receives through the air and its wires follow it.
1616
+ * @param ref The placed reference's form ID.
1617
+ * @param position Where it stands now.
1618
+ * @param angle Its rotation, radians.
1619
+ * @returns False for a reference the session scrapped or a pose that is not finite.
1620
+ */
1621
+ move(ref: number | string, position: Vector3, angle?: Vector3): boolean;
1622
+
1623
+ /**
1624
+ * Where a player's build mode or a script last put a placed reference.
1625
+ * @param ref The placed reference's form ID.
1626
+ * @returns Null while it stands where the data files place it.
1627
+ */
1628
+ getMovedPosition(ref: number | string): Vector3 | null;
1629
+
1630
+ /**
1631
+ * Opens or closes a door for everyone, players who join later included.
1632
+ * @param ref The placed reference's form ID.
1633
+ * @param open Open or closed.
1634
+ */
1635
+ setDoorOpen(ref: number | string, open: boolean): void;
1636
+
1637
+ /**
1638
+ * Locks or unlocks a door or container for everyone.
1639
+ * @param ref The placed reference's form ID.
1640
+ * @param locked Locked or not.
1641
+ */
1642
+ setLocked(ref: number | string, locked: boolean): void;
954
1643
 
955
1644
  /**
956
1645
  * What a container holds.
@@ -1131,160 +1820,486 @@ declare global {
1131
1820
  setReaction(faction: number | string, other: number | string, reaction: "neutral" | "enemy" | "ally" | "friend", mutual?: boolean): boolean;
1132
1821
 
1133
1822
  /**
1134
- * Gives a reaction back to the game's data files on every client.
1135
- * @param faction A TESFaction form ID, as a number or hex string.
1136
- * @param other The faction it reacts to, as a number or hex string.
1137
- * @param mutual Both directions, as `Faction.SetAlly` and `Faction.SetEnemy` do; true when left out.
1138
- * @returns True when one was overridden.
1823
+ * Gives a reaction back to the game's data files on every client.
1824
+ * @param faction A TESFaction form ID, as a number or hex string.
1825
+ * @param other The faction it reacts to, as a number or hex string.
1826
+ * @param mutual Both directions, as `Faction.SetAlly` and `Faction.SetEnemy` do; true when left out.
1827
+ * @returns True when one was overridden.
1828
+ */
1829
+ clearReaction(faction: number | string, other: number | string, mutual?: boolean): boolean;
1830
+ };
1831
+
1832
+ /**
1833
+ * Areas of the world the server watches, as FiveM resources do with PolyZone: an upright cylinder, around a point in a worldspace or an interior. `zoneEnter` and `zoneLeave` tell scripts who came in and who went out, from the places players' games report: a safe zone, a shop's floor, a job's drop point. The server alone knows of them.
1834
+ */
1835
+ const Zone: {
1836
+ /**
1837
+ * Starts watching an area. Players already in it are told so at the next update.
1838
+ * @param options `center` and `radius`, on the ground plane, in game units. `height`: how far above and below the center it reaches, no limit when left out. `name`: given back with its events. `space`: its worldspace or interior, the Commonwealth when left out.
1839
+ * @returns The zone's ID. Throws for a missing center or a radius that is not above 0.
1840
+ */
1841
+ create(options: { center: Vector3; radius: number; height?: number; name?: string; space?: { worldSpace: number } | { interiorCell: number } }): number;
1842
+
1843
+ /**
1844
+ * Stops watching an area; the players in it are told they left.
1845
+ * @param zone The zone's ID, as `create` gave it.
1846
+ * @returns False for an unknown ID.
1847
+ */
1848
+ remove(zone: number): boolean;
1849
+
1850
+ /**
1851
+ * The players in an area, as the last update found them.
1852
+ * @param zone The zone's ID, as `create` gave it.
1853
+ * @returns Empty for an unknown ID.
1854
+ */
1855
+ getPlayers(zone: number): Player[];
1856
+
1857
+ /**
1858
+ * Whether a point lies in an area: where an NPC stands, a drop, a spawn.
1859
+ * @param zone The zone's ID, as `create` gave it.
1860
+ * @param position The point.
1861
+ * @param space Where the point is; the Commonwealth when left out.
1862
+ * @returns False for an unknown ID.
1863
+ */
1864
+ contains(zone: number, position: Vector3, space?: { worldSpace: number } | { interiorCell: number }): boolean;
1865
+
1866
+ /**
1867
+ * Every zone's ID.
1868
+ * @returns In the order they were made.
1869
+ */
1870
+ all(): number[];
1871
+ };
1872
+
1873
+ /**
1874
+ * 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.
1875
+ */
1876
+ const Quests: {
1877
+ /**
1878
+ * Gives the player the quest, with no objectives and not active. Nothing changes when they have it already.
1879
+ * @param player A connected player.
1880
+ * @param quest The quest's form ID (QUST) in the game's data files.
1881
+ * @returns False when the player is gone.
1882
+ */
1883
+ show(player: Player, quest: number): boolean;
1884
+
1885
+ /**
1886
+ * Takes the quest and its objectives off the player.
1887
+ * @param player A connected player.
1888
+ * @param quest The quest's form ID (QUST) in the game's data files.
1889
+ * @returns False when they did not have it.
1890
+ */
1891
+ hide(player: Player, quest: number): boolean;
1892
+
1893
+ /**
1894
+ * Tracks the quest on the player's HUD, or stops tracking it.
1895
+ * @param player A connected player.
1896
+ * @param quest The quest's form ID (QUST) in the game's data files.
1897
+ * @param active Whether the HUD tracks it.
1898
+ * @returns False when they do not have the quest.
1899
+ */
1900
+ setActive(player: Player, quest: number, active: boolean): boolean;
1901
+
1902
+ /**
1903
+ * Sets one of the quest's objectives for the player. A quest holds 32 objectives at most.
1904
+ * @param player A connected player.
1905
+ * @param quest The quest's form ID (QUST) in the game's data files.
1906
+ * @param index The objective's index in the quest (its QOBJ value, as the data files give it).
1907
+ * @param state 'displayed' shows it on the HUD tracker; 'completed' and 'failed' mark it in the Pip-Boy; 'hidden' takes it off.
1908
+ * @returns False when they do not have the quest, or it holds 32 objectives already.
1909
+ */
1910
+ setObjective(player: Player, quest: number, index: number, state: 'hidden' | 'displayed' | 'completed' | 'failed'): boolean;
1911
+
1912
+ /**
1913
+ * The quests the player has, by form ID.
1914
+ * @param player A connected player.
1915
+ * @returns Empty when they have none.
1916
+ */
1917
+ getShown(player: Player): number[];
1918
+
1919
+ /**
1920
+ * Whether the player's HUD tracks the quest.
1921
+ * @param player A connected player.
1922
+ * @param quest The quest's form ID (QUST) in the game's data files.
1923
+ * @returns Null when they do not have it.
1924
+ */
1925
+ isActive(player: Player, quest: number): boolean | null;
1926
+
1927
+ /**
1928
+ * The state of one of the quest's objectives for the player.
1929
+ * @param player A connected player.
1930
+ * @param quest The quest's form ID (QUST) in the game's data files.
1931
+ * @param index The objective's index in the quest (its QOBJ value, as the data files give it).
1932
+ * @returns Null when they do not have the quest.
1933
+ */
1934
+ getObjective(player: Player, quest: number, index: number): 'hidden' | 'displayed' | 'completed' | 'failed' | null;
1935
+ };
1936
+
1937
+ /**
1938
+ * 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.
1939
+ */
1940
+ class Mine {
1941
+ /**
1942
+ * Wraps an armed mine with this ID; it lays nothing.
1943
+ * @param id Network entity identifier.
1944
+ */
1945
+ constructor(id: number);
1946
+
1947
+ /**
1948
+ * How close a player must come to set it off, in game units; 0 once it is gone.
1949
+ */
1950
+ readonly radius: number;
1951
+
1952
+ /**
1953
+ * The BGSExplosion form ID it sets off; 0 once it is gone.
1954
+ */
1955
+ readonly explosion: number;
1956
+
1957
+ /**
1958
+ * Has the owner's game set the mine off where it lies, as if a player walked onto it. The blast is the owner's: `playerExplosion` and `playerHit` follow.
1959
+ * @returns True when sent; false when it is gone or already going off.
1960
+ */
1961
+ detonate(): boolean;
1962
+
1963
+ /**
1964
+ * Takes the mine out of the world without a blast.
1965
+ * @returns True when it was armed.
1966
+ */
1967
+ remove(): boolean;
1968
+
1969
+ /**
1970
+ * Formats this handle for logging.
1971
+ * @returns The mine's network ID, owner and radius.
1972
+ */
1973
+ toString(): string;
1974
+
1975
+ /**
1976
+ * The player who laid it.
1977
+ * @returns The owner, or null once the mine or its owner is gone.
1978
+ */
1979
+ getOwner(): Player | null;
1980
+
1981
+ /**
1982
+ * Every armed mine.
1983
+ * @returns One handle per mine.
1984
+ */
1985
+ static all(): Mine[];
1986
+ }
1987
+
1988
+ interface Mine extends Entity {}
1989
+
1990
+ /**
1991
+ * A radio station every player's game carries. It joins each Pip-Boy's station list once heard and plays through world radios tuned to it, everywhere in the world. The server says what is on air and since when, so every player hears the same moment of the same track. A station outlives the resource that created it until destroyed.
1992
+ */
1993
+ class RadioStation {
1994
+ /**
1995
+ * Wraps the station with this ID; it creates nothing.
1996
+ * @param id Network entity identifier.
1997
+ */
1998
+ constructor(id: number);
1999
+
2000
+ /**
2001
+ * What the Pip-Boy lists it as; empty once it is gone.
2002
+ */
2003
+ readonly name: string;
2004
+
2005
+ /**
2006
+ * The frequency it transmits on; 0 once it is gone.
2007
+ */
2008
+ readonly frequency: number;
2009
+
2010
+ /**
2011
+ * The BGSSoundDescriptorForm form ID on air; 0 while it is silent.
2012
+ */
2013
+ readonly sound: number;
2014
+
2015
+ /**
2016
+ * How long the track on air runs, in milliseconds, as given to `play`; 0 when not given.
2017
+ */
2018
+ readonly duration: number;
2019
+
2020
+ /**
2021
+ * How long the track on air has run, in milliseconds; 0 while it is silent.
2022
+ */
2023
+ readonly elapsed: number;
2024
+
2025
+ /**
2026
+ * Takes the track off air: every player's radio falls silent on this station.
2027
+ * @returns False once the station is gone.
2028
+ */
2029
+ stop(): boolean;
2030
+
2031
+ /**
2032
+ * Takes the station off every player's radio.
2033
+ * @returns False once the station is gone.
2034
+ */
2035
+ destroy(): boolean;
2036
+
2037
+ /**
2038
+ * Formats this handle for logging.
2039
+ * @returns The station's network ID, name and frequency.
2040
+ */
2041
+ toString(): string;
2042
+
2043
+ /**
2044
+ * Puts a track on air from now, replacing what played. Only a player's data files can tell whether the form is a sound descriptor, so a wrong one stays silent. No event marks the end of a track: the script schedules the next one itself, from the duration it knows.
2045
+ * @param sound A BGSSoundDescriptorForm form ID, as a number or hex string.
2046
+ * @param durationMs How long it runs. With it, a player tuning in until then still hears it; without it, a player's radio drops it once it has played out.
2047
+ * @returns False once the station is gone.
2048
+ */
2049
+ play(sound: number | string, durationMs?: number): boolean;
2050
+
2051
+ /**
2052
+ * Creates a silent station on every player's radio.
2053
+ * @param name What the Pip-Boy lists it as, up to 64 characters.
2054
+ * @param frequency What it transmits on, 80 to 110, the Pip-Boy's dial; no other station may hold it. A game station on the same frequency plays over it unless the game's stations are off.
2055
+ * @returns The station, or null when the name or frequency was refused.
2056
+ */
2057
+ static create(name: string, frequency: number): RadioStation | null;
2058
+
2059
+ /**
2060
+ * Puts the game's own stations (Diamond City Radio, Classical Radio, and the quest signals and distress beacons too) on or off every player's radio. Each player's game runs them alone, so no two players hear the same thing on them. Off, they leave the Pip-Boy's list and every world radio, and the scenes behind them play out in person instead. A player joining later follows the setting.
2061
+ * @param enabled False takes them off; true puts them back.
2062
+ */
2063
+ static setVanillaStationsEnabled(enabled: boolean): void;
2064
+
2065
+ /**
2066
+ * Whether the game's own stations are on the radio.
2067
+ * @returns True unless a script turned them off.
2068
+ */
2069
+ static areVanillaStationsEnabled(): boolean;
2070
+
2071
+ /**
2072
+ * Every station.
2073
+ * @returns One handle per station.
2074
+ */
2075
+ static all(): RadioStation[];
2076
+ }
2077
+
2078
+ interface RadioStation extends Entity {}
2079
+
2080
+ /**
2081
+ * A marker on every player's HUD compass and Pip-Boy map, as FiveM's blips: at a point, or following a player or an NPC. A player sees it while they are in its worldspace or interior. A blip outlives the resource that made it until destroyed. Move it with `setPosition` or `attachTo`, not by setting `position`.
2082
+ */
2083
+ class Blip {
2084
+ /**
2085
+ * Wraps the blip with this ID; it creates nothing.
2086
+ * @param id Network entity identifier.
2087
+ */
2088
+ constructor(id: number);
2089
+
2090
+ /**
2091
+ * What the Pip-Boy map's tooltip says; empty once it is gone.
2092
+ */
2093
+ readonly label: string;
2094
+
2095
+ /**
2096
+ * Takes the blip off every player's compass and map.
2097
+ * @returns False once it is gone.
2098
+ */
2099
+ destroy(): boolean;
2100
+
2101
+ /**
2102
+ * Formats this handle for logging.
2103
+ * @returns The blip's network ID and label.
1139
2104
  */
1140
- clearReaction(faction: number | string, other: number | string, mutual?: boolean): boolean;
1141
- };
2105
+ toString(): string;
1142
2106
 
1143
- /**
1144
- * 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
- */
1146
- class Mine {
1147
2107
  /**
1148
- * Wraps an armed mine with this ID; it lays nothing.
1149
- * @param id Network entity identifier.
2108
+ * Moves the blip to a point, as FiveM's SetBlipCoords does; it stops following anyone.
2109
+ * @param position Where, in world units.
2110
+ * @param space Where that is; its current space when left out.
2111
+ * @returns False once it is gone.
1150
2112
  */
1151
- constructor(id: number);
2113
+ setPosition(position: Vector3, space?: { worldSpace: number } | { interiorCell: number }): boolean;
1152
2114
 
1153
2115
  /**
1154
- * How close a player must come to set it off, in game units; 0 once it is gone.
2116
+ * Has the blip follow a player or an NPC, as FiveM's AddBlipForEntity does: each player's game puts it on that body while it has it loaded, and on where the server last saw it otherwise.
2117
+ * @param target Whose body to follow; null to stay where it is.
2118
+ * @returns False once it is gone.
1155
2119
  */
1156
- readonly radius: number;
2120
+ attachTo(target: Player | Npc | null): boolean;
1157
2121
 
1158
2122
  /**
1159
- * The BGSExplosion form ID it sets off; 0 once it is gone.
2123
+ * Whom the blip follows.
2124
+ * @returns Null for a blip at a point, or once that body is gone.
1160
2125
  */
1161
- readonly explosion: number;
2126
+ getAttached(): Player | Npc | null;
1162
2127
 
1163
2128
  /**
1164
- * Has the owner's game set the mine off where it lies, as if a player walked onto it. The blast is the owner's: `playerExplosion` and `playerHit` follow.
1165
- * @returns True when sent; false when it is gone or already going off.
2129
+ * Shows the blip to one player only, as a FiveM blip a client script made for its own player: a delivery's drop point, a bounty on someone's own map.
2130
+ * @param player The one player who sees it; null for everyone.
2131
+ * @returns False once it is gone.
1166
2132
  */
1167
- detonate(): boolean;
2133
+ setPlayer(player: Player | null): boolean;
1168
2134
 
1169
2135
  /**
1170
- * Takes the mine out of the world without a blast.
1171
- * @returns True when it was armed.
2136
+ * The one player who sees the blip.
2137
+ * @returns Null while everyone does.
1172
2138
  */
1173
- remove(): boolean;
2139
+ getPlayer(): Player | null;
1174
2140
 
1175
2141
  /**
1176
- * Formats this handle for logging.
1177
- * @returns The mine's network ID, owner and radius.
2142
+ * Changes what the Pip-Boy map's tooltip says.
2143
+ * @param label Up to 63 bytes of UTF-8.
2144
+ * @returns False once it is gone.
1178
2145
  */
1179
- toString(): string;
2146
+ setLabel(label: string): boolean;
1180
2147
 
1181
2148
  /**
1182
- * The player who laid it.
1183
- * @returns The owner, or null once the mine or its owner is gone.
2149
+ * Puts a blip on every player's compass and map, as FiveM's AddBlipForCoord and AddBlipForEntity do.
2150
+ * @param options `position` or `entity`, where it is or whom it follows. `label`: the map's tooltip. `kind`: the icon, "quest" by default. `compass` and `map`: where it shows, both by default. `space`: a point's worldspace or interior, the Commonwealth when left out. `player`: the one player who sees it, everyone when left out.
2151
+ * @returns The blip; null when it could not be made. Throws for options that name neither a position nor a body.
1184
2152
  */
1185
- getOwner(): Player | null;
2153
+ static create(options: { position?: Vector3; entity?: Player | Npc; label?: string; kind?: "quest" | "custom" | "powerArmor"; compass?: boolean; map?: boolean; space?: { worldSpace: number } | { interiorCell: number }; player?: Player }): Blip | null;
1186
2154
 
1187
2155
  /**
1188
- * Every armed mine.
1189
- * @returns One handle per mine.
2156
+ * Every blip.
2157
+ * @returns One handle per blip.
1190
2158
  */
1191
- static all(): Mine[];
2159
+ static all(): Blip[];
1192
2160
  }
1193
2161
 
1194
- interface Mine extends Entity {}
2162
+ interface Blip extends Entity {}
1195
2163
 
1196
2164
  /**
1197
- * A radio station every player's game carries. It joins each Pip-Boy's station list once heard and plays through world radios tuned to it, everywhere in the world. The server says what is on air and since when, so every player hears the same moment of the same track. A station outlives the resource that created it until destroyed.
2165
+ * Text floating in the world on every player's screen, as FiveM resources draw 3D text: over a shop's door, a ped's head, a player. A player sees it while they are in its worldspace or interior and within its range. A label outlives the resource that made it until destroyed. Move it with `setPosition` or `attachTo`, not by setting `position`.
1198
2166
  */
1199
- class RadioStation {
2167
+ class TextLabel {
1200
2168
  /**
1201
- * Wraps the station with this ID; it creates nothing.
2169
+ * Wraps the label with this ID; it creates nothing.
1202
2170
  * @param id Network entity identifier.
1203
2171
  */
1204
2172
  constructor(id: number);
1205
2173
 
1206
2174
  /**
1207
- * What the Pip-Boy lists it as; empty once it is gone.
2175
+ * What it says; empty once it is gone.
1208
2176
  */
1209
- readonly name: string;
2177
+ readonly text: string;
1210
2178
 
1211
2179
  /**
1212
- * The frequency it transmits on; 0 once it is gone.
2180
+ * Takes the label off every player's screen.
2181
+ * @returns False once it is gone.
1213
2182
  */
1214
- readonly frequency: number;
2183
+ destroy(): boolean;
1215
2184
 
1216
2185
  /**
1217
- * The BGSSoundDescriptorForm form ID on air; 0 while it is silent.
2186
+ * Formats this handle for logging.
2187
+ * @returns The label's network ID and text.
1218
2188
  */
1219
- readonly sound: number;
2189
+ toString(): string;
1220
2190
 
1221
2191
  /**
1222
- * How long the track on air runs, in milliseconds, as given to `play`; 0 when not given.
2192
+ * Changes what the label says.
2193
+ * @param text Up to 127 bytes of UTF-8; a line break starts a new line.
2194
+ * @returns False once it is gone.
1223
2195
  */
1224
- readonly duration: number;
2196
+ setText(text: string): boolean;
1225
2197
 
1226
2198
  /**
1227
- * How long the track on air has run, in milliseconds; 0 while it is silent.
2199
+ * Changes the text's color.
2200
+ * @param color 0xRRGGBBAA: 0xFFFFFFFF is opaque white.
2201
+ * @returns False once it is gone.
1228
2202
  */
1229
- readonly elapsed: number;
2203
+ setColor(color: number): boolean;
1230
2204
 
1231
2205
  /**
1232
- * Takes the track off air: every player's radio falls silent on this station.
1233
- * @returns False once the station is gone.
2206
+ * Moves the label to a point; it stops floating over anyone.
2207
+ * @param position Where, in world units.
2208
+ * @param space Where that is; its current space when left out.
2209
+ * @returns False once it is gone.
1234
2210
  */
1235
- stop(): boolean;
2211
+ setPosition(position: Vector3, space?: { worldSpace: number } | { interiorCell: number }): boolean;
1236
2212
 
1237
2213
  /**
1238
- * Takes the station off every player's radio.
1239
- * @returns False once the station is gone.
2214
+ * Has the label float over a player or an NPC: each player's game draws it over that body while it has it loaded, and over where the server last saw it otherwise.
2215
+ * @param target Whose body to float over; null to stay where it is.
2216
+ * @returns False once it is gone.
2217
+ */
2218
+ attachTo(target: Player | Npc | null): boolean;
2219
+
2220
+ /**
2221
+ * Puts floating text in the world for every player, as FiveM's DrawText3D is drawn: "[E] Shop" over a counter, a name over a head.
2222
+ * @param options `text`: what it says. `position` or `entity`: where it is or whom it floats over. `height`: how far above, 140 over a body and 0 at a point by default. `color`: 0xRRGGBBAA, white by default. `range`: how far from a player it is drawn, 1000 by default, at most 20000. `space`: a point's worldspace or interior, the Commonwealth when left out. `player`: the one player who sees it, everyone when left out.
2223
+ * @returns The label; null when it could not be made. Throws for options without text, or naming neither a position nor a body.
2224
+ */
2225
+ static create(options: { text: string; position?: Vector3; entity?: Player | Npc; height?: number; color?: number; range?: number; space?: { worldSpace: number } | { interiorCell: number }; player?: Player }): TextLabel | null;
2226
+
2227
+ /**
2228
+ * Every label.
2229
+ * @returns One handle per label.
2230
+ */
2231
+ static all(): TextLabel[];
2232
+ }
2233
+
2234
+ interface TextLabel extends Entity {}
2235
+
2236
+ /**
2237
+ * A ring on the ground on every player's screen, as FiveM resources draw a marker with CreateCheckpoint or DrawMarker: a translucent upright cylinder at a job's pickup, a shop's door, a race's next gate. A player sees it while they are in its worldspace or interior and within its range. It shows the place; `Zone.create` with the same center and radius tells scripts who steps in. Move it with `setPosition`, not by setting `position`.
2238
+ */
2239
+ class Checkpoint {
2240
+ /**
2241
+ * Wraps the checkpoint with this ID; it creates nothing.
2242
+ * @param id Network entity identifier.
2243
+ */
2244
+ constructor(id: number);
2245
+
2246
+ /**
2247
+ * Its radius in game units; 0 once it is gone.
2248
+ */
2249
+ readonly radius: number;
2250
+
2251
+ /**
2252
+ * Takes the checkpoint off every player's screen.
2253
+ * @returns False once it is gone.
1240
2254
  */
1241
2255
  destroy(): boolean;
1242
2256
 
1243
2257
  /**
1244
2258
  * Formats this handle for logging.
1245
- * @returns The station's network ID, name and frequency.
2259
+ * @returns The checkpoint's network ID and radius.
1246
2260
  */
1247
2261
  toString(): string;
1248
2262
 
1249
2263
  /**
1250
- * Puts a track on air from now, replacing what played. Only a player's data files can tell whether the form is a sound descriptor, so a wrong one stays silent. No event marks the end of a track: the script schedules the next one itself, from the duration it knows.
1251
- * @param sound A BGSSoundDescriptorForm form ID, as a number or hex string.
1252
- * @param durationMs How long it runs. With it, a player tuning in until then still hears it; without it, a player's radio drops it once it has played out.
1253
- * @returns False once the station is gone.
2264
+ * Changes its color.
2265
+ * @param color 0xRRGGBBAA; the alpha is the wall's, the rim is drawn more solid.
2266
+ * @returns False once it is gone.
1254
2267
  */
1255
- play(sound: number | string, durationMs?: number): boolean;
2268
+ setColor(color: number): boolean;
1256
2269
 
1257
2270
  /**
1258
- * Creates a silent station on every player's radio.
1259
- * @param name What the Pip-Boy lists it as, up to 64 characters.
1260
- * @param frequency What it transmits on, 80 to 110, the Pip-Boy's dial; no other station may hold it. A game station on the same frequency plays over it unless the game's stations are off.
1261
- * @returns The station, or null when the name or frequency was refused.
2271
+ * Widens or narrows it.
2272
+ * @param radius Game units, above 0 and at most 5000.
2273
+ * @returns False once it is gone.
1262
2274
  */
1263
- static create(name: string, frequency: number): RadioStation | null;
2275
+ setRadius(radius: number): boolean;
1264
2276
 
1265
2277
  /**
1266
- * Puts the game's own stations (Diamond City Radio, Classical Radio, and the quest signals and distress beacons too) on or off every player's radio. Each player's game runs them alone, so no two players hear the same thing on them. Off, they leave the Pip-Boy's list and every world radio, and the scenes behind them play out in person instead. A player joining later follows the setting.
1267
- * @param enabled False takes them off; true puts them back.
2278
+ * Moves it.
2279
+ * @param position The middle of its base, on the ground.
2280
+ * @param space Where that is; its current space when left out.
2281
+ * @returns False once it is gone.
1268
2282
  */
1269
- static setVanillaStationsEnabled(enabled: boolean): void;
2283
+ setPosition(position: Vector3, space?: { worldSpace: number } | { interiorCell: number }): boolean;
1270
2284
 
1271
2285
  /**
1272
- * Whether the game's own stations are on the radio.
1273
- * @returns True unless a script turned them off.
2286
+ * Puts a ring on the ground for every player, or one player.
2287
+ * @param options `position`: the middle of its base, on the ground. `radius`: 100 by default, at most 5000. `height`: how high its wall rises, 50 by default, 0 for a flat ring. `color`: 0xRRGGBBAA, a translucent amber by default. `range`: how far from a player it is drawn, 3000 by default, at most 20000. `space`: its worldspace or interior, the Commonwealth when left out. `player`: the one player who sees it, everyone when left out.
2288
+ * @returns The checkpoint; null when it could not be made. Throws for options without a position, or a radius out of range.
1274
2289
  */
1275
- static areVanillaStationsEnabled(): boolean;
2290
+ static create(options: { position: Vector3; radius?: number; height?: number; color?: number; range?: number; space?: { worldSpace: number } | { interiorCell: number }; player?: Player }): Checkpoint | null;
1276
2291
 
1277
2292
  /**
1278
- * Every station.
1279
- * @returns One handle per station.
2293
+ * Every checkpoint.
2294
+ * @returns One handle per checkpoint.
1280
2295
  */
1281
- static all(): RadioStation[];
2296
+ static all(): Checkpoint[];
1282
2297
  }
1283
2298
 
1284
- interface RadioStation extends Entity {}
2299
+ interface Checkpoint extends Entity {}
1285
2300
 
1286
2301
  /**
1287
- * A non-player actor the server took over from the data files: the generic placed ones, not the unique, essential or quest actors, which stay each client's own. A client near it runs it with the game's own AI and reports its health; nobody near, the server walks it. It lives for the whole session and comes back on its own a while after it dies. Move it with `teleport`, not by setting `position`.
2302
+ * A non-player actor the server took over from the data files: the generic placed ones, not the unique, essential or quest actors, which stay each client's own. A client near it runs it with the game's own AI and reports its health; nobody near, the server walks it. It lives for the whole session and comes back on its own a while after it dies. A script also makes its own with `Npc.spawn`: those stay dead until `respawn` and leave with `remove`. Move it with `teleport`, not by setting `position`.
1288
2303
  */
1289
2304
  class Npc {
1290
2305
  /**
@@ -1294,7 +2309,7 @@ declare global {
1294
2309
  constructor(id: number);
1295
2310
 
1296
2311
  /**
1297
- * The form ID of the placed reference (ACHR) it stands for.
2312
+ * The form ID of the placed reference (ACHR) it stands for; 0 for one a script spawned.
1298
2313
  */
1299
2314
  readonly ref: number;
1300
2315
 
@@ -1303,6 +2318,16 @@ declare global {
1303
2318
  */
1304
2319
  readonly form: number;
1305
2320
 
2321
+ /**
2322
+ * 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.
2323
+ */
2324
+ readonly editorId: string;
2325
+
2326
+ /**
2327
+ * 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.
2328
+ */
2329
+ readonly level: number;
2330
+
1306
2331
  /**
1307
2332
  * 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
2333
  */
@@ -1318,6 +2343,31 @@ declare global {
1318
2343
  */
1319
2344
  readonly isDead: boolean;
1320
2345
 
2346
+ /**
2347
+ * Whether `setRestrained` froze it in place.
2348
+ */
2349
+ readonly isRestrained: boolean;
2350
+
2351
+ /**
2352
+ * Whether the game that runs it has it in the sneak stance, as its last report says.
2353
+ */
2354
+ readonly isSneaking: boolean;
2355
+
2356
+ /**
2357
+ * Whether `setActivationBlocked` stopped the game's own activation of it.
2358
+ */
2359
+ readonly isActivationBlocked: boolean;
2360
+
2361
+ /**
2362
+ * The name `setName` gave it; empty while it shows its record's own.
2363
+ */
2364
+ readonly name: string;
2365
+
2366
+ /**
2367
+ * Whether `setInvulnerable` made it unhurtable.
2368
+ */
2369
+ readonly isInvulnerable: boolean;
2370
+
1321
2371
  /**
1322
2372
  * Facing, in radians around Z.
1323
2373
  */
@@ -1329,6 +2379,12 @@ declare global {
1329
2379
  */
1330
2380
  kill(): boolean;
1331
2381
 
2382
+ /**
2383
+ * Takes an NPC a script spawned out of the session; every player's game drops it at the next update. The handle resolves to nothing after.
2384
+ * @returns True when it goes; false for one that stands for a placed reference, which lives for the whole session.
2385
+ */
2386
+ remove(): boolean;
2387
+
1332
2388
  /**
1333
2389
  * Puts it back at its placement, whole, dead or alive; `npcRespawn` follows.
1334
2390
  * @returns True when done.
@@ -1353,6 +2409,12 @@ declare global {
1353
2409
  */
1354
2410
  getSimulator(): Player | null;
1355
2411
 
2412
+ /**
2413
+ * Who the NPC fights, as the game that runs it reports: its own choice, or the target `attack` gave it. The `npcTarget` event tells each change.
2414
+ * @returns Null while it fights nobody, or is dead.
2415
+ */
2416
+ getCombatTarget(): Player | Npc | null;
2417
+
1356
2418
  /**
1357
2419
  * The player the NPC follows as a companion.
1358
2420
  * @returns Null when it follows nobody.
@@ -1373,6 +2435,240 @@ declare global {
1373
2435
  */
1374
2436
  damage(amount: number): boolean;
1375
2437
 
2438
+ /**
2439
+ * Gives the NPC health back, as FiveM's SetEntityHealth raises a ped's and Actor.RestoreValue does: the game that runs it restores it, and `health` follows with its next report. One nobody runs is healed on the server.
2440
+ * @param amount Health to give back, above 0; the NPC stops at its maximum.
2441
+ * @returns True when sent; false when it is dead or gone.
2442
+ */
2443
+ heal(amount: number): boolean;
2444
+
2445
+ /**
2446
+ * Sends the NPC somewhere, as FiveM's TaskGoToCoord does a ped: the game that runs it has it travel there as a commanded companion does, along the navmesh, and the server walks it there while nobody near runs it. `npcArrive` follows once it is there; it then stands there until `stopGoing` or the next `goTo`. Its fights still come first.
2447
+ * @param target A point of the NPC's space, or a player or NPC to walk up to.
2448
+ * @returns True when sent; false when it is dead or the target is itself.
2449
+ */
2450
+ goTo(target: Vector3 | Player | Npc): boolean;
2451
+
2452
+ /**
2453
+ * Has the NPC use a piece of furniture, as FiveM's TaskStartScenarioAtPosition puts a ped to a scenario and a companion obeys the player's command: the game that runs it walks it there and activates it, sitting down or getting to work, and sends it back if it gets up on its own. It replaces a `goTo` order, and `goTo` replaces it. `stopUsing` lets it go.
2454
+ * @param ref A placed piece of furniture, by its reference's form ID: a chair, a bench, a workstation.
2455
+ * @returns True when sent; false when it is dead or gone.
2456
+ */
2457
+ use(ref: number | string): boolean;
2458
+
2459
+ /**
2460
+ * Sets the NPC's health at full, as FiveM's SetEntityMaxHealth does an entity: the game that runs it carries it as the NPC's permanent Health, and every player's copy takes it from there. The damage it took is kept, so an unhurt NPC stays at full. It lasts while the NPC does, through respawns.
2461
+ * @param value Health at full, at least 1.
2462
+ * @returns True when sent; false when it is dead or gone.
2463
+ */
2464
+ setMaxHealth(value: number): boolean;
2465
+
2466
+ /**
2467
+ * Scales the NPC on every player's copy, as ObjectReference.SetScale does: its body, its collision and its reach grow or shrink together. It lasts while the NPC does, through respawns.
2468
+ * @param scale 1 for its record's size, from 0.01 to 10: 1.5 a hulking boss, 0.5 a runt.
2469
+ * @returns True when sent; false when it is gone.
2470
+ */
2471
+ setScale(scale: number): boolean;
2472
+
2473
+ /**
2474
+ * Sets one of the NPC's actor values on every player's copy, as FiveM's ped natives tune a ped: SpeedMult (100 is its own speed) for SetPedMoveRateOverride, Aggression, Confidence and Assistance for SetPedCombatAttributes. Each copy holds the base, its own coming back with `resetValue`. A value the game derives from something else keeps its own: DamageResist comes from the armor worn, so dress the NPC (`setOutfit`) instead. An `attack` or `flee` order holds Aggression or Confidence while it runs. Up to 16 values per NPC; it lasts while the NPC does.
2475
+ * @param value An actor value by editor ID, such as `"SpeedMult"`, `"Aggression"` or `"Confidence"`, or by form ID. Not Health: `setMaxHealth` sets that.
2476
+ * @param base The base every copy holds.
2477
+ * @returns True when sent; false when the NPC is gone or 16 values are already set. Throws for a name or form no actor value has, and for Health.
2478
+ */
2479
+ setValue(value: string | number, base: number): boolean;
2480
+
2481
+ /**
2482
+ * The base `setValue` gave one of the NPC's actor values.
2483
+ * @param value An actor value by editor ID, such as `"SpeedMult"`, `"Aggression"` or `"Confidence"`, or by form ID. Not Health: `setMaxHealth` sets that.
2484
+ * @returns Null when the script set none; the record's own is in each player's game alone.
2485
+ */
2486
+ getValue(value: string | number): number | null;
2487
+
2488
+ /**
2489
+ * Gives every copy its own base for one actor value back.
2490
+ * @param value An actor value by editor ID, such as `"SpeedMult"`, `"Aggression"` or `"Confidence"`, or by form ID. Not Health: `setMaxHealth` sets that.
2491
+ * @returns True when sent; false when the NPC is gone or the value was not set.
2492
+ */
2493
+ resetValue(value: string | number): boolean;
2494
+
2495
+ /**
2496
+ * Holds the NPC's weapon out or away, as FiveM's SetCurrentPedWeapon draws a ped's: the game that runs it draws or holsters it (Actor.DrawWeapon) and keeps it so when its AI would change it, and every player's copy follows. A guard on watch, a trader with nothing in hand. It does not start or end a fight.
2497
+ * @param drawn True to hold its weapon out, false to keep it away, null to leave it to its AI.
2498
+ * @returns True when sent; false when it is dead or gone.
2499
+ */
2500
+ setWeaponDrawn(drawn: boolean | null): boolean;
2501
+
2502
+ /**
2503
+ * Takes the NPC's collision away or gives it back on every player's copy, as FiveM's SetEntityCollision does a ped and the console's tcl a selected actor: without it the NPC moves along where it looks, through walls and floors, without gravity. A ghost through a wall, a body walked out of a locked room. It lasts while the NPC does.
2504
+ * @param enabled False to take its collision away, true to give it back.
2505
+ * @returns True when sent; false when it is dead or gone.
2506
+ */
2507
+ setCollision(enabled: boolean): boolean;
2508
+
2509
+ /**
2510
+ * Has the NPC sneak, as FiveM's SetPedStealthMovement does a ped: the game that runs it holds it in the sneak stance (the console's SetForceSneak) wherever its AI takes it, and every player's copy crouches with it. `isSneaking` reports the stance its game runs.
2511
+ * @param sneaking True to crouch into sneak, false to stand up.
2512
+ * @returns True when sent; false when it is dead or gone.
2513
+ */
2514
+ setSneaking(sneaking: boolean): boolean;
2515
+
2516
+ /**
2517
+ * Knocks the NPC off its feet into its ragdoll, as FiveM's SetPedToRagdoll does a ped: the game that runs it pushes its body, it lies a moment and gets up by itself, and every player's copy falls and gets up with it. One that is down already, seated or held in place is left as it is.
2518
+ * @param force How hard it is thrown, as ObjectReference.PushActorAway takes it: small numbers, 1 to 50 (600 threw an NPC 8,700 units); 0, the default, drops it where it stands.
2519
+ * @param from The point it is thrown away from; where it stands by default.
2520
+ * @returns True when sent; false when it is dead, gone, or no player's game runs it.
2521
+ */
2522
+ knockDown(force?: number, from?: Vector3): boolean;
2523
+
2524
+ /**
2525
+ * Draws the NPC more or less see-through on every player's copy, as FiveM's SetEntityAlpha does a ped and Actor.SetAlpha an actor: a ghost, a stalker, an NPC kept out of sight. Its collision and its AI are left as they are. It lasts while the NPC does.
2526
+ * @param alpha 0, invisible, to 1, solid.
2527
+ * @returns True when sent; false when it is gone.
2528
+ */
2529
+ setAlpha(alpha: number): boolean;
2530
+
2531
+ /**
2532
+ * Has the NPC run from a player or an NPC, as FiveM's TaskSmartFleePed does a ped: the game that runs it puts it in combat with that body with its Confidence at Cowardly, so it runs and hides as a frightened settler does, and every player sees it. Its own Confidence comes back when it stops. It replaces an `attack` order, and `attack` replaces it. `stopFleeing` ends it.
2533
+ * @param from The body it runs from.
2534
+ * @returns True when sent; false when it is dead or gone, or the body is not alive in its space.
2535
+ */
2536
+ flee(from: Player | Npc): boolean;
2537
+
2538
+ /**
2539
+ * Ends a `flee` order: the NPC's fight ends and its own Confidence comes back.
2540
+ * @returns True when sent; false when it is dead, gone or not fleeing.
2541
+ */
2542
+ stopFleeing(): boolean;
2543
+
2544
+ /**
2545
+ * Has the NPC live around a point, as FiveM's TaskWanderInArea does a ped: the game that runs it idles, sits, leans and walks about within 512 units of the center, as Fallout 4's settlers sandbox, and every player sees it do so. It replaces a `goTo` or `use` order, and either replaces it. `stopWandering` gives it back its own packages.
2546
+ * @param center The middle of the area, in the NPC's space; where it stands when left out.
2547
+ * @returns True when sent; false when it is dead or gone.
2548
+ */
2549
+ wander(center?: Vector3): boolean;
2550
+
2551
+ /**
2552
+ * Ends a `wander` order: the NPC goes back to its own packages.
2553
+ * @returns True when sent; false when it is dead, gone or not wandering.
2554
+ */
2555
+ stopWandering(): boolean;
2556
+
2557
+ /**
2558
+ * Freezes the NPC in place on every player's copy, as FiveM's FreezeEntityPosition does a ped and Actor.SetRestrained an actor: it stands where it is and neither walks, fights nor talks, its head still free to turn (`lookAt`). A shopkeeper behind his counter, a prisoner. It lasts through respawns.
2559
+ * @param restrained True to freeze it where it stands, false to let it go.
2560
+ * @returns True when sent; false when the NPC is gone.
2561
+ */
2562
+ setRestrained(restrained: boolean): boolean;
2563
+
2564
+ /**
2565
+ * Turns the NPC's head and eyes toward a player or another NPC and keeps them there, on every player's copy, as FiveM's TaskLookAtEntity does a ped and Actor.SetLookAt an actor: a shopkeeper watching his customer, a guard eyeing a stranger. It does not turn its body or stop what it does.
2566
+ * @param target Whose body to watch; null to look where it pleases again.
2567
+ * @returns True when sent; false when the NPC is gone, the target is itself, or it looked at nobody and null was given.
2568
+ */
2569
+ lookAt(target: Player | Npc | null): boolean;
2570
+
2571
+ /**
2572
+ * Drops the order `use` gave: the NPC gets up and goes back to its own business.
2573
+ * @returns True when it had one.
2574
+ */
2575
+ stopUsing(): boolean;
2576
+
2577
+ /**
2578
+ * Drops the order `goTo` gave: the NPC goes back to its own business.
2579
+ * @returns True when it had one.
2580
+ */
2581
+ stopGoing(): boolean;
2582
+
2583
+ /**
2584
+ * Sets the NPC on someone, as FiveM's TaskCombatPed does a ped: the game that runs it starts combat with the target, as Actor.StartCombat does, and keeps its aim on it whatever its own target choice would be. It fights with what it carries, and the hits go through `npcAttack` as any other. The order ends when the target dies or leaves, or with `stopAttacking`.
2585
+ * @param target Who to fight: a living player or NPC of its space.
2586
+ * @returns True when sent; false when it is dead, or the target is itself or no living player or NPC of its space.
2587
+ */
2588
+ attack(target: Player | Npc): boolean;
2589
+
2590
+ /**
2591
+ * The memberships scripts changed on the NPC, each with its rank, or -1 for a faction it was taken out of. The factions its record gives it and no script touched are not listed.
2592
+ * @returns One entry per faction, in the order they were first changed; empty when the NPC is gone.
2593
+ */
2594
+ getFactions(): { faction: number; rank: number }[];
2595
+
2596
+ /**
2597
+ * Puts the NPC in a faction at a rank, or re-ranks it, as `Actor.SetFactionRank` does and FiveM's relationship groups do for a ped: every player's copy holds the membership, so the game's own hostility follows. A raider taken out of RaiderFaction and put in PlayerFaction (0x1C21C) treats players as its own. Up to 16 factions per NPC.
2598
+ * @param faction A TESFaction form ID, as a number or hex string.
2599
+ * @param rank 0 to 127; 0 when left out.
2600
+ * @returns True when set; false when the NPC is gone or 16 of its factions are already changed.
2601
+ */
2602
+ setFactionRank(faction: number | string, rank?: number): boolean;
2603
+
2604
+ /**
2605
+ * Takes the NPC out of a faction on every player's copy, as `Actor.RemoveFromFaction` does, whether its record or a script put it there.
2606
+ * @param faction A TESFaction form ID, as a number or hex string.
2607
+ * @returns True when sent; false when the NPC is gone or 16 of its factions are already changed.
2608
+ */
2609
+ removeFromFaction(faction: number | string): boolean;
2610
+
2611
+ /**
2612
+ * Names the NPC on every player's copy, as a named ped in a FiveM resource: the crosshair, its health bar and its dialogue show the name in place of its record's ("Settler", "Raider"), as a reference's ExtraTextDisplayData does.
2613
+ * @param name What it is called, up to 47 bytes of UTF-8; null or an empty string gives it back its record's own name.
2614
+ * @returns True when sent; false when the NPC is gone.
2615
+ */
2616
+ setName(name: string | null): boolean;
2617
+
2618
+ /**
2619
+ * Stops what the game does when a player activates the NPC (its greeting, its dialogue, a trade), as ObjectReference.BlockActivation does, on every player's copy: `npcActivate` is still raised, so a script answers with its own interaction, as FiveM resources do for a ped.
2620
+ * @param blocked True to stop the game's own activation, false to give it back.
2621
+ * @returns True when sent; false when the NPC is gone.
2622
+ */
2623
+ setActivationBlocked(blocked: boolean): boolean;
2624
+
2625
+ /**
2626
+ * Makes the NPC unhurtable by players and NPCs, as FiveM's SetEntityInvincible does a ped: every player's copy is a ghost (Actor.SetGhost), which shots, blows and explosions pass over, and the server drops any hit still reported on it. The script's own `damage` and `kill` still go through.
2627
+ * @param invulnerable True to make it unhurtable, false to make it hurtable again.
2628
+ * @returns True when sent; false when the NPC is gone.
2629
+ */
2630
+ setInvulnerable(invulnerable: boolean): boolean;
2631
+
2632
+ /**
2633
+ * Plays an idle animation on the NPC, as FiveM's TaskPlayAnim does a ped and `Player.playIdle` a player: every player's copy plays it. The idle's own conditions apply, so one meant for another skeleton, a piece of furniture or a state the NPC is not in does nothing, and the NPC's own AI may cut it short. `stopIdle` ends it.
2634
+ * @param idle An idle animation (IDLE) by editor ID, such as `"IdleWave"`, or form ID.
2635
+ * @returns True when sent; false when the NPC is dead or gone. Throws for a form no IDLE record has.
2636
+ */
2637
+ playIdle(idle: number | string): boolean;
2638
+
2639
+ /**
2640
+ * Has the NPC speak, voice and subtitle, as FiveM's PlayPedAmbientSpeechNative does a ped and Papyrus ObjectReference.Say an actor: every player near it hears the same line. A topic's line is picked by the game running the NPC among those whose conditions pass for it (its voice type, its faction), and the others say that one; a topic with no line for this NPC says nothing. Most generic topics have no editor ID: give their form ID.
2641
+ * @param line A dialogue topic (DIAL) by form ID or editor ID, such as `0x47895`, a raider's idle chatter, or one line of a topic (INFO) by form ID.
2642
+ * @returns True when sent; false when the NPC is dead or gone. Throws for a form no DIAL or INFO record has.
2643
+ */
2644
+ say(line: number | string): boolean;
2645
+
2646
+ /**
2647
+ * Ends the idle animation the NPC plays, on every player's copy.
2648
+ * @returns True when sent; false when the NPC is dead or gone.
2649
+ */
2650
+ stopIdle(): boolean;
2651
+
2652
+ /**
2653
+ * Dresses the NPC, as FiveM's SetPedComponentVariation does a ped: every player's copy wears the pieces, locked, each over what the NPC's record gives it in the same body slots. It lasts while the NPC does, through respawns.
2654
+ * @param armors Up to 12 armor pieces or clothes (ARMO) by form ID or editor ID, such as `"Armor_Raider_Underarmor"`; null or an empty list gives it back its own clothes.
2655
+ * @returns True when sent; false when the NPC is gone. Throws for a piece no ARMO record has.
2656
+ */
2657
+ setOutfit(armors: (number | string)[] | null): boolean;
2658
+
2659
+ /**
2660
+ * Arms the NPC, as FiveM's GiveWeaponToPed does a ped: every player's copy carries the weapon with ammunition and wears it locked, so the game that runs it fights with it and everyone sees it. It lasts while the NPC does, through respawns.
2661
+ * @param weapon A weapon (WEAP) by form ID or editor ID, such as `"Minigun"`; null hands the NPC back its own.
2662
+ * @returns True when sent; false when the NPC is gone. Throws for a form no WEAP record has.
2663
+ */
2664
+ giveWeapon(weapon: number | string | null): boolean;
2665
+
2666
+ /**
2667
+ * Drops the order `attack` gave: the NPC stops fighting, as Actor.StopCombat does.
2668
+ * @returns True when it had one.
2669
+ */
2670
+ stopAttacking(): boolean;
2671
+
1376
2672
  /**
1377
2673
  * Moves the NPC within its space. Left alone, it wanders back toward its placement over time.
1378
2674
  * @param position Where to, in the NPC's own space.
@@ -1381,6 +2677,24 @@ declare global {
1381
2677
  */
1382
2678
  teleport(position: Vector3, heading?: number): boolean;
1383
2679
 
2680
+ /**
2681
+ * The NPCs around a point or a player, nearest first, as FiveM scripts walk the ped pool or ask GetClosestPed: where a script finds the shopkeeper by a door or the raiders near a camp. Positions are the ones the simulators last reported.
2682
+ * @param center A point, or a player, whose position and space are then the search's.
2683
+ * @param radius How far from it, in game units.
2684
+ * @param options `space`: where a point is, the Commonwealth when left out. `limit`: how many at most, 32 by default, never more than 512. `includeDead`: count the dead too.
2685
+ * @returns Empty when none is in range, or the player is gone. Throws for a center that is neither, or a negative radius.
2686
+ */
2687
+ static getInRange(center: Vector3 | Player, radius: number, options?: { space?: { worldSpace: number } | { interiorCell: number }; limit?: number; includeDead?: boolean }): Npc[];
2688
+
2689
+ /**
2690
+ * Makes a new NPC, as a FiveM script creates a ped: every player's game builds it, a client near it runs it with the game's own AI and the server walks it while nobody is near, as it does the placed ones. Unique, essential and quest actors are each player's own: spawn generic ones. It stays dead when killed (`npcDeath` is raised) until `respawn` puts it back where it was spawned.
2691
+ * @param base What to make: an NPC record (NPC_) or a leveled list of them (LVLN, rolled here), by form ID or editor ID, such as `"LCharRaider"` or `"EncRaider01"`.
2692
+ * @param position Where it stands, in game units.
2693
+ * @param options `heading` in radians around Z (0 faces +Y); `space` the worldspace or interior cell, the Commonwealth when left out.
2694
+ * @returns The new NPC; null when a leveled list rolled to nothing. Throws for a base that is no NPC_ or LVLN record.
2695
+ */
2696
+ static spawn(base: number | string, position: Vector3, options?: { heading?: number; space?: { worldSpace: number } | { interiorCell: number } }): Npc | null;
2697
+
1384
2698
  /**
1385
2699
  * Every NPC the server took over.
1386
2700
  * @returns One handle per NPC; empty when the server could not read the game's data files.
@@ -1448,15 +2762,16 @@ declare global {
1448
2762
  getSpace(): PlayerSpace | null;
1449
2763
 
1450
2764
  /**
1451
- * Builds an object for everyone, as if a player had at that workbench. Nothing is checked: not the recipe, its cost nor the buildable area.
2765
+ * Builds an object for everyone, as if a player had at that workbench. Nothing is checked: not the recipe, its cost nor the buildable area. A wire is laid out between its two ends on every client once both are loaded, and linked into their power grid.
1452
2766
  * @param form The base object to build.
1453
2767
  * @param workbench The workbench reference it belongs to, placed by the data files.
1454
2768
  * @param position Where it stands.
1455
2769
  * @param space The worldspace, or the interior cell: exactly one of the two.
1456
2770
  * @param angle Its rotation, radians.
2771
+ * @param wire For a wire (the game's workshop spline), the two objects it joins: a built object, or a placed reference's form ID, each with the connect point the wire takes on it (0 by default).
1457
2772
  * @returns The object, or null when it could not be created.
1458
2773
  */
1459
- static place(form: number | string, workbench: number | string, position: Vector3, space: { worldSpace?: number | string; interiorCell?: number | string }, angle?: Vector3): WorkshopItem | null;
2774
+ static place(form: number | string, workbench: number | string, position: Vector3, space: { worldSpace?: number | string; interiorCell?: number | string }, angle?: Vector3, wire?: { from: WorkshopItem | number | string; to: WorkshopItem | number | string; fromPoint?: number; toPoint?: number }): WorkshopItem | null;
1460
2775
 
1461
2776
  /**
1462
2777
  * Every object built this session.
@@ -2306,31 +3621,31 @@ declare global {
2306
3621
  /**
2307
3622
  * Broadcasts a named event to every connected client's shared Events handlers.
2308
3623
  * @param eventName Client shared-event name.
2309
- * @param payload Optional string payload sent verbatim; other values are JSON-serialized.
3624
+ * @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
3625
  */
2311
3626
  emitAllClients(eventName: string, payload?: unknown): void;
2312
3627
 
2313
3628
  /**
2314
3629
  * Registers a persistent server handler for events originating from clients; this namespace is isolated from native events.
2315
3630
  * @param eventName Case-sensitive event name.
2316
- * @param handler Resource-owned callback invoked with the emitted arguments.
3631
+ * @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
3632
  * @returns Function that removes this exact subscription.
2318
3633
  */
2319
- onClient(eventName: string, handler: EventHandler): Unsubscribe;
3634
+ onClient(eventName: string, handler: (player: Player, payload?: unknown) => unknown | Promise<unknown>): Unsubscribe;
2320
3635
 
2321
3636
  /**
2322
3637
  * Registers a one-shot server handler for a client-originated event.
2323
3638
  * @param eventName Case-sensitive event name.
2324
- * @param handler Resource-owned callback invoked with the emitted arguments.
3639
+ * @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
3640
  */
2326
- onceClient(eventName: string, handler: EventHandler): void;
3641
+ onceClient(eventName: string, handler: (player: Player, payload?: unknown) => unknown | Promise<unknown>): void;
2327
3642
 
2328
3643
  /**
2329
3644
  * Removes a matching client-originated event handler owned by the calling resource.
2330
3645
  * @param eventName Case-sensitive event name.
2331
- * @param handler Resource-owned callback invoked with the emitted arguments.
3646
+ * @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
3647
  */
2333
- offClient(eventName: string, handler: EventHandler): void;
3648
+ offClient(eventName: string, handler: (player: Player, payload?: unknown) => unknown | Promise<unknown>): void;
2334
3649
  }
2335
3650
 
2336
3651
  /**
@@ -2621,6 +3936,11 @@ declare global {
2621
3936
  */
2622
3937
  readonly discordId: string;
2623
3938
 
3939
+ /**
3940
+ * Discord username the client reported, or an empty string when it had none.
3941
+ */
3942
+ readonly discordName: string;
3943
+
2624
3944
  /**
2625
3945
  * Framework hardware identifier the client reported, or an empty string when it had none.
2626
3946
  */
@@ -2791,6 +4111,11 @@ declare global {
2791
4111
  */
2792
4112
  readonly discordId: string;
2793
4113
 
4114
+ /**
4115
+ * Discord username the client reported, not verified by the server, or an empty string when unavailable.
4116
+ */
4117
+ readonly discordName: string;
4118
+
2794
4119
  /**
2795
4120
  * Framework hardware identifier, or an empty string when unavailable.
2796
4121
  */