@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.
- package/generated/client-api.d.ts +828 -9
- package/generated/server-api.d.ts +1483 -158
- package/package.json +1 -1
|
@@ -15,6 +15,11 @@ declare global {
|
|
|
15
15
|
*/
|
|
16
16
|
menuClose: [name: string];
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Dispatched when what lies under the crosshair changes, as the activation prompt follows it: the reference now there and the one before, 0 for none, and, when the new one is another player's body or an NPC, its network ID as the server knows it.
|
|
20
|
+
*/
|
|
21
|
+
crosshairChange: [ref: number, previous: number, entity: number | null];
|
|
22
|
+
|
|
18
23
|
/**
|
|
19
24
|
* Dispatched once when the local player goes down. The server decides when they come back.
|
|
20
25
|
*/
|
|
@@ -80,6 +85,11 @@ declare global {
|
|
|
80
85
|
*/
|
|
81
86
|
inventoryChange: [changes: InventoryDelta[]];
|
|
82
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Dispatched when the local player activates a reference: the Activate button, a prompt, a pick-up. `ref` is the placed reference's form ID, `base` its base object's. It tells of the attempt, which the game may still refuse; a reference with an activate parent raises one for the parent first. To stop an activation, block it beforehand with References.setActivationBlocked or Controls.setEnabled.
|
|
90
|
+
*/
|
|
91
|
+
activate: [ref: number, base: number];
|
|
92
|
+
|
|
83
93
|
/**
|
|
84
94
|
* Dispatched when the local player opens or closes a door the session shares, as the server is told. `ref` is the placed reference's form ID.
|
|
85
95
|
*/
|
|
@@ -120,11 +130,31 @@ declare global {
|
|
|
120
130
|
*/
|
|
121
131
|
workshopMove: [form: number, position: { x: number; y: number; z: number }];
|
|
122
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Dispatched when the local player enters workshop mode at a workbench (`entering`) and when they leave it. `workbench` is the workbench reference's form ID.
|
|
135
|
+
*/
|
|
136
|
+
workshopMode: [workbench: number, entering: boolean];
|
|
137
|
+
|
|
123
138
|
/**
|
|
124
139
|
* Dispatched when the local player scraps or stores a built object the session shares.
|
|
125
140
|
*/
|
|
126
141
|
workshopRemove: [form: number];
|
|
127
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Dispatched when the sky switches its current weather: a change the server made, this player's own, or one the game rolled, starting its fade or snapping to it. `previous` is the weather it leaves, 0 for none. The fade itself goes on for up to a game hour; `World.getSky` follows it.
|
|
145
|
+
*/
|
|
146
|
+
weatherChange: [weather: number, previous: number];
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Dispatched when lightning strikes in the sky: a flash and a thunderclap, with the flash's brightness from 0 to 1. In a session every player's sky strikes together, on the server's word.
|
|
150
|
+
*/
|
|
151
|
+
lightning: [flash: number];
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Dispatched when the game finds the player under another weather region as they change cell: the TESRegion form ID whose weathers the sky would roll, 0 for none. The server hears it too (`playerWeatherRegionChange`).
|
|
155
|
+
*/
|
|
156
|
+
weatherRegionChange: [region: number, previous: number];
|
|
157
|
+
|
|
128
158
|
/**
|
|
129
159
|
* Dispatched after a resource entry point has run and immediately before the resource becomes running.
|
|
130
160
|
*/
|
|
@@ -199,6 +229,26 @@ declare global {
|
|
|
199
229
|
* Dispatched on view creation and whenever Web.loadURL re-locks an owned view to a different origin.
|
|
200
230
|
*/
|
|
201
231
|
browserOriginChange: [event: BrowserOriginChangeEvent];
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Dispatched for every chat line the server sends. An empty author is a notice line; color is packed 0xRRGGBBAA, 0 for the chat box's default.
|
|
235
|
+
*/
|
|
236
|
+
chatMessage: [message: { author: string; text: string; color: number }];
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Dispatched synchronously for a line the player typed into the chat box, before it is sent. A handler returning false, not a Promise of it, blocks it; Chat.send does not raise this.
|
|
240
|
+
*/
|
|
241
|
+
chatSend: [text: string];
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Dispatched when the local player starts speaking, as isTalking turns true.
|
|
245
|
+
*/
|
|
246
|
+
voiceStart: [];
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Dispatched when the local player stops speaking, as isTalking turns false.
|
|
250
|
+
*/
|
|
251
|
+
voiceStop: [];
|
|
202
252
|
}
|
|
203
253
|
|
|
204
254
|
/** Names of native events available in this scripting environment. */
|
|
@@ -215,6 +265,108 @@ declare global {
|
|
|
215
265
|
*/
|
|
216
266
|
notify(message: string, sound?: string): void;
|
|
217
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Plays a Vault Boy clip on the HUD, the animation a perk shows when it triggers, as Game.ShowPerkVaultBoyOnHUD does.
|
|
270
|
+
* @param swf The clip's path under Interface, such as "Components/VaultBoys/Perks/PerkClip_1d247c.swf".
|
|
271
|
+
* @param sound A sound descriptor's editor ID to play with it, such as "UIPerkRicochet".
|
|
272
|
+
* @returns False when the path is empty or the sound is not one the game knows; the clip still plays without it.
|
|
273
|
+
*/
|
|
274
|
+
showVaultBoy(swf: string, sound?: string): boolean;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Shows a place name on the HUD, as the game does on coming up to a location the player knows: a zone a script defines announces itself this way.
|
|
278
|
+
* @param name The name to show.
|
|
279
|
+
* @returns False for an empty name.
|
|
280
|
+
*/
|
|
281
|
+
showLocation(name: string): boolean;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Turns one of the HUD's own modes on or off, as Game.SetInsideMemoryHUDMode and Game.SetCharGenHUDMode do for theirs: the HUD shows, hides and restyles its parts by the modes that are on. A mode a script turned on stays until it turns it off; the game switches its own as before.
|
|
285
|
+
* @param mode The mode's name as the game knows it: "PowerArmor", "InsideMemory", "DialogueMode", "IronSights", "VATS", "WorkshopMode", "CharGen_Init" and the like.
|
|
286
|
+
* @param on On or off.
|
|
287
|
+
* @returns False for an empty name. A name the HUD does not know changes nothing.
|
|
288
|
+
*/
|
|
289
|
+
setMode(mode: string, on: boolean): boolean;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Flashes the hit marker around the crosshair, as the game does when a sneak attack or a critical lands: the cue for a hit the server confirmed.
|
|
293
|
+
*/
|
|
294
|
+
showHitMarker(): void;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* What the HUD's ammo counter shows: the rounds in the weapon and the rounds carried besides.
|
|
298
|
+
* @returns Null while the HUD shows no counter: no gun in hand.
|
|
299
|
+
*/
|
|
300
|
+
getAmmo(): { clip: number; reserve: number } | null;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* What the HUD's enemy health bar shows for the actor the player is aiming at: its name, its health from 0 to 100, the bar's second meter, and whether it is hostile, legendary or far above the player's level.
|
|
304
|
+
* @returns Null while the HUD shows no bar: nobody under the crosshair.
|
|
305
|
+
*/
|
|
306
|
+
getEnemyHealth(): { name: string; healthPercent: number; secondaryPercent: number; hostile: boolean; legendary: boolean; skull: boolean } | null;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* What the HUD's activation prompt shows for what the player looks at: its name, the label of the activate button and of the second button, whether activating is enabled, the legendary and tagged-for-search icons, and whether activating would be a crime.
|
|
310
|
+
* @returns Null while the HUD shows no prompt.
|
|
311
|
+
*/
|
|
312
|
+
getRollover(): { name: string; activateText: string; secondaryText: string; activateEnabled: boolean; legendary: boolean; taggedForSearch: boolean; crime: boolean } | null;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* The arcs the HUD's hit indicator shows: for each recent hit, the angle to the attacker in radians, where an attacker straight ahead reads about -pi/2, and a strength that starts at 100 and fades.
|
|
316
|
+
* @returns Empty while the HUD shows none.
|
|
317
|
+
*/
|
|
318
|
+
getHitIndicators(): { angle: number; strength: number }[];
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* The markers the HUD's explosive indicator shows: for each grenade or mine near the player, whether it is a placed explosive, how far it is in game units and the angle to it in radians, where straight ahead reads about -pi/2.
|
|
322
|
+
* @returns Empty while the HUD shows none.
|
|
323
|
+
*/
|
|
324
|
+
getExplosiveIndicators(): { placed: boolean; distance: number; angle: number }[];
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* What the HUD's experience meter last showed: the amount it printed, its fill, and whether it announced a level.
|
|
328
|
+
* @returns Null until the meter has come up once.
|
|
329
|
+
*/
|
|
330
|
+
getExperienceMeter(): { amount: number; percent: number; levelUp: boolean } | null;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* The icons the HUD's active effects widget shows: four arrays, one per effect category, each holding the indices of the icons lit.
|
|
334
|
+
*/
|
|
335
|
+
getActiveEffectIcons(): number[][];
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* What the HUD's radiation meter holds: the rads it displays, their share of a lethal dose, and how many radiation sources reach the player. Each is null until the game has set it.
|
|
339
|
+
* @returns Null before the HUD exists.
|
|
340
|
+
*/
|
|
341
|
+
getRadiation(): { rads: number | null; lethalShare: number | null; sources: number | null } | null;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Whether the HUD still has corner messages to show or on screen, as its notification model was last told: a script can wait for the corner to clear before it shows its own.
|
|
345
|
+
*/
|
|
346
|
+
hasMessages(): boolean;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Keeps the health or the action point bar on the HUD. The game hides each while it is full and nothing touches it; this holds one up until it is let go.
|
|
350
|
+
* @param meter Which bar.
|
|
351
|
+
* @param shown Kept up, or left to the HUD again.
|
|
352
|
+
*/
|
|
353
|
+
setMeterShown(meter: "health" | "actionPoints", shown: boolean): void;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Blinks the health or the action point bar, as the game blinks the action points when an attack needs more than are left. A bar the HUD is hiding blinks unseen: keep it up with `setMeterShown` first.
|
|
357
|
+
* @param meter Which bar.
|
|
358
|
+
* @returns False when the game has no such actor value.
|
|
359
|
+
*/
|
|
360
|
+
flashMeter(meter: "health" | "actionPoints"): boolean;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Shows a quest objective line on the HUD with any text, alone or under a banner shown just before, with the game's own sound and timing.
|
|
364
|
+
* @param text The line's text, shown as given: the game's own completed and failed lines open with "Completed: " and "Failed: ".
|
|
365
|
+
* @param kind A new objective, by default, or one drawn as done.
|
|
366
|
+
* @returns False when the quest that lends the objective is not loaded.
|
|
367
|
+
*/
|
|
368
|
+
showObjective(text: string, kind?: "added" | "completed" | "failed"): boolean;
|
|
369
|
+
|
|
218
370
|
/**
|
|
219
371
|
* Shows the HUD's quest banner with any text. Banners queue behind the game's own. False when the quest that lends the icon is not loaded.
|
|
220
372
|
* @param text The banner's text.
|
|
@@ -268,6 +420,14 @@ declare global {
|
|
|
268
420
|
* The game's own menus, message boxes and dialogue wheel.
|
|
269
421
|
*/
|
|
270
422
|
const Ui: {
|
|
423
|
+
/**
|
|
424
|
+
* Plays a Bink video over the game, as Game.PlayBink does: an intro, a cutscene between rounds. `Ui.hideMenu("PlayBinkMenu")` ends it early; `Ui.isMenuOpen("PlayBinkMenu")` tells when it is over.
|
|
425
|
+
* @param file The video's file name under Data/Video, such as "Intro.bk2": a name alone, no path.
|
|
426
|
+
* @param options Whether a key ends it (default false), whether it is letterboxed (default true), and whether the game's sound and music are silenced while it plays (default true).
|
|
427
|
+
* @returns False for an empty name or one that is not a bare file name.
|
|
428
|
+
*/
|
|
429
|
+
playVideo(file: string, options?: { interruptible?: boolean; letterbox?: boolean; muteAudio?: boolean; muteMusic?: boolean }): boolean;
|
|
430
|
+
|
|
271
431
|
/**
|
|
272
432
|
* Opens a game menu by name. Takes effect next frame; an unknown name does nothing.
|
|
273
433
|
* @param name The menu's registered name, such as "PipboyMenu".
|
|
@@ -447,6 +607,50 @@ declare global {
|
|
|
447
607
|
*/
|
|
448
608
|
getFov(): { horizontal: number; vertical: number } | null;
|
|
449
609
|
|
|
610
|
+
/**
|
|
611
|
+
* Sets the field of view the world renders with, as FiveM's SetCamFov and the console's fov do: a zoom for a cutscene, a fish-eye for a drunk effect. It holds through camera changes until set again; the game's own comes back with null or when the session ends. The player's own settings are not touched.
|
|
612
|
+
* @param degrees The horizontal field of view, 10 to 160 degrees; null for the game's own.
|
|
613
|
+
* @returns False before the world is built.
|
|
614
|
+
*/
|
|
615
|
+
setFov(degrees: number | null): boolean;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Takes the camera from the player and puts it where the script says, as FiveM's CreateCam, SetCamCoord, PointCamAtCoord and RenderScriptCams do: a cutscene shot, a security camera, an intro flight. The player's controls move neither the camera nor their body while it is up: their movement, looking, jumping and fighting are held off, and their body keeps its heading. Called again it moves: a script tweens it by calling every tick. It is given back with null, when the resource that set it stops, or when the session ends.
|
|
619
|
+
* @param view Where the camera stands, and where it looks: a rotation in radians (pitch positive down, yaw 0 facing +Y, clockwise) or a point to face. Null gives the player their camera back.
|
|
620
|
+
* @returns False when there is no player in a cell, or the console's fly camera holds the camera.
|
|
621
|
+
*/
|
|
622
|
+
setView(view: { position: Vector3; rotation?: { pitch: number; yaw: number }; lookAt?: Vector3 } | null): boolean;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Whether the player's camera is in its first-person state.
|
|
626
|
+
* @returns False in third person and in every other state: the fly camera, furniture, a scripted camera.
|
|
627
|
+
*/
|
|
628
|
+
isFirstPerson(): boolean;
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Puts the player's camera in first person, as Game.ForceFirstPerson does. The game only does it while the camera follows the player.
|
|
632
|
+
* @returns False before the camera exists.
|
|
633
|
+
*/
|
|
634
|
+
forceFirstPerson(): boolean;
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Makes the camera follow another body in third person, as Game.SetCameraTarget does: what a spectator mode is built on. The player's own body stays where it is and still takes its input; the camera comes back by itself when the body followed leaves this game.
|
|
638
|
+
* @param entityId The network ID of a player or an NPC, as the server knows it (`player.id`); null for the player's own body.
|
|
639
|
+
* @returns False when no such player or NPC has a body loaded here.
|
|
640
|
+
*/
|
|
641
|
+
setTarget(entityId: number | null): boolean;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* The network ID of the body the camera was told to follow; null while it follows the player's own.
|
|
645
|
+
*/
|
|
646
|
+
getTarget(): number | null;
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Puts the player's camera in third person, as Game.ForceThirdPerson does. The game refuses from some states, such as furniture, and waits for an open menu to close.
|
|
650
|
+
* @returns False before the camera exists.
|
|
651
|
+
*/
|
|
652
|
+
forceThirdPerson(): boolean;
|
|
653
|
+
|
|
450
654
|
/**
|
|
451
655
|
* The game's back buffer, in pixels: the space worldToScreen answers in.
|
|
452
656
|
*/
|
|
@@ -459,6 +663,72 @@ declare global {
|
|
|
459
663
|
* @param z World units.
|
|
460
664
|
*/
|
|
461
665
|
worldToScreen(x: number, y: number, z: number): { x: number; y: number; onScreen: boolean } | null;
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* What lies under the crosshair, as the game picks it for the activation prompt, the activate button and VATS: the reference, the network ID of the player or NPC it stands for when it is one, and how far it is from the player in game units.
|
|
669
|
+
* @returns Null with nothing under the crosshair. It is the activation pick: an actor is under it only when the game offers to activate it, so another player's body never is; Camera.raycast strikes it.
|
|
670
|
+
*/
|
|
671
|
+
getCrosshairTarget(): { ref: number; entity: number | null; distance: number } | null;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* What the player is aiming at: World.raycast from the camera through the middle of the screen, where the crosshair sits, in first or third person. Unlike getCrosshairTarget it strikes anything solid, other players' bodies included.
|
|
675
|
+
* @param distance How far to look, in game units; 10000 when left out.
|
|
676
|
+
* @param options As World.raycast's: the actor whose body the ray passes over, the local player by default.
|
|
677
|
+
* @returns As World.raycast's; null before the world is built or the player is in a cell.
|
|
678
|
+
*/
|
|
679
|
+
raycast(distance?: number, options?: { ignore?: number | string | null }): { hit: boolean; position: Vector3; normal: Vector3; fraction: number; ref: number | null; entity: number | null } | null;
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* The game's own tuning values (game settings, GMST) in this player's game: how high a jump goes, how fast a sprint is, what a lock costs to pick. The game reads them where they stand, so a change takes effect at once, for this player alone; a server sets the same on every client to make it a rule. What a script changed goes back to what it was when the session ends.
|
|
684
|
+
*/
|
|
685
|
+
const GameSettings: {
|
|
686
|
+
/**
|
|
687
|
+
* A game setting's value.
|
|
688
|
+
* @param name The setting's name as the game's data defines it: "fJumpHeightMin", "fSprintSpeedMult", "iMaxCharacterLevel". The first letter says what it holds: f a number, i and u a whole number, b a boolean, s a text.
|
|
689
|
+
* @returns Null when the game has no setting of that name.
|
|
690
|
+
*/
|
|
691
|
+
get(name: string): number | boolean | string | null;
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Changes a game setting for this player's game, until the session ends.
|
|
695
|
+
* @param name The setting's name as the game's data defines it: "fJumpHeightMin", "fSprintSpeedMult", "iMaxCharacterLevel". The first letter says what it holds: f a number, i and u a whole number, b a boolean, s a text.
|
|
696
|
+
* @param value The new value, of the setting's kind.
|
|
697
|
+
* @returns False when the game has no setting of that name, it holds a text, or the value is not of its kind.
|
|
698
|
+
*/
|
|
699
|
+
set(name: string, value: number | boolean): boolean;
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* The local player's controls, on a layer of the game's own input locks: a control the game itself holds off stays off.
|
|
704
|
+
*/
|
|
705
|
+
const Controls: {
|
|
706
|
+
/**
|
|
707
|
+
* Turns one control off or back on. Everything comes back on disconnect.
|
|
708
|
+
* @param control Which control.
|
|
709
|
+
* @param enabled False holds it off.
|
|
710
|
+
* @returns False when the game had no free layer.
|
|
711
|
+
*/
|
|
712
|
+
setEnabled(control: "movement" | "looking" | "fighting" | "sneaking" | "menu" | "jumping" | "journal" | "activate" | "fastTravel" | "camSwitch" | "vats" | "favorites" | "zKey" | "running" | "sprinting", enabled: boolean): boolean;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Whether every layer, the game's included, lets the control through.
|
|
716
|
+
* @param control Which control.
|
|
717
|
+
* @returns True when it is on.
|
|
718
|
+
*/
|
|
719
|
+
isEnabled(control: "movement" | "looking" | "fighting" | "sneaking" | "menu" | "jumping" | "journal" | "activate" | "fastTravel" | "camSwitch" | "vats" | "favorites" | "zKey" | "running" | "sprinting"): boolean;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Whether a script holds the control off, whatever the game's own layers do.
|
|
723
|
+
* @param control Which control.
|
|
724
|
+
* @returns True when setEnabled turned it off.
|
|
725
|
+
*/
|
|
726
|
+
isDisabledByScripts(control: "movement" | "looking" | "fighting" | "sneaking" | "menu" | "jumping" | "journal" | "activate" | "fastTravel" | "camSwitch" | "vats" | "favorites" | "zKey" | "running" | "sprinting"): boolean;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Gives back everything scripts held off.
|
|
730
|
+
*/
|
|
731
|
+
reset(): void;
|
|
462
732
|
};
|
|
463
733
|
|
|
464
734
|
/**
|
|
@@ -517,9 +787,59 @@ declare global {
|
|
|
517
787
|
};
|
|
518
788
|
|
|
519
789
|
/**
|
|
520
|
-
*
|
|
790
|
+
* Effects only the local player sees and feels: screen and controller effects, and explosions, shaders, visual effects and impacts in this game alone. Fades are on Hud.fade; the server's `Explosion` and `Effect` play for everyone.
|
|
521
791
|
*/
|
|
522
792
|
const Effects: {
|
|
793
|
+
/**
|
|
794
|
+
* Sets off an explosion in this game alone. Its blast hurts what this game simulates.
|
|
795
|
+
* @param explosion A BGSExplosion (EXPL) form ID.
|
|
796
|
+
* @param position Where it goes off, in the player's space.
|
|
797
|
+
* @param options `scale` of its radii, `damage` a multiplier of its damage (0 for a harmless one); 1 by default.
|
|
798
|
+
* @returns False when there is no such explosion, or the spot is not loaded here.
|
|
799
|
+
*/
|
|
800
|
+
explode(explosion: number | string, position: Vector3, options?: { scale?: number; damage?: number }): boolean;
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Plays an effect shader on a reference in this game alone, as EffectShader.Play does.
|
|
804
|
+
* @param ref A reference or actor of this game by form ID: 0x14 for the player, `References.getEntityBody` for another player or an NPC.
|
|
805
|
+
* @param shader A TESEffectShader (EFSH) form ID.
|
|
806
|
+
* @param seconds How long; until stopShader when left out.
|
|
807
|
+
* @returns False when the reference is not loaded here or the form is no shader.
|
|
808
|
+
*/
|
|
809
|
+
playShader(ref: number | string, shader: number | string, seconds?: number): boolean;
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Stops an effect shader on a reference.
|
|
813
|
+
* @param ref A reference or actor of this game by form ID: 0x14 for the player, `References.getEntityBody` for another player or an NPC.
|
|
814
|
+
* @param shader The shader played.
|
|
815
|
+
*/
|
|
816
|
+
stopShader(ref: number | string, shader: number | string): void;
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* Attaches a visual effect to a reference in this game alone, as VisualEffect.Play does.
|
|
820
|
+
* @param ref A reference or actor of this game by form ID: 0x14 for the player, `References.getEntityBody` for another player or an NPC.
|
|
821
|
+
* @param effect A BGSReferenceEffect (RFCT) form ID.
|
|
822
|
+
* @param seconds How long; until stopVisual when left out.
|
|
823
|
+
* @returns False when the reference is not loaded here or the form is no visual effect.
|
|
824
|
+
*/
|
|
825
|
+
playVisual(ref: number | string, effect: number | string, seconds?: number): boolean;
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Takes a visual effect off a reference.
|
|
829
|
+
* @param ref A reference or actor of this game by form ID: 0x14 for the player, `References.getEntityBody` for another player or an NPC.
|
|
830
|
+
* @param effect The visual effect played.
|
|
831
|
+
*/
|
|
832
|
+
stopVisual(ref: number | string, effect: number | string): void;
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Plays an impact where a ray from the reference lands, in this game alone, as ObjectReference.PlayImpactEffect does.
|
|
836
|
+
* @param ref A reference or actor of this game by form ID: 0x14 for the player, `References.getEntityBody` for another player or an NPC.
|
|
837
|
+
* @param impactSet A BGSImpactDataSet (IPDS) form ID.
|
|
838
|
+
* @param options The ray: from the named node (the root when left out), along the direction (straight down by default), for the length in game units (512).
|
|
839
|
+
* @returns False when the reference is not loaded here or the ray hit nothing.
|
|
840
|
+
*/
|
|
841
|
+
playImpact(ref: number | string, impactSet: number | string, options?: { node?: string; direction?: Vector3; length?: number }): boolean;
|
|
842
|
+
|
|
523
843
|
/**
|
|
524
844
|
* Applies an image space modifier, as ImageSpaceModifier.Apply does; it runs its own length, and is removed once this resource stops. False when there is no such modifier or no world to run it in.
|
|
525
845
|
* @param modifier An image space modifier (IMAD): its editor ID, or its form ID (a number, or a string starting 0x).
|
|
@@ -748,6 +1068,182 @@ declare global {
|
|
|
748
1068
|
*/
|
|
749
1069
|
getOutfit(): OutfitPiece[];
|
|
750
1070
|
|
|
1071
|
+
/**
|
|
1072
|
+
* Whether the player's Pip-Boy light is on.
|
|
1073
|
+
* @returns False before the player exists.
|
|
1074
|
+
*/
|
|
1075
|
+
isPipboyLightOn(): boolean;
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Turns the player's Pip-Boy light on or off, as the light key does, without its sound.
|
|
1079
|
+
* @param on On or off.
|
|
1080
|
+
* @returns False before the player stands in the world.
|
|
1081
|
+
*/
|
|
1082
|
+
setPipboyLight(on: boolean): boolean;
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Holds the player's weapon out or away, as FiveM's SetCurrentPedWeapon forces a ped's: drawn or holstered at once, then kept so against the ready-weapon key and the game. With no weapon in hand, out raises the fists. `Controls.setEnabled("fighting", false)` stops attacks too.
|
|
1086
|
+
* @param drawn True to hold the weapon out, false to keep it away, null to hand it back to the player.
|
|
1087
|
+
*/
|
|
1088
|
+
setWeaponDrawn(drawn: boolean | null): void;
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Loads rounds into the weapon in the player's hands, as FiveM's SetAmmoInClip does a ped's. The rounds come from those the player carries, as a reload takes them: never more than they have; the server's `player.giveItem` gives more.
|
|
1092
|
+
* @param rounds The rounds to load, 0 to 100000; more than the weapon's clip loads a full clip.
|
|
1093
|
+
* @returns False without a weapon that loads ammo in hand.
|
|
1094
|
+
*/
|
|
1095
|
+
setClipAmmo(rounds: number): boolean;
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* 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. It comes back when the session ends.
|
|
1099
|
+
* @param enabled False to take the player's collision away, true to give it back.
|
|
1100
|
+
*/
|
|
1101
|
+
setCollision(enabled: boolean): void;
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Rebuilds the player on another race, as the console's setrace and Actor.SetRace do: a ghoul. Every other player sees their puppet rebuilt the same way; their head parts stay their own. Only human and ghoul are supported; any other race is refused. The race they had comes back with null, and when the session ends.
|
|
1105
|
+
* @param race 0x13746 (HumanRace) or 0xEAFB6 (GhoulRace); null for the race the player had.
|
|
1106
|
+
* @returns False when the player is not standing in the world.
|
|
1107
|
+
*/
|
|
1108
|
+
setRace(race: number | string | null): boolean;
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* Whether the player has their collision: false after setCollision(false) or the console's tcl.
|
|
1112
|
+
*/
|
|
1113
|
+
isCollisionEnabled(): boolean;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Puts the player into a piece of furniture at once, wherever they stand, as Actor.SnapIntoInteraction does: a chair seats them, a bed lays them down, once its animations are loaded. A seated player stands up by moving; one lying in a bed is there until leaveFurniture.
|
|
1117
|
+
* @param furniture The furniture reference: a chair, a bed, a workbench.
|
|
1118
|
+
* @returns False before the player stands in the world, while they are down or dead, when the furniture is not loaded here or would not take them.
|
|
1119
|
+
*/
|
|
1120
|
+
useFurniture(furniture: number | string): boolean;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Has the player get up from the furniture they are in, or stop making for it.
|
|
1124
|
+
* @returns False when they are in none.
|
|
1125
|
+
*/
|
|
1126
|
+
leaveFurniture(): boolean;
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Whether the player is in a piece of furniture: seated, lying asleep, or on their way in or out of one.
|
|
1130
|
+
*/
|
|
1131
|
+
getFurnitureState(): "none" | "sitting" | "sleeping" | "moving";
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* Holds the player in place, as Actor.SetRestrained does: they stand where they are and neither move nor act until let go. Cuffs, a stun, a cutscene.
|
|
1135
|
+
* @param restrained Held, or let go.
|
|
1136
|
+
* @returns False before the player stands in the world, or while they are down or dead.
|
|
1137
|
+
*/
|
|
1138
|
+
setRestrained(restrained: boolean): boolean;
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Knocks the player off their feet into their ragdoll, as ObjectReference.PushActorAway does: they fall, lie a moment and get up by themselves. Every other player sees them fall and get up.
|
|
1142
|
+
* @param force How hard they are thrown, as ObjectReference.PushActorAway takes it; 0, the default, drops them where they stand.
|
|
1143
|
+
* @param from The point they are thrown away from; their own position by default.
|
|
1144
|
+
* @returns False before the player stands in the world, while they are dead, down already, bleeding out, held in place or in furniture.
|
|
1145
|
+
*/
|
|
1146
|
+
knockDown(force?: number, from?: { x: number; y: number; z: number }): boolean;
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Where the game places the points of the player's body, in world units: the height of the eyes above the feet in the current pose and the standing height the game keeps for the player, the point others look at, and the four points the game keeps on the body, from the eyes down.
|
|
1150
|
+
* @returns Null while the player is not in the world.
|
|
1151
|
+
*/
|
|
1152
|
+
getBodyPoints(): { eyeLevel: number; standingEyeHeight: number; lookAt: Vector3; parts: Vector3[] } | null;
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* The player's critical meter as the game holds it: the charge towards the next stored critical, how many are stored and how many can be.
|
|
1156
|
+
* @returns Null before the player exists.
|
|
1157
|
+
*/
|
|
1158
|
+
getCritMeter(): { charge: number; stored: number; max: number } | null;
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* Whether the player is knocked down: in their ragdoll or getting up from it, by a script or by the game, a blast for one.
|
|
1162
|
+
*/
|
|
1163
|
+
isKnockedDown(): boolean;
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* Puts the player into the game's bleedout, or gets them out of it: down on the ground and alive, the camera pulled out, the controls held, as a downed companion is. Every other player sees them down. Nothing kills them there, as nothing kills a downed companion; they stay until a script gets them up or the session ends, and get up at full health.
|
|
1167
|
+
* @param bleedingOut True to go down, false to get back up.
|
|
1168
|
+
* @returns False before the player stands in the world, while they are dead or held in place.
|
|
1169
|
+
*/
|
|
1170
|
+
setBleedingOut(bleedingOut: boolean): boolean;
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Whether the player is in the game's bleedout.
|
|
1174
|
+
*/
|
|
1175
|
+
isBleedingOut(): boolean;
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Whether the player is held in place by `setRestrained`.
|
|
1179
|
+
*/
|
|
1180
|
+
isRestrained(): boolean;
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Plays a holotape recording in the player's Pip-Boy, in place of the one in it, without the loading animation: the radio goes quiet while it runs, as when the player loads one. Seen and heard in this game alone.
|
|
1184
|
+
* @param holotape The holotape's form ID. It need not be carried.
|
|
1185
|
+
* @returns False when the form is no holotape, holds no recording (a game or a terminal tape), or would not start.
|
|
1186
|
+
*/
|
|
1187
|
+
playHolotape(holotape: number | string): boolean;
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Stops the player's holotape and takes it out.
|
|
1191
|
+
* @returns False when there was none.
|
|
1192
|
+
*/
|
|
1193
|
+
stopHolotape(): boolean;
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* The holotape in the player's Pip-Boy and whether it runs now; null for none.
|
|
1197
|
+
*/
|
|
1198
|
+
getHolotape(): { form: number; playing: boolean } | null;
|
|
1199
|
+
|
|
1200
|
+
/**
|
|
1201
|
+
* The named location the player is in, a BGSLocation form ID, as ObjectReference.GetCurrentLocation reads it.
|
|
1202
|
+
* @returns Null in the open, where the game names no location.
|
|
1203
|
+
*/
|
|
1204
|
+
getLocation(): number | null;
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Where the player's own map marker is: the waypoint dropped on the Pip-Boy map.
|
|
1208
|
+
* @returns Null while there is none.
|
|
1209
|
+
*/
|
|
1210
|
+
getMapWaypoint(): { x: number; y: number; z: number } | null;
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* Drops the player's own map marker, or takes it off, as they would on the Pip-Boy map: the server's `playerMapWaypoint` hears of it and may put back what was there.
|
|
1214
|
+
* @param position Where to, in the space the player stands in; null takes it off.
|
|
1215
|
+
* @returns False before the player stands in the world.
|
|
1216
|
+
*/
|
|
1217
|
+
setMapWaypoint(position: { x: number; y: number; z: number } | null): boolean;
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* Asks to fast travel to a reference, as picking it on the Pip-Boy map does: the server's `playerFastTravel` decides, and the player travels when no script refuses.
|
|
1221
|
+
* @param destination The reference to arrive at: a map marker, or any other placed reference.
|
|
1222
|
+
* @returns True when asked; false when the reference is not here or the player does not stand in the world.
|
|
1223
|
+
*/
|
|
1224
|
+
fastTravel(destination: number | string): boolean;
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Draws the player's body more or less see-through in this game, as Actor.SetAlpha does. Other players' games are not told.
|
|
1228
|
+
* @param alpha 0, invisible, to 1, opaque.
|
|
1229
|
+
* @param fade Fade there rather than cut (default false).
|
|
1230
|
+
* @returns False before the player stands in the world.
|
|
1231
|
+
*/
|
|
1232
|
+
setAlpha(alpha: number, fade?: boolean): boolean;
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Whether the game holds the player invulnerable: setInvulnerable, or the game's own god mode.
|
|
1236
|
+
* @returns False before the player exists.
|
|
1237
|
+
*/
|
|
1238
|
+
isInvulnerable(): boolean;
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Makes the player a ghost, as Actor.SetGhost does: attacks in their own game pass through them, and their game refuses the hits other players' games land on them.
|
|
1242
|
+
* @param invulnerable The flag.
|
|
1243
|
+
* @returns False before the player exists.
|
|
1244
|
+
*/
|
|
1245
|
+
setInvulnerable(invulnerable: boolean): boolean;
|
|
1246
|
+
|
|
751
1247
|
/**
|
|
752
1248
|
* The power armor frame the player wears.
|
|
753
1249
|
* @returns Null when they wear none, and outside a session.
|
|
@@ -852,26 +1348,101 @@ declare global {
|
|
|
852
1348
|
}
|
|
853
1349
|
|
|
854
1350
|
/**
|
|
855
|
-
* The
|
|
1351
|
+
* The local player's workshop mode: the settlement build mode a workbench opens.
|
|
1352
|
+
*/
|
|
1353
|
+
const Workshop: {
|
|
1354
|
+
/**
|
|
1355
|
+
* The workbench the player's workshop mode runs on, its reference's form ID.
|
|
1356
|
+
* @returns Null outside workshop mode.
|
|
1357
|
+
*/
|
|
1358
|
+
getCurrent(): number | null;
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* Puts the player in workshop mode on a workbench, wherever they stand, as ObjectReference.StartWorkshop does.
|
|
1362
|
+
* @param workbench A workbench reference loaded in this game.
|
|
1363
|
+
* @returns False when it is no loaded workbench or the player is in workshop mode already.
|
|
1364
|
+
*/
|
|
1365
|
+
enter(workbench: number | string): boolean;
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* Ends workshop mode, as leaving its menu does; the game does it on its next frame.
|
|
1369
|
+
* @returns False outside workshop mode.
|
|
1370
|
+
*/
|
|
1371
|
+
leave(): boolean;
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* The server's clock, calendar and sky, as this client holds them, and what the sky is doing right now. Read-only: the server's `World`, `Player.setWeather` and `Player.setHour` set them.
|
|
856
1376
|
*/
|
|
857
1377
|
const World: {
|
|
858
1378
|
/**
|
|
859
|
-
* The game hour the server keeps, 0 to 24.
|
|
1379
|
+
* The game hour the server keeps, 0 to 24; the player's own while a script holds their clock.
|
|
860
1380
|
* @returns Null before the server's world streams in.
|
|
861
1381
|
*/
|
|
862
1382
|
getHour(): number | null;
|
|
863
1383
|
|
|
864
1384
|
/**
|
|
865
|
-
* Game minutes per real minute; 0 holds the clock.
|
|
1385
|
+
* Game minutes per real minute; 0 holds the clock, as it is while a script holds the player's own hour.
|
|
866
1386
|
* @returns Null before the server's world streams in.
|
|
867
1387
|
*/
|
|
868
1388
|
getTimeScale(): number | null;
|
|
869
1389
|
|
|
870
1390
|
/**
|
|
871
|
-
* The
|
|
1391
|
+
* The calendar date the server keeps: the full year, the month 1 to 12, the day of the month.
|
|
1392
|
+
* @returns Null before the server's world streams in.
|
|
1393
|
+
*/
|
|
1394
|
+
getDate(): { year: number; month: number; day: number } | null;
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* Whole days the server's clock has run, the game's GameDaysPassed.
|
|
1398
|
+
* @returns Null before the server's world streams in.
|
|
1399
|
+
*/
|
|
1400
|
+
getDaysPassed(): number | null;
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* The TESWeather form ID the server holds the sky to: the player's own while a script gave them one, else the World's.
|
|
872
1404
|
* @returns Null while the region decides the weather, and before the server's world streams in.
|
|
873
1405
|
*/
|
|
874
1406
|
getWeather(): number | null;
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* What the game's sky and clock show right now: the weather it is in or fading to, the one it fades from (null once the fade is done), the override it is held to, how far the fade is from 0 to 1, the game's own hour and day count, whether the whole sky is drawn (outdoors; indoors there is none to fade), and the region whose weathers the sky would roll where the player stands.
|
|
1410
|
+
* @returns Null before the game's data files are loaded.
|
|
1411
|
+
*/
|
|
1412
|
+
getSky(): { weather: number | null; outgoing: number | null; override: number | null; transition: number; hour: number; daysPassed: number; full: boolean; region: number | null } | null;
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* The wind the sky is blowing right now: its speed from 0 to 1, the weather's direction in degrees and how many degrees it may swing either side, and the direction the sky drew within that swing, in degrees: the same on every player's sky in a session.
|
|
1416
|
+
* @returns Null before the sky exists.
|
|
1417
|
+
*/
|
|
1418
|
+
getWind(): { speed: number; angle: number; angleRange: number; direction: number } | null;
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* What a weather is, from this game's data: its kind, its wind from 0 to 1, where its fog starts and ends by day and by night in game units, and the precipitation and screen effect it comes with.
|
|
1422
|
+
* @param weather A weather (WTHR) by form ID; the one the sky is in or moving to when left out.
|
|
1423
|
+
* @returns Null when the form is not a weather, or the sky has none yet.
|
|
1424
|
+
*/
|
|
1425
|
+
getWeatherInfo(weather?: number | string): { weather: number; kind: "none" | "pleasant" | "cloudy" | "rain" | "snow"; windSpeed: number; fog: { dayNear: number; dayFar: number; nightNear: number; nightFar: number; dayPower: number; nightPower: number; dayMax: number; nightMax: number }; precipitation: number | null; visualEffect: number | null } | null;
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
* Casts a ray through the physics world the player stands in and tells what it struck first, testing what a bullet's impact would: the ground, buildings, props, clutter and the bodies of actors, passing over the player's own unless the options say otherwise.
|
|
1429
|
+
* @param from Where the ray starts, in game units.
|
|
1430
|
+
* @param to Where it ends.
|
|
1431
|
+
* @param options `ignore`: an actor (form ID in this game, as `References.getEntityBody` gives one) whose own body the ray passes over; the local player when left out, nobody for null.
|
|
1432
|
+
* @returns Whether it struck something before `to`; where; the surface's unit normal there; how far along the ray, 0 to 1; the reference hit (null for the landscape); and, when that is another player's body or an NPC, its network ID as the server knows it (`player.id`, `npc.id`). Without a hit the position is `to`, the fraction 1 and the normal zero. Null before the player is in a cell.
|
|
1433
|
+
*/
|
|
1434
|
+
raycast(from: Vector3, to: Vector3, options?: { ignore?: number | string | null }): { hit: boolean; position: Vector3; normal: Vector3; fraction: number; ref: number | null; entity: number | null } | null;
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* What the player's own game holds of their quests. Read-only: the server's `Quests` gives quests and sets their objectives.
|
|
1439
|
+
*/
|
|
1440
|
+
const Quests: {
|
|
1441
|
+
/**
|
|
1442
|
+
* Every objective the player's game holds that is not hidden, as its quest log has it.
|
|
1443
|
+
* @returns One entry per objective: the quest's form ID, the objective's index in it and its state. Empty before the player is in the world.
|
|
1444
|
+
*/
|
|
1445
|
+
getObjectives(): { quest: number; index: number; state: "displayed" | "completed" | "failed" }[];
|
|
875
1446
|
};
|
|
876
1447
|
|
|
877
1448
|
/**
|
|
@@ -883,6 +1454,248 @@ declare global {
|
|
|
883
1454
|
* @returns One entry per station, in no particular order; empty outside a session.
|
|
884
1455
|
*/
|
|
885
1456
|
getStations(): { name: string; frequency: number }[];
|
|
1457
|
+
|
|
1458
|
+
/**
|
|
1459
|
+
* Whether the player's Pip-Boy radio is on, as Game.IsPlayerRadioOn reads it.
|
|
1460
|
+
* @returns False while it is off or the player has no radio.
|
|
1461
|
+
*/
|
|
1462
|
+
isOn(): boolean;
|
|
1463
|
+
|
|
1464
|
+
/**
|
|
1465
|
+
* Turns the player's Pip-Boy radio on or off, as Game.TurnPlayerRadioOn does.
|
|
1466
|
+
* @param on On or off.
|
|
1467
|
+
*/
|
|
1468
|
+
setOn(on: boolean): void;
|
|
1469
|
+
|
|
1470
|
+
/**
|
|
1471
|
+
* The frequency the player's Pip-Boy radio is tuned to, as Game.GetPlayerRadioFrequency reads it.
|
|
1472
|
+
* @returns 0 while the player has no radio.
|
|
1473
|
+
*/
|
|
1474
|
+
getFrequency(): number;
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Tunes the player's Pip-Boy radio, as Game.SetPlayerRadioFrequency does.
|
|
1478
|
+
* @param frequency A station's frequency, as getStations lists it.
|
|
1479
|
+
*/
|
|
1480
|
+
setFrequency(frequency: number): void;
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* The state of a placed reference in this player's game alone. Nothing here reaches another player: a script that wants everyone to agree tells each client.
|
|
1485
|
+
*/
|
|
1486
|
+
const References: {
|
|
1487
|
+
/**
|
|
1488
|
+
* Has the local player activate the reference, wherever they stand, as ObjectReference.Activate does: a door opens, an item is picked up, a container shows its menu. Raises `activate` like any other.
|
|
1489
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1490
|
+
* @param defaultProcessingOnly Skip what the reference's own scripts would do about it (default false).
|
|
1491
|
+
* @returns False when the reference is not loaded here or the game activated nothing.
|
|
1492
|
+
*/
|
|
1493
|
+
activate(ref: number | string, defaultProcessingOnly?: boolean): boolean;
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* What a reference is and where it stands: the form ID of the base object it is placed from, its position in world units and its rotation in radians about the X, Y and Z axes.
|
|
1497
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1498
|
+
* @returns Null when the reference is not here.
|
|
1499
|
+
*/
|
|
1500
|
+
getInfo(ref: number | string): { base: number; position: { x: number; y: number; z: number }; rotation: { x: number; y: number; z: number } } | null;
|
|
1501
|
+
|
|
1502
|
+
/**
|
|
1503
|
+
* The placed references around the player, nearest first: what a script looks the world up by before it reads or changes a reference. It walks the cells loaded in this game, so call it when needed, not every frame. Actors are not references here.
|
|
1504
|
+
* @param base The base object the references are placed from, such as a container's or a door's form ID; null for any.
|
|
1505
|
+
* @param radius How far from the player, in world units.
|
|
1506
|
+
* @param limit How many at most (default 32, never more than 512).
|
|
1507
|
+
* @returns Empty before the player stands in the world, or when the base is no form.
|
|
1508
|
+
*/
|
|
1509
|
+
find(base: number | string | null, radius: number, limit?: number): number[];
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Sends an animation event to the reference's behavior graph, as ObjectReference.PlayAnimation does: a machine starts, a prop moves, without the activation and what it would trigger. Seen in this game alone. Only objects animated by a behavior graph take one; `getAnimationGraph` tells which are.
|
|
1513
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1514
|
+
* @param event The animation event's name, as the object's behavior graph knows it.
|
|
1515
|
+
* @returns False when the reference is not loaded here or no graph of its took the event.
|
|
1516
|
+
*/
|
|
1517
|
+
playAnimation(ref: number | string, event: string): boolean;
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* The name of the behavior graph that animates the reference, the one `playAnimation` sends its events to.
|
|
1521
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1522
|
+
* @returns Null when the reference is not loaded here or no behavior graph animates it.
|
|
1523
|
+
*/
|
|
1524
|
+
getAnimationGraph(ref: number | string): string | null;
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Says whether the physics moves an object, as ObjectReference.SetMotionType does: freeze a crate in mid-air, or let a fixed prop fall. In this game alone.
|
|
1528
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1529
|
+
* @param type Dynamic: the physics moves it, so it falls and can be pushed. Keyframed: it stays where it is put, whatever hits it.
|
|
1530
|
+
* @returns False when the reference is not loaded here, its model has no physics, or it is an actor.
|
|
1531
|
+
*/
|
|
1532
|
+
setMotionType(ref: number | string, type: "dynamic" | "keyframed"): boolean;
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Pushes an object the physics moves, as ObjectReference.ApplyHavokImpulse does: a can flies, a crate slides. In this game alone, as its physics are.
|
|
1536
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1537
|
+
* @param direction Which way to push, in world axes; its length does not matter.
|
|
1538
|
+
* @param magnitude How hard, as ObjectReference.ApplyHavokImpulse takes it; the game scales it by the object's mass.
|
|
1539
|
+
* @returns False when the reference is not loaded here or nothing of it is a physics body. A body the physics holds fixed takes the push and stays where it is.
|
|
1540
|
+
*/
|
|
1541
|
+
applyImpulse(ref: number | string, direction: { x: number; y: number; z: number }, magnitude: number): boolean;
|
|
1542
|
+
|
|
1543
|
+
/**
|
|
1544
|
+
* The form ID of the actor that stands for another player or an NPC in this game: what `openTrade` and `showBarterMenu` take. A session's players and NPCs are this game's own copies, so the reference ID the server knows an NPC by is not theirs; this one is good only here and only while the body is loaded.
|
|
1545
|
+
* @param entityId The network ID of a player or an NPC, as the server knows it (`player.id`, `npc.id`).
|
|
1546
|
+
* @returns Null for the local player and for an entity with no body loaded here.
|
|
1547
|
+
*/
|
|
1548
|
+
getEntityBody(entityId: number): number | null;
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* Holds an actor in place, as Actor.SetRestrained does: it stays as it is and its own behavior stops until it is let go. It holds while this game simulates the actor.
|
|
1552
|
+
* @param actor The actor's form ID in this game, as `getEntityBody` gives it.
|
|
1553
|
+
* @param restrained Held, or let go.
|
|
1554
|
+
* @returns False when the actor is not loaded here, or is down or dead.
|
|
1555
|
+
*/
|
|
1556
|
+
setActorRestrained(actor: number | string, restrained: boolean): boolean;
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* Puts an actor into a piece of furniture at once, without walking to it, as Actor.SnapIntoInteraction does: a chair seats it, a bed lays it down asleep. It lasts while this game simulates the actor and its own behavior leaves it there.
|
|
1560
|
+
* @param actor The actor's form ID in this game, as `getEntityBody` gives it.
|
|
1561
|
+
* @param furniture The furniture reference: a chair, a bed, a workbench.
|
|
1562
|
+
* @returns False when the actor or the furniture is not loaded here, or the furniture would not take it.
|
|
1563
|
+
*/
|
|
1564
|
+
useFurniture(actor: number | string, furniture: number | string): boolean;
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* Opens the game's container menu on a container, wherever the player stands, as activating it does but without its lock or its opening animation. In a session the server's `containerOpen` runs first and the menu opens once it lets the player in, holding what a server script filled the container with there: a stash or a shop of the player's own.
|
|
1568
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1569
|
+
* @returns False when the reference is not loaded here or is no container, when another player has it open, or while this player has a container open.
|
|
1570
|
+
*/
|
|
1571
|
+
openContainer(ref: number | string): boolean;
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* Opens the give-and-take screen on an actor, the one the game shows for a companion, as Actor.OpenInventory does when forced.
|
|
1575
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1576
|
+
* @returns False when the reference is no actor loaded here.
|
|
1577
|
+
*/
|
|
1578
|
+
openTrade(ref: number | string): boolean;
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* Opens the game's barter screen on an actor, as Actor.ShowBarterMenu does: it sells what the game works out as that actor's vendor stock.
|
|
1582
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1583
|
+
* @returns False when the reference is no actor loaded here.
|
|
1584
|
+
*/
|
|
1585
|
+
showBarterMenu(ref: number | string): boolean;
|
|
1586
|
+
|
|
1587
|
+
/**
|
|
1588
|
+
* An actor value on the reference, as ObjectReference.GetValue reads it. A workbench keeps its settlement's figures this way: its build budget, its population, its power.
|
|
1589
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1590
|
+
* @param value An ActorValueInfo form ID.
|
|
1591
|
+
* @returns Null when the reference is not here or the form ID is no actor value.
|
|
1592
|
+
*/
|
|
1593
|
+
getValue(ref: number | string, value: number | string): number | null;
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Sets an actor value on the reference, as ObjectReference.SetValue does.
|
|
1597
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1598
|
+
* @param value An ActorValueInfo form ID.
|
|
1599
|
+
* @param amount The new value.
|
|
1600
|
+
* @returns False when the reference is not here or the form ID is no actor value.
|
|
1601
|
+
*/
|
|
1602
|
+
setValue(ref: number | string, value: number | string, amount: number): boolean;
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* A map marker's state on this player's map: whether it shows, whether it is a fast travel destination, and its icon type. The server changes it with `Player.discoverLocations` and `forgetLocations`.
|
|
1606
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1607
|
+
* @returns Null when the reference is not here or is no map marker.
|
|
1608
|
+
*/
|
|
1609
|
+
getMapMarker(ref: number | string): { visible: boolean; canTravel: boolean; type: number } | null;
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Whether the reference is in this game with its 3D loaded.
|
|
1613
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1614
|
+
* @returns False when it is not here.
|
|
1615
|
+
*/
|
|
1616
|
+
isLoaded(ref: number | string): boolean;
|
|
1617
|
+
|
|
1618
|
+
/**
|
|
1619
|
+
* The reference's scale, 1 being its normal size.
|
|
1620
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1621
|
+
* @returns Null when it is not here.
|
|
1622
|
+
*/
|
|
1623
|
+
getScale(ref: number | string): number | null;
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* Scales the reference.
|
|
1627
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1628
|
+
* @param scale 0.01 to 10.
|
|
1629
|
+
* @returns False when it is not here.
|
|
1630
|
+
*/
|
|
1631
|
+
setScale(ref: number | string, scale: number): boolean;
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* The level a pick attempt on the reference's lock faces.
|
|
1635
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1636
|
+
* @returns Null when it is not here or has no lock.
|
|
1637
|
+
*/
|
|
1638
|
+
getLockLevel(ref: number | string): number | null;
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* Sets the level of the reference's lock; one with no lock gets an unlocked one.
|
|
1642
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1643
|
+
* @param level 0 to 255.
|
|
1644
|
+
* @returns False when it is not here.
|
|
1645
|
+
*/
|
|
1646
|
+
setLockLevel(ref: number | string, level: number): boolean;
|
|
1647
|
+
|
|
1648
|
+
/**
|
|
1649
|
+
* The game's destroyed flag.
|
|
1650
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1651
|
+
* @returns False when it is not here.
|
|
1652
|
+
*/
|
|
1653
|
+
isDestroyed(ref: number | string): boolean;
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* Sets the game's destroyed flag: a destroyed reference cannot be activated.
|
|
1657
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1658
|
+
* @param destroyed The flag.
|
|
1659
|
+
* @returns False when it is not here.
|
|
1660
|
+
*/
|
|
1661
|
+
setDestroyed(ref: number | string, destroyed: boolean): boolean;
|
|
1662
|
+
|
|
1663
|
+
/**
|
|
1664
|
+
* Whether a flora or produce reference is picked.
|
|
1665
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1666
|
+
* @returns False when it is not here.
|
|
1667
|
+
*/
|
|
1668
|
+
isHarvested(ref: number | string): boolean;
|
|
1669
|
+
|
|
1670
|
+
/**
|
|
1671
|
+
* Shows a flora or produce reference picked, or grown back.
|
|
1672
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1673
|
+
* @param harvested The flag.
|
|
1674
|
+
* @returns False when it is not here or is neither.
|
|
1675
|
+
*/
|
|
1676
|
+
setHarvested(ref: number | string, harvested: boolean): boolean;
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* Whether activating the reference is refused.
|
|
1680
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1681
|
+
* @returns False when it is not here.
|
|
1682
|
+
*/
|
|
1683
|
+
isActivationBlocked(ref: number | string): boolean;
|
|
1684
|
+
|
|
1685
|
+
/**
|
|
1686
|
+
* Whether the reference is in the world: false once ObjectReference.Disable, a quest's enable parent or the server's `Objects.setEnabled` took it out.
|
|
1687
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1688
|
+
* @returns Null when this game holds no such reference now.
|
|
1689
|
+
*/
|
|
1690
|
+
isEnabled(ref: number | string): boolean | null;
|
|
1691
|
+
|
|
1692
|
+
/**
|
|
1693
|
+
* Blocks or allows activating the reference.
|
|
1694
|
+
* @param ref The reference's form ID: a placed object, or an actor's, such as a body getEntityBody, World.raycast or the crosshair gives.
|
|
1695
|
+
* @param blocked The flag.
|
|
1696
|
+
* @returns False when it is not here.
|
|
1697
|
+
*/
|
|
1698
|
+
setActivationBlocked(ref: number | string, blocked: boolean): boolean;
|
|
886
1699
|
};
|
|
887
1700
|
|
|
888
1701
|
/**
|
|
@@ -1695,7 +2508,7 @@ declare global {
|
|
|
1695
2508
|
/**
|
|
1696
2509
|
* Sends a named event from this client to the server's isolated onClient handlers.
|
|
1697
2510
|
* @param eventName Server-side client-event name.
|
|
1698
|
-
* @param payload Optional string
|
|
2511
|
+
* @param payload Optional payload. A string is sent as is and must already be JSON text: the server parses it and drops an event that does not parse. Other values are JSON-serialized.
|
|
1699
2512
|
*/
|
|
1700
2513
|
emitServer(eventName: string, payload?: unknown): void;
|
|
1701
2514
|
}
|
|
@@ -2436,6 +3249,12 @@ declare global {
|
|
|
2436
3249
|
*/
|
|
2437
3250
|
getUserId(): string;
|
|
2438
3251
|
|
|
3252
|
+
/**
|
|
3253
|
+
* Returns the signed-in Discord user's username.
|
|
3254
|
+
* @returns Username string, or an empty string until available.
|
|
3255
|
+
*/
|
|
3256
|
+
getUsername(): string;
|
|
3257
|
+
|
|
2439
3258
|
/**
|
|
2440
3259
|
* Checks whether Discord is connected and can publish presence.
|
|
2441
3260
|
* @returns True when rich presence is initialized.
|
|
@@ -2514,7 +3333,7 @@ declare global {
|
|
|
2514
3333
|
getPushToTalkKey(): string;
|
|
2515
3334
|
|
|
2516
3335
|
/**
|
|
2517
|
-
* Sets how long transmission continues after push-to-talk is released, so letting go slightly early does not clip the end of a word. Muting, turning voice off and
|
|
3336
|
+
* Sets how long transmission continues after push-to-talk is released, so letting go slightly early does not clip the end of a word. Muting, turning voice off and starting to type into a text field still stop it at once.
|
|
2518
3337
|
* @param milliseconds How long to keep transmitting after the key goes up. Clamped to 0..2000.
|
|
2519
3338
|
*/
|
|
2520
3339
|
setPushToTalkReleaseDelay(milliseconds: number): void;
|
|
@@ -2562,8 +3381,8 @@ declare global {
|
|
|
2562
3381
|
getActivationThreshold(): number;
|
|
2563
3382
|
|
|
2564
3383
|
/**
|
|
2565
|
-
* Reads how loud the microphone is
|
|
2566
|
-
* @returns Smoothed level from 0 to 1
|
|
3384
|
+
* Reads how loud the microphone is while this player is sending voice. The microphone stays open for the whole session, so what it hears the rest of the time is not given to scripts.
|
|
3385
|
+
* @returns Smoothed level from 0 to 1 while isTalking is true; 0 otherwise.
|
|
2567
3386
|
*/
|
|
2568
3387
|
getInputLevel(): number;
|
|
2569
3388
|
|