@kingdomsconnected/types 1.5.0

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.
@@ -0,0 +1,4112 @@
1
+ import type { Color, EventHandler, KeyHandler, MessageHandler, MessageReply, NativeClipHandler, NativeElementHandler, NativeScreenHandler, PlacementHandler, Quaternion, Unsubscribe, Vector2, Vector3, WebEventHandler } from "../shared.js";
2
+
3
+ declare global {
4
+ /**
5
+ * Native events dispatched through `Events.on`. Each property is the exact callback argument tuple for that event.
6
+ */
7
+ interface EventMap {
8
+ /**
9
+ * Dispatched when this player starts or stops following a server quest in the game's journal, whichever way it happened: the track button, the game auto-tracking a quest that turns active, or the untrack that follows finishing or failing one. Local to this machine and raised before the server is told; the server raises its own `questTrackingChanged` when the report arrives. Repeats are filtered, so it only fires on an actual change. Handler promises are not awaited.
10
+ */
11
+ questTrackingChanged: [questKey: string, tracked: boolean];
12
+
13
+ /**
14
+ * Dispatched when the game's trade screen actually comes up on this machine for a server vendor -- not when the server asked for it, which can take a few frames or fail. `npc` is the network ID of the NPC keeping the shop, or null when nobody does. Every `vendorOpened` is followed by exactly one `vendorClosed`.
15
+ */
16
+ vendorOpened: [session: number, npc: number | null];
17
+
18
+ /**
19
+ * Dispatched when a trade screen that `vendorOpened` announced goes away: the player closed it, the server closed it, the server opened another vendor over it, the level changed under it, or the connection ended. A screen that never came up raises neither event. The server raises its own `vendorClosed` for the session.
20
+ */
21
+ vendorClosed: [session: number, reason: "player" | "server" | "replaced" | "levelChange" | "sessionOver"];
22
+
23
+ /**
24
+ * Dispatched after an accepted silent POI discovery. Handler promises are not awaited. Unchanged statuses emit nothing.
25
+ */
26
+ poiDiscovered: [poiId: LocationId];
27
+
28
+ /**
29
+ * Dispatched when the map screen comes up at this machine.
30
+ */
31
+ mapOpened: [];
32
+
33
+ /**
34
+ * Dispatched when the map screen goes away.
35
+ */
36
+ mapClosed: [];
37
+
38
+ /**
39
+ * Dispatched when the player drops their own marker on the map, or moves the one already down -- `moved` separates the two, because the game uses one action for both. The position is world-space metres. Maps reuse one coordinate range, which is why `mapId` travels with it.
40
+ */
41
+ mapWaypointSet: [position: Vector3, mapId: number, moved: boolean];
42
+
43
+ /**
44
+ * Dispatched when the player takes their marker off the map, including through `WorldMap.clearWaypoint`. It carries where the marker was, since afterwards nothing says.
45
+ */
46
+ mapWaypointCleared: [position: Vector3, mapId: number];
47
+
48
+ /**
49
+ * Dispatched when the flight starts and when it ends, on this machine only. Handler promises are not awaited.
50
+ *
51
+ * `reason` is `script` on the way in. On the way out it is `script` for a resource ending it, `mapEditor` for F7 taking the one camera, `viewLost` for the level going away underneath the camera's anchor, and `sessionOver` for the session ending.
52
+ */
53
+ noclipChanged: [active: boolean, reason: "script" | "mapEditor" | "viewLost" | "sessionOver"];
54
+
55
+ /**
56
+ * Dispatched after a resource entry point has run and immediately before the resource becomes running.
57
+ */
58
+ resourceStart: [resourceName: string];
59
+
60
+ /**
61
+ * Dispatched while a resource is stopping, before its stop callback, timers, exports and event handlers are cleaned up.
62
+ */
63
+ resourceStop: [resourceName: string];
64
+
65
+ /**
66
+ * Dispatched when one key of an entity's state changes: on the server when a script writes it, on a client when the write arrives. `value` is undefined when the key was removed and `previous` is undefined when it held nothing before, so a stored null stays distinguishable from an absent key. The entity is whatever the game's WrapScriptEntity answers, and the base Entity handle by default.
67
+ */
68
+ entityStateChange: [entity: Entity, key: string, value: any, previous: any];
69
+
70
+ /**
71
+ * Dispatched once per view, before any navigation, to the resource that created it.
72
+ */
73
+ browserCreated: [event: BrowserCreatedEvent];
74
+
75
+ /**
76
+ * Dispatched when any frame of an owned view begins loading.
77
+ */
78
+ browserLoadingStart: [event: BrowserLoadingStartEvent];
79
+
80
+ /**
81
+ * Dispatched when an owned view's main document is ready; the earliest point at which the page can receive Web.emit.
82
+ */
83
+ browserDocumentReady: [event: BrowserDocumentReadyEvent];
84
+
85
+ /**
86
+ * Dispatched when a frame of an owned view fails to load.
87
+ */
88
+ browserLoadingFailed: [event: BrowserLoadingFailedEvent];
89
+
90
+ /**
91
+ * Dispatched for every navigation an owned view is asked to perform, refused or not.
92
+ */
93
+ browserNavigate: [event: BrowserNavigateEvent];
94
+
95
+ /**
96
+ * Dispatched when an owned view blocks a popup; windowless views cannot host one, so handle the URL yourself.
97
+ */
98
+ browserPopup: [event: BrowserPopupEvent];
99
+
100
+ /**
101
+ * Dispatched when an owned view's requested cursor shape changes.
102
+ */
103
+ browserCursorChange: [event: BrowserCursorChangeEvent];
104
+
105
+ /**
106
+ * Dispatched when an owned view requests a tooltip; windowless rendering draws none, so the script must.
107
+ */
108
+ browserTooltip: [event: BrowserTooltipEvent];
109
+
110
+ /**
111
+ * Dispatched when focus enters or leaves an editable element of an owned view; use it to stop routing keys to the game.
112
+ */
113
+ browserInputFocusChange: [event: BrowserInputFocusChangeEvent];
114
+
115
+ /**
116
+ * Dispatched when an owned view rejects a navigation or a page event from outside its locked origin.
117
+ */
118
+ browserResourceBlocked: [event: BrowserResourceBlockedEvent];
119
+
120
+ /**
121
+ * Dispatched for console output of an owned view; the framework logs these regardless.
122
+ */
123
+ browserConsoleMessage: [event: BrowserConsoleMessageEvent];
124
+
125
+ /**
126
+ * Dispatched on view creation and whenever Web.loadURL re-locks an owned view to a different origin.
127
+ */
128
+ browserOriginChange: [event: BrowserOriginChangeEvent];
129
+ }
130
+
131
+ /** Names of native events available in this scripting environment. */
132
+ type EventName = keyof EventMap;
133
+
134
+ /**
135
+ * How a player's body looks: four of the game's own character-component names, and the gender whose catalog they come from.
136
+ *
137
+ * A part left out, or set to an empty string, means "leave that one alone" -- the body keeps whatever it would have had. An appearance with every part empty is the default body, which is what everyone wears until something chooses otherwise.
138
+ */
139
+ interface Appearance {
140
+ /**
141
+ * Which half of the game's character-component tree the four names come from. Not one of the four: a body's gender comes from its soul, and a name from one tree means nothing under the other, so this travels with them and is applied first.
142
+ */
143
+ gender: "male" | "female";
144
+
145
+ /**
146
+ * The skin: complexion and build. One of `Appearances.options("body", gender)`, or empty.
147
+ */
148
+ body: string;
149
+
150
+ /**
151
+ * The face. One of `Appearances.options("head", gender)`, or empty.
152
+ */
153
+ head: string;
154
+
155
+ /**
156
+ * The hairstyle, including its colour -- the game ships each style recoloured rather than colouring one. One of `Appearances.options("hair", gender)`, or empty.
157
+ */
158
+ hair: string;
159
+
160
+ /**
161
+ * The beard. Male only -- the female tree has none -- and one of `Appearances.beards(head)`, or empty.
162
+ *
163
+ * Not every beard goes with every face: they are modelled per head, and a body asked for a pair that was never modelled refuses the whole appearance rather than quietly losing the beard.
164
+ */
165
+ beard: string;
166
+ }
167
+
168
+ /**
169
+ * One entry of the game's character-component tree: something a body can be given for one part.
170
+ */
171
+ interface AppearanceOption {
172
+ /**
173
+ * What to put in the part. This is the game's own node name.
174
+ */
175
+ name: string;
176
+
177
+ /**
178
+ * Which part it fills.
179
+ */
180
+ part: "body" | "head" | "hair" | "beard";
181
+
182
+ /**
183
+ * Which tree it came out of. An option is only valid on a body of the same gender.
184
+ */
185
+ gender: "male" | "female";
186
+
187
+ /**
188
+ * The option this one is a variation of, or null when it stands on its own. The game ships a hairstyle once per colour, all derived from the same style node, so grouping by this is what turns 262 hairstyles into a list somebody can read.
189
+ */
190
+ group: string | null;
191
+ }
192
+
193
+ /**
194
+ * The three character attributes a body's soul carries, in the game's own units.
195
+ */
196
+ interface SoulStats {
197
+ /**
198
+ * Attribute value, or 0 while the body has published no soul.
199
+ */
200
+ strength: number;
201
+
202
+ /**
203
+ * Attribute value, or 0 while the body has published no soul.
204
+ */
205
+ agility: number;
206
+
207
+ /**
208
+ * Attribute value, or 0 while the body has published no soul.
209
+ */
210
+ vitality: number;
211
+ }
212
+
213
+ /**
214
+ * The nine skills a hit or a draw is evaluated against, in the game's own units.
215
+ */
216
+ interface SoulSkills {
217
+ /**
218
+ * Skill level, or 0 while the body has published no soul.
219
+ */
220
+ fencing: number;
221
+
222
+ /**
223
+ * Skill level, or 0 while the body has published no soul.
224
+ */
225
+ survival: number;
226
+
227
+ /**
228
+ * Skill level, or 0 while the body has published no soul.
229
+ */
230
+ defense: number;
231
+
232
+ /**
233
+ * Skill level, or 0 while the body has published no soul.
234
+ */
235
+ sword: number;
236
+
237
+ /**
238
+ * Skill level, or 0 while the body has published no soul.
239
+ */
240
+ heavyWeapons: number;
241
+
242
+ /**
243
+ * Skill level, or 0 while the body has published no soul.
244
+ */
245
+ marksmanship: number;
246
+
247
+ /**
248
+ * Skill level, or 0 while the body has published no soul.
249
+ */
250
+ dagger: number;
251
+
252
+ /**
253
+ * Skill level, or 0 while the body has published no soul.
254
+ */
255
+ largeWeapons: number;
256
+
257
+ /**
258
+ * Skill level, or 0 while the body has published no soul.
259
+ */
260
+ unarmed: number;
261
+ }
262
+
263
+ /**
264
+ * What the game's own tables say about one status effect.
265
+ */
266
+ interface BuffInfo {
267
+ /**
268
+ * The name the game's own buff tables give the effect, and the spelling every buff verb takes.
269
+ */
270
+ name: string;
271
+
272
+ /**
273
+ * The kind of effect it is -- `poison`, `alcohol`, `injury`, `potion`. `Buffs.classes` lists the ones a server can take over.
274
+ */
275
+ class: string;
276
+
277
+ /**
278
+ * The family `player.clearBuffs` would take it off with, or null for the majority that belong to none.
279
+ */
280
+ aiTag: string | null;
281
+
282
+ /**
283
+ * How long the effect runs from start to finish, in real seconds, and negative for one with no end.
284
+ */
285
+ duration: number;
286
+ }
287
+
288
+ /**
289
+ * One status effect currently on a body: everything `BuffInfo` says about it, plus how long it has been there and who put it there.
290
+ */
291
+ interface BuffState {
292
+ /**
293
+ * The name the game's own buff tables give the effect, and the spelling every buff verb takes.
294
+ */
295
+ name: string;
296
+
297
+ /**
298
+ * The kind of effect it is -- `poison`, `alcohol`, `injury`, `potion`. `Buffs.classes` lists the ones a server can take over.
299
+ */
300
+ class: string;
301
+
302
+ /**
303
+ * The family `player.clearBuffs` would take it off with, or null for the majority that belong to none.
304
+ */
305
+ aiTag: string | null;
306
+
307
+ /**
308
+ * How long the effect runs from start to finish, in real seconds, and negative for one with no end.
309
+ */
310
+ duration: number;
311
+
312
+ /**
313
+ * How long it has been on the body, in real seconds. `duration - since` is roughly what is left, and roughly is the best anyone can do: the game advances buff time from each client's own frame delta. 0 for an effect that was already there when the player connected.
314
+ */
315
+ since: number;
316
+
317
+ /**
318
+ * Whether this server put it there, or the game did -- a potion they drank, an injury they took.
319
+ */
320
+ source: "server" | "native";
321
+ }
322
+
323
+ /**
324
+ * A KCDC player this client can see, and the body they occupy.
325
+ */
326
+ class Player {
327
+ /**
328
+ * Creates a script wrapper for a player this client already knows about; it neither connects nor spawns anyone.
329
+ * @param id Network entity identifier.
330
+ */
331
+ constructor(id: number);
332
+
333
+ /**
334
+ * The name this player connected under, or an empty string once their body is gone.
335
+ */
336
+ readonly nickname: string;
337
+
338
+ /**
339
+ * Connection slot this player holds, or 65535 when unassigned. Stable for the length of the session and reused afterwards.
340
+ */
341
+ readonly playerIndex: number;
342
+
343
+ /**
344
+ * What this player's body looks like, as their own client last published it. Every part is empty until something chooses one, which is the default body -- and why everyone looks the same until a resource says otherwise.
345
+ *
346
+ * Read back rather than assumed after `setAppearance`: the owning client is authoritative for its own body, so a new look appears here once they have actually put it on.
347
+ */
348
+ readonly appearance: Appearance;
349
+
350
+ /**
351
+ * Whether this player's body has both a pose and a soul, which is what everyone else waits for before spawning a puppet for them. False for the first moments of a connection.
352
+ */
353
+ readonly ready: boolean;
354
+
355
+ /**
356
+ * Whether this player has health left. False also while no soul has been published.
357
+ */
358
+ readonly alive: boolean;
359
+
360
+ /**
361
+ * Whether the body can be driven at all: alive, conscious and not asleep.
362
+ */
363
+ readonly canAct: boolean;
364
+
365
+ /**
366
+ * Health as a percentage from 0 to 100 -- what the nametag bar draws. Derived from the pair behind it, so it survives a maximum that changes.
367
+ */
368
+ readonly healthPercent: number;
369
+
370
+ /**
371
+ * Current health, in the game's own units. 0 while no soul has been published.
372
+ */
373
+ readonly health: number;
374
+
375
+ /**
376
+ * Health capacity, in the game's own units.
377
+ */
378
+ readonly maxHealth: number;
379
+
380
+ /**
381
+ * Current stamina, in the game's own units.
382
+ */
383
+ readonly stamina: number;
384
+
385
+ /**
386
+ * Stamina capacity, in the game's own units. Collapses to 0 for a tick around death, which is real rather than a bad read.
387
+ */
388
+ readonly maxStamina: number;
389
+
390
+ /**
391
+ * The stamina ceiling the body's injuries currently allow, which is at or below maxStamina.
392
+ */
393
+ readonly healthyStamina: number;
394
+
395
+ /**
396
+ * Current tiredness, in the game's own units.
397
+ */
398
+ readonly exhaust: number;
399
+
400
+ /**
401
+ * Tiredness capacity, in the game's own units.
402
+ */
403
+ readonly maxExhaust: number;
404
+
405
+ /**
406
+ * Current nourishment, in the game's own units.
407
+ */
408
+ readonly hunger: number;
409
+
410
+ /**
411
+ * Nourishment capacity, in the game's own units.
412
+ */
413
+ readonly maxHunger: number;
414
+
415
+ /**
416
+ * How heavily the body is bleeding; 0 when it is not.
417
+ */
418
+ readonly bleeding: number;
419
+
420
+ /**
421
+ * Sleepiness the game has accumulated for this body; above 0 means asleep.
422
+ */
423
+ readonly sleeping: number;
424
+
425
+ /**
426
+ * How conscious the body is; 0 is knocked out.
427
+ */
428
+ readonly consciousness: number;
429
+
430
+ /**
431
+ * How drunk the body is; 0 is sober.
432
+ */
433
+ readonly drunkenness: number;
434
+
435
+ /**
436
+ * How poisoned the body is; 0 is clean.
437
+ */
438
+ readonly poisoning: number;
439
+
440
+ /**
441
+ * Strength, in the game's own units.
442
+ */
443
+ readonly strength: number;
444
+
445
+ /**
446
+ * Agility, in the game's own units.
447
+ */
448
+ readonly agility: number;
449
+
450
+ /**
451
+ * Vitality, in the game's own units.
452
+ */
453
+ readonly vitality: number;
454
+
455
+ /**
456
+ * The same three attributes as the engine's relative values, which is what its own modifiers are expressed in.
457
+ */
458
+ readonly relativeStats: SoulStats;
459
+
460
+ /**
461
+ * The nine combat and survival skills a hit or a draw is evaluated against. Read as a whole rather than one at a time: the snapshot carries them together.
462
+ */
463
+ readonly skills: SoulSkills;
464
+
465
+ /**
466
+ * The same nine skills as the engine's relative values.
467
+ */
468
+ readonly relativeSkills: SoulSkills;
469
+
470
+ /**
471
+ * The velocity the body's own animation was driven by this frame, not the one its physics settled on.
472
+ */
473
+ readonly velocity: Vector3;
474
+
475
+ /**
476
+ * World-space direction the head and eyes are turned towards. Zero while the body has reported none.
477
+ */
478
+ readonly lookDirection: Vector3;
479
+
480
+ /**
481
+ * Whether the body is off the ground -- fallen or mid-jump -- as its own physics reports it, debounced past the flicker a stair step causes.
482
+ */
483
+ readonly inAir: boolean;
484
+
485
+ /**
486
+ * The engine's own locomotion pace tag -- walk, jog, sprint -- as its animation system picked it. Raw Mannequin tag ids; 255 means nothing is set.
487
+ */
488
+ readonly moveSpeedTag: number;
489
+
490
+ /**
491
+ * The engine's own movement direction tag. Raw Mannequin tag ids; 255 means nothing is set.
492
+ */
493
+ readonly moveDirTag: number;
494
+
495
+ /**
496
+ * The engine's own stance tag -- upright, sneaking, sitting, lying. Raw Mannequin tag ids; 255 means nothing is set.
497
+ */
498
+ readonly stanceTag: number;
499
+
500
+ /**
501
+ * Whether this player is crouched, as their own game's crouch action reports it. False once their body is gone.
502
+ */
503
+ readonly crouched: boolean;
504
+
505
+ /**
506
+ * The ragdoll physics profile the body is in, or 255 when it has none to report.
507
+ */
508
+ readonly physicsProfile: number;
509
+
510
+ /**
511
+ * Whether this player has their fists -- or their weapon -- up. Stays true after the arm comes down, which is how the engine holds it.
512
+ */
513
+ readonly fistsUp: boolean;
514
+
515
+ /**
516
+ * The arm guard in the engine's own levels: 0 arms down, 1 the guard a player holds.
517
+ */
518
+ readonly guard: number;
519
+
520
+ /**
521
+ * Which direction of the combat star this player is aiming at, as a row of the game's zone table, or -1 when they are aiming at none.
522
+ */
523
+ readonly combatZone: number;
524
+
525
+ /**
526
+ * Item class drawn in the right hand as 32 hex digits, or an empty string when the hand is empty. A class rather than an item: no engine-local identifier crosses the wire.
527
+ */
528
+ readonly rightHandItem: string;
529
+
530
+ /**
531
+ * Item class drawn in the left hand as 32 hex digits, or an empty string when the hand is empty.
532
+ */
533
+ readonly leftHandItem: string;
534
+
535
+ /**
536
+ * Item classes this player is wearing, each as 32 hex digits. What they actually have on rather than a preset, so a bare body reads as an empty array.
537
+ */
538
+ readonly equipment: string[];
539
+
540
+ /**
541
+ * Whether this handle is the player sitting at this machine, rather than someone else's puppet.
542
+ */
543
+ readonly local: boolean;
544
+
545
+ /**
546
+ * The engine entity this body was spawned as, or 0 across a level load and before the puppet exists. Not stable across a session: the engine reuses entity ids.
547
+ */
548
+ readonly entityId: number;
549
+
550
+ /**
551
+ * Network ID of the horse this player is riding, or 0 when they are on foot.
552
+ */
553
+ readonly horseId: number;
554
+
555
+ /**
556
+ * Whether this player is in a saddle.
557
+ */
558
+ readonly mounted: boolean;
559
+
560
+ /**
561
+ * The status effects on this body: potions, poison, drunkenness, injuries, illness, unconsciousness, and anything the server added. Perks and equipment effects are not in here -- they follow state that already replicates.
562
+ *
563
+ * Only the local player has this list. Nobody else's client publishes their effects, because what everyone else's body is wearing reaches this machine as the consequences already -- so it reads empty for any other handle.
564
+ */
565
+ readonly buffs: BuffState[];
566
+
567
+ /**
568
+ * Formats this player handle for logging and debugging.
569
+ * @returns The player's network entity ID, nickname, and whether they are the local player.
570
+ */
571
+ toString(): string;
572
+ }
573
+
574
+ interface Player extends BasePlayer {}
575
+
576
+ /**
577
+ * The game's own HUD messages, shown to the player at this machine. Nothing here is replicated: a message everyone should see is sent to everyone, and each client shows it. Every call returns false while there is no HUD, which is the case in the main menu and across a level load.
578
+ */
579
+ const Hud: {
580
+ /**
581
+ * Whether this player is in a conversation right now -- one a server resource opened through `Dialogue`, or one the game started by itself. Both count, because a resource that acts during the game's own dialogue is as wrong as one that acts during ours. The game's half is read from its own dialogue manager, so it is true for real NPC conversations as well.
582
+ * @returns True while a conversation owns the screen.
583
+ */
584
+ isInDialogue(): boolean;
585
+
586
+ /**
587
+ * Shows the plain notification: one line, no icon, no payload.
588
+ * @param message Text to show, as written.
589
+ * @returns True when the HUD took it.
590
+ */
591
+ showNotification(message: string): boolean;
592
+
593
+ /**
594
+ * Shows the single line of info text above the HUD.
595
+ * @param message Text to show, as written.
596
+ * @param durationMs How long to hold it, in real milliseconds; defaults to 3000.
597
+ * @param priority What an already-showing message does to this one; defaults to 0.
598
+ * @returns True when the HUD took it.
599
+ */
600
+ showInfoText(message: string, durationMs?: number, priority?: number): boolean;
601
+
602
+ /**
603
+ * Takes the info text down before its time is up.
604
+ * @returns True when the HUD took it.
605
+ */
606
+ hideInfoText(): boolean;
607
+
608
+ /**
609
+ * Shows the perk-used toast: an icon and a line.
610
+ * @param iconName Icon from the game's own atlas, by name -- `perk_alchemist`, say. It is not text and is not translated.
611
+ * @param name Line beside the icon, as written.
612
+ * @returns True when the HUD took it.
613
+ */
614
+ showPerkUsed(iconName: string, name: string): boolean;
615
+
616
+ /**
617
+ * Shows the perk-gained toast, which is the one the game plays when a perk is earned.
618
+ * @param iconName Icon from the game's own atlas, by name.
619
+ * @param name Line beside the icon, as written.
620
+ * @returns True when the HUD took it.
621
+ */
622
+ showPerkGained(iconName: string, name: string): boolean;
623
+
624
+ /**
625
+ * Shows the combo-learned toast.
626
+ * @param iconName Icon from the game's own atlas, by name.
627
+ * @param name Line beside the icon, as written.
628
+ * @returns True when the HUD took it.
629
+ */
630
+ showComboLearned(iconName: string, name: string): boolean;
631
+
632
+ /**
633
+ * Shows the reputation-change message.
634
+ * @param eventId Which reputation event the HUD draws it as.
635
+ * @param message Line to show, as written.
636
+ * @returns True when the HUD took it.
637
+ */
638
+ showReputationChanged(eventId: number, message: string): boolean;
639
+
640
+ /**
641
+ * Shows the random-event result panel.
642
+ * @param type Which result the HUD draws it as.
643
+ * @param result Result line, as written.
644
+ * @param name Name of what it was, as written.
645
+ * @returns True when the HUD took it.
646
+ */
647
+ showRandomEventResult(type: number, result: string, name: string): boolean;
648
+
649
+ /**
650
+ * Shows the experience-gain toast.
651
+ * @param stat The stat's own unique name -- `str`, say. It is an identifier, not text, and is not translated.
652
+ * @param statName What to call it on screen, as written.
653
+ * @param type Which XP bar the HUD draws it against; defaults to 0.
654
+ * @returns True when the HUD took it.
655
+ */
656
+ showXpGain(stat: string, statName: string, type?: number): boolean;
657
+
658
+ /**
659
+ * Shows one of the game's tutorials. This drives the HUD slot directly, which is past whatever the mod suppresses at the source.
660
+ * @param name The tutorial's own name in the game's tables, such as `OB_O20_Inventory`. Not text.
661
+ * @returns True when the HUD took it.
662
+ */
663
+ showTutorial(name: string): boolean;
664
+
665
+ /**
666
+ * Takes one named tutorial down.
667
+ * @param name The tutorial's own name in the game's tables.
668
+ * @returns True when the HUD took it.
669
+ */
670
+ hideTutorial(name: string): boolean;
671
+
672
+ /**
673
+ * Takes down whichever tutorial is showing, whatever it is.
674
+ * @returns True when the HUD took it.
675
+ */
676
+ hideCurrentTutorial(): boolean;
677
+
678
+ /**
679
+ * Takes down the codex action hint.
680
+ * @returns True when the HUD took it.
681
+ */
682
+ hideCodexActionHint(): boolean;
683
+
684
+ /**
685
+ * Empties the queue of notifications waiting to be shown. It is the only piece of the HUD's own state reachable from here; everything else is one-shot.
686
+ * @returns True when the HUD took it.
687
+ */
688
+ clearNotifications(): boolean;
689
+ };
690
+
691
+ /**
692
+ * The game's own sound triggers, played at this machine. A trigger is a name the game's audio data declares -- `a_o_bell_kkut_kostelni`, `c_torch_whoosh1`, `f_ge_cough_woman` -- standing for an FMOD event. The full vocabulary is `Libs/GameAudio/*.xml` in `IPL_GameData.pak`, with the gameplay-facing subset listed in `Libs/Tables/GameAudio/SkaldAtlTrigger.xml`. Nothing here is replicated: a sound everyone should hear is one the server tells every client to play. Every call returns false while the audio system is not up, which is the case before a world is loaded, and for a trigger name the audio data does not declare.
693
+ */
694
+ const Audio: {
695
+ /**
696
+ * Plays a trigger with no position: heard at full volume wherever the player is, like a UI cue. It goes on the one global audio object every 2D sound in the game shares, which is why it cannot be stopped again.
697
+ * @param trigger Name of the trigger, spelled as the game's audio data spells it. Not text and not translated.
698
+ * @returns True when the audio system took it.
699
+ */
700
+ play(trigger: string): boolean;
701
+
702
+ /**
703
+ * Plays a trigger once at a point in the world, positioned and attenuated against the player's ears. The sound is handed to the engine and forgotten: it stays where it was put, plays to its end, and cannot be stopped or moved. Occlusion is ignored rather than ray-traced, so a wall between the point and the player does not silence it.
704
+ * @param trigger Name of the trigger, spelled as the game's audio data spells it.
705
+ * @param position Where to play it, in world-space metres.
706
+ * @returns True when the audio system took it.
707
+ */
708
+ playAt(trigger: string, position: Vector3): boolean;
709
+
710
+ /**
711
+ * Plays a trigger on an entity, giving it an audio component if it has none. The sound follows the entity for as long as it lasts and can be stopped again by name, which is what anything attached to a body, a horse or a prop wants.
712
+ * @param trigger Name of the trigger, spelled as the game's audio data spells it.
713
+ * @param entityId Engine entity to hang it on -- what `Player.entityId` reports. Entity ids are reused, so one is only meaningful while the entity is alive.
714
+ * @returns True when the entity was there and took it.
715
+ */
716
+ playOnEntity(trigger: string, entityId: number): boolean;
717
+
718
+ /**
719
+ * Stops every instance of one trigger on the entity. Triggers that have already finished are not an error.
720
+ * @param trigger Name of the trigger to stop.
721
+ * @param entityId Engine entity it was played on.
722
+ * @returns True when the entity was there to take it.
723
+ */
724
+ stopOnEntity(trigger: string, entityId: number): boolean;
725
+
726
+ /**
727
+ * Stops everything the entity is playing, the game's own sounds included. Use `stopOnEntity` when the trigger is known.
728
+ * @param entityId Engine entity to silence.
729
+ * @returns True when the entity was there to take it.
730
+ */
731
+ stopAllOnEntity(entityId: number): boolean;
732
+
733
+ /**
734
+ * Sets one of the continuous parameters the game's FMOD events read, on this entity's sounds alone. It affects what is already playing as well as what starts later.
735
+ * @param entityId Engine entity whose sounds the parameter applies to.
736
+ * @param parameter Name of the continuous parameter, as `Libs/Tables/GameAudio/SkaldAtlRtpc.xml` lists it -- `horse_speed`, `player_stamina`, `wind_velocity`.
737
+ * @param value What to set it to. The range is whatever the FMOD event expects.
738
+ * @returns True when both the parameter and the entity were there.
739
+ */
740
+ setEntityParameter(entityId: number, parameter: string, value: number): boolean;
741
+
742
+ /**
743
+ * Selects one of the discrete switch states the game's sounds branch on, for this entity alone.
744
+ * @param entityId Engine entity whose sounds the switch applies to.
745
+ * @param switchName Name of the switch, as `Libs/GameAudio/g_switches.xml` declares it -- `sword_mat`, `bow_type`.
746
+ * @param state Which of that switch's states to select. States belong to their switch, so the same name under a different switch is a different state.
747
+ * @returns True when the switch, the state and the entity were all there.
748
+ */
749
+ setEntitySwitch(entityId: number, switchName: string, state: string): boolean;
750
+
751
+ /**
752
+ * Asks the audio system whether it knows a trigger by this name, without playing it. A patch or another mod can change what is declared, so a resource that ships names can fail early rather than silently.
753
+ * @param trigger Name to look for.
754
+ * @returns True when the name resolves. False also while the audio system is not up.
755
+ */
756
+ hasTrigger(trigger: string): boolean;
757
+ };
758
+
759
+ /**
760
+ * The game's own particle effects, played on this machine. An effect is a name out of the game's particle libraries -- `WH_Particels.fires.candle`, `collisions.combat.sword_sword`, `cinematics.dust.dust_army_a` -- and `list` is the whole vocabulary. Nothing here is replicated: an effect everyone should see is one the server tells every client to play with `Vfx.burst`, or one the server places with `Vfx.spawn`, which the interest grid then streams to whoever is near it. Almost every effect the game ships is continuous, which means it never ends on its own -- so everything started here is given a duration, and one that is not stopped first is stopped when the session ends.
761
+ */
762
+ const Vfx: {
763
+ /**
764
+ * Plays an effect standing at a point in the world, on an entity this client owns and removes again. Every spawn parameter is read once, when the emitter is created, so none of them can be changed afterwards -- stop it and start another.
765
+ * @param effect Name of the effect, spelled as the game's particle libraries spell it.
766
+ * @param position Where to play it, in world-space metres.
767
+ * @param options `rotation` aims the emitter; `scale`, `countScale`, `speedScale` and `timeScale` multiply what the effect authored; `strength` feeds its strength curves; `pulsePeriod` restarts it on that many seconds; `prime` starts it already running, which is what a fire wants. `durationMs` is how long it lives -- two seconds by default, and an hour at most.
768
+ * @returns A handle to pass to `stop`, or 0 when the world was not up, the budget was full or the game would not load the effect.
769
+ */
770
+ spawn(effect: string, position: Vector3, options?: { rotation?: Quaternion | Vector3; scale?: number; countScale?: number; speedScale?: number; timeScale?: number; strength?: number; pulsePeriod?: number; prime?: boolean; durationMs?: number }): number;
771
+
772
+ /**
773
+ * Plays an effect in a free render slot of an entity, where it follows that entity: smoke off a cart, a glow around a body, dust under a horse. The slot is freed when the duration runs out, when `stop` is called, or when the entity goes. The offset is measured from the entity's own origin, not from a bone, so an effect cannot be pinned to a hand or a weapon this way.
774
+ * @param effect Name of the effect, spelled as the game's particle libraries spell it.
775
+ * @param entityId Engine entity to hang it on -- what `Player.entityId` reports. Entity ids are reused, so one is only meaningful while the entity is alive.
776
+ * @param options As `spawn`, plus `offset`: where the emitter sits in the entity's own space, in metres. Up to 8 m from its origin.
777
+ * @returns A handle to pass to `stop`, or 0 when the entity was not there or the game would not load the effect.
778
+ */
779
+ attach(effect: string, entityId: number, options?: { offset?: Vector3; rotation?: Quaternion | Vector3; scale?: number; countScale?: number; speedScale?: number; timeScale?: number; strength?: number; pulsePeriod?: number; prime?: boolean; durationMs?: number }): number;
780
+
781
+ /**
782
+ * Stops one effect and releases what it was standing on.
783
+ * @param handle What `spawn` or `attach` returned.
784
+ * @returns True when the handle named an effect that was still playing.
785
+ */
786
+ stop(handle: number): boolean;
787
+
788
+ /**
789
+ * Stops every effect this client started, including ones other resources started. The session ending does this too.
790
+ * @returns Nothing.
791
+ */
792
+ stopAll(): void;
793
+
794
+ /**
795
+ * Whether the effect behind a handle is still running. False once its duration has run out, its entity has gone, or the level has changed under it.
796
+ * @param handle What `spawn` or `attach` returned.
797
+ * @returns True while it is playing.
798
+ */
799
+ isPlaying(handle: number): boolean;
800
+
801
+ /**
802
+ * Asks the game whether it can resolve an effect by this name, without playing it. False while no world is loaded, and for a name the catalog knows but this install's particle libraries no longer declare, so a resource that ships names can fail early rather than silently.
803
+ * @param effect Name to look for.
804
+ * @returns True when the name resolves here and now.
805
+ */
806
+ has(effect: string): boolean;
807
+
808
+ /**
809
+ * Every effect name the shipped game declares, in order. Mined from the particle libraries at build time, so it is the same list on the server.
810
+ * @param prefix Keep only the names starting with this, e.g. `WH_Particels.fires` or `collisions.combat`.
811
+ * @returns The matching names.
812
+ */
813
+ list(prefix?: string): string[];
814
+
815
+ /**
816
+ * How many effects this client is playing right now, across every resource. The budget is 192.
817
+ * @returns The number of live effects.
818
+ */
819
+ count(): number;
820
+ };
821
+
822
+ /**
823
+ * A mark this client owns on the game's compass and map screen.
824
+ */
825
+ class Blip {
826
+ /**
827
+ * Creates a handle for a blip that already exists; use Blip.create() to make one.
828
+ * @param id Identifier of an existing blip.
829
+ */
830
+ constructor(id: number);
831
+
832
+ /**
833
+ * Identifier of this blip, unique for the lifetime of the session. Ids are not reused.
834
+ */
835
+ readonly id: number;
836
+
837
+ /**
838
+ * Whether the blip is still in the registry. A handle to a removed blip keeps reading, and every other property reads as its default.
839
+ */
840
+ readonly valid: boolean;
841
+
842
+ /**
843
+ * Whether the compass currently carries a mark for this blip. It goes false on its own whenever the game empties the compass -- a level load does -- and back to true on the next tick.
844
+ */
845
+ readonly live: boolean;
846
+
847
+ /**
848
+ * World-space position in metres. The compass recomputes bearing and distance from it every frame, so assigning moves the mark with no rebuild.
849
+ */
850
+ position: Vector3;
851
+
852
+ /**
853
+ * Which of the game's own compass icons the mark draws as, by the game's own name for it. Assignment rebuilds the native mark, because the icon is read once when a mark is registered and never re-read.
854
+ */
855
+ type: string;
856
+
857
+ /**
858
+ * The mark's state, forwarded to the compass movie as-is. What a given value draws is undocumented; 0 is what a fresh mark carries.
859
+ */
860
+ state: number;
861
+
862
+ /**
863
+ * The blip's name on the map screen, shown verbatim in place of the name the game gives its icon type; empty keeps that name. A compass mark has no text, so the compass never shows it.
864
+ */
865
+ label: string;
866
+
867
+ /**
868
+ * Whether the blip is drawn on the HUD compass. True by default.
869
+ */
870
+ compass: boolean;
871
+
872
+ /**
873
+ * Whether the blip is drawn on the map screen. True by default, but only for an icon the map has art for: `Main`, `Side`, `Micro`, `Checkpoint`, `Dlcs`, `Bailiff`, `FistFight` and `Racing` have none and stay on the compass. The map legend's switch for the blip's icon type hides it like one of the game's own, and a change to a blip on the open map is redrawn within a frame.
874
+ */
875
+ map: boolean;
876
+
877
+ /**
878
+ * Formats this blip handle for logging and debugging.
879
+ * @returns The blip's id, its type and its position, or a note that it is gone.
880
+ */
881
+ toString(): string;
882
+
883
+ /**
884
+ * Takes this blip off the compass and the map screen and out of the registry.
885
+ * @returns True when it was still there to remove.
886
+ */
887
+ remove(): boolean;
888
+
889
+ /**
890
+ * Puts a mark on this client's compass and map screen and keeps it there, rebuilding it whenever the game drops it.
891
+ * @param options Where the blip goes, and optionally which icon to draw it with, what state to give it, what the map screen calls it, and whether it shows on the compass and the map screen -- both, by default. `type` is one of the game's own compass mark names -- `Checkpoint`, `QuestGiver`, `Shop`, `GeneralPoi` and the rest -- and defaults to `GeneralPoi`; an unknown one is rejected rather than guessed at.
892
+ * @returns The new blip, or null at the blip limit.
893
+ */
894
+ static create(options: { position: Vector3; type?: string; state?: number; label?: string; compass?: boolean; map?: boolean }): Blip | null;
895
+
896
+ /**
897
+ * Looks a blip up by its id.
898
+ * @param id Blip identifier.
899
+ * @returns The blip's handle, or null when it no longer exists.
900
+ */
901
+ static getById(id: number): Blip | null;
902
+
903
+ /**
904
+ * Lists every blip this client's scripts made. Blips the server placed are not included.
905
+ * @returns One handle per live blip, in creation order.
906
+ */
907
+ static all(): Blip[];
908
+
909
+ /**
910
+ * Takes every blip this client's scripts made off the compass and the map screen, leaving the server's blips and the game's own marks alone.
911
+ */
912
+ static removeAll(): void;
913
+ }
914
+
915
+ /**
916
+ * Native location or POI GUID fields.
917
+ */
918
+ interface LocationId {
919
+ /**
920
+ * First GUID field, an unsigned 32-bit integer.
921
+ */
922
+ data1: number;
923
+
924
+ /**
925
+ * Second GUID field, an unsigned 16-bit integer.
926
+ */
927
+ data2: number;
928
+
929
+ /**
930
+ * Third GUID field, an unsigned 16-bit integer.
931
+ */
932
+ data3: number;
933
+
934
+ /**
935
+ * The final eight GUID bytes, in native order.
936
+ */
937
+ data4: Uint8Array;
938
+ }
939
+
940
+ /**
941
+ * One thing a trace met, as the machine that traced it saw it.
942
+ */
943
+ interface WorldRayHit {
944
+ /**
945
+ * Where the ray met it, in world-space metres.
946
+ */
947
+ position: Vector3;
948
+
949
+ /**
950
+ * The surface normal at that point, as a unit vector.
951
+ */
952
+ normal: Vector3;
953
+
954
+ /**
955
+ * How far along the ray it sits, in metres.
956
+ */
957
+ distance: number;
958
+
959
+ /**
960
+ * The surface type's own name, spelled the way the game's tables spell it -- `mat_wood`, `mat_stone`, `mat_water`. This is what a trace is worth over a position: it says what was hit, not just where. Empty only before the material tables are up.
961
+ */
962
+ surface: string;
963
+
964
+ /**
965
+ * Whether the ground itself was hit rather than anything placed on it. Nothing lies behind the terrain, so a trace stops there.
966
+ */
967
+ terrain: boolean;
968
+
969
+ /**
970
+ * The level's own identity for what was hit, as sixteen lowercase hex digits -- the same on every machine, and what `Door.find` and the other GUID lookups take. Null for terrain, for static geometry and for anything the session spawned, none of which the level names.
971
+ */
972
+ entityGuid: string | null;
973
+
974
+ /**
975
+ * The name the level gives it, often empty. Null when nothing that carries a name was hit.
976
+ */
977
+ entityName: string | null;
978
+
979
+ /**
980
+ * The engine class it belongs to -- `AnimDoor`, `NPC_NAI`, `GeomEntity`. Null when nothing that carries a class was hit.
981
+ */
982
+ entityClass: string | null;
983
+
984
+ /**
985
+ * This machine's own handle for it. Local to this client and to this session -- it is not the network ID and it is not portable, so store `entityGuid` instead. Null for terrain and static geometry.
986
+ */
987
+ entityId: number | null;
988
+ }
989
+
990
+ /**
991
+ * One entity a sphere reported, and where it stood when it did.
992
+ */
993
+ interface WorldNearbyEntity {
994
+ /**
995
+ * Where it is, in world-space metres.
996
+ */
997
+ position: Vector3;
998
+
999
+ /**
1000
+ * How far it is from the centre of the sphere, in metres.
1001
+ */
1002
+ distance: number;
1003
+
1004
+ /**
1005
+ * The level's own identity for it, as sixteen lowercase hex digits. Null for anything the session spawned, which the level does not name.
1006
+ */
1007
+ guid: string | null;
1008
+
1009
+ /**
1010
+ * The name the level gives it, often empty.
1011
+ */
1012
+ name: string;
1013
+
1014
+ /**
1015
+ * The engine class it belongs to -- `AnimDoor`, `NPC_NAI`, `GeomEntity`.
1016
+ */
1017
+ class: string;
1018
+
1019
+ /**
1020
+ * Whether the engine has built physics for it, which is what makes it something a trace could also find.
1021
+ */
1022
+ physicalized: boolean;
1023
+
1024
+ /**
1025
+ * This machine's own handle for it. Local to this client and to this session -- it is not the network ID and it is not portable, so store `guid` instead.
1026
+ */
1027
+ entityId: number;
1028
+ }
1029
+
1030
+ /**
1031
+ * What this machine's engine can be asked about the level around it: what a trace meets, what the ground is under a point, and which entities are inside a sphere.
1032
+ *
1033
+ * Each is the engine's own query rather than a search over everything loaded, so the cost is what the question covers. They answer inside the call, because this is the machine that has the world -- the server's `World` asks the same three questions as promises, because it has to borrow a client's world to answer them.
1034
+ *
1035
+ * None of it is replicated and none of it is authority: an answer describes what one client has streamed in at one moment. A zone that matters is decided on the server, from an answer the server asked for itself.
1036
+ */
1037
+ const World: {
1038
+ /**
1039
+ * Traces a segment through the world and reports the first thing it meets.
1040
+ * @param from Where the ray starts, in world-space metres.
1041
+ * @param to Where it ends. Up to 4096 metres away; a ray of no length is refused.
1042
+ * @param options `mode` picks which of the game's own three traces to run: `cover` asks whether the world is in the way -- static geometry, props and doors block, and bodies cannot, which is what a line of sight wants; `anything` asks what is under the ray, bodies included, which is what a pick wants; `ground` sees only surfaces a player could stand on. It defaults to `cover`, and a name that is none of the three is rejected rather than guessed at.
1043
+ *
1044
+ * `ignoreSelf` passes the local player's own body through, and is on by default: the player stands where the camera does, so a trace from the camera would otherwise mostly hit them. Both of a body's colliders are skipped, not just the entity's.
1045
+ * @returns What it hit, or null when the ray met nothing and when this machine has no world loaded.
1046
+ */
1047
+ raycast(from: Vector3, to: Vector3, options?: { mode?: "cover" | "anything" | "ground"; ignoreSelf?: boolean }): WorldRayHit | null;
1048
+
1049
+ /**
1050
+ * Traces a segment and reports everything solid along it, nearest first. Each hit is found by re-tracing past the one before, so a window does not hide the wall it is set in.
1051
+ * @param from Where the ray starts, in world-space metres.
1052
+ * @param to Where it ends. Up to 4096 metres away; a ray of no length is refused.
1053
+ * @param options `mode` and `ignoreSelf` are as `World.raycast` documents them. `maxHits` is how many things along the ray to report, up to 8 and 8 by default.
1054
+ * @returns What the ray met, nearest first; empty when it met nothing and when this machine has no world loaded.
1055
+ */
1056
+ raycastAll(from: Vector3, to: Vector3, options?: { mode?: "cover" | "anything" | "ground"; maxHits?: number; ignoreSelf?: boolean }): WorldRayHit[];
1057
+
1058
+ /**
1059
+ * The height of the ground under a point.
1060
+ *
1061
+ * A trace rather than a terrain height, so it stands on whatever is actually there -- a bridge, a floor, a castle roof -- and not on the heightmap underneath it.
1062
+ * @param position The point to look under, in world-space metres. Its own z is where the probe is centred.
1063
+ * @param options How far above the point the probe starts and how far below it reaches, in metres. 5 and 200 by default -- the 5 above is what lets a point already slightly underground still resolve -- and up to 512 each.
1064
+ * @returns The world-space z of what is underfoot, or null when the probe reached nothing within its range.
1065
+ */
1066
+ getGroundZ(position: Vector3, options?: { up?: number; down?: number }): number | null;
1067
+
1068
+ /**
1069
+ * The same probe as `getGroundZ`, with everything it found rather than only the height: the slope it landed on, and what the surface is made of.
1070
+ * @param position The point to look under, in world-space metres.
1071
+ * @param options How far above the point the probe starts and how far below it reaches, in metres. 5 and 200 by default -- the 5 above is what lets a point already slightly underground still resolve -- and up to 512 each.
1072
+ * @returns What is underfoot, or null when the probe reached nothing.
1073
+ */
1074
+ resolveGround(position: Vector3, options?: { up?: number; down?: number }): WorldRayHit | null;
1075
+
1076
+ /**
1077
+ * Every entity the engine has inside a sphere, nearest first.
1078
+ *
1079
+ * This reads the engine's own spatial grid, so it costs what the sphere covers rather than what the level holds -- but it only sees what this client has streamed in, which for a distant point is nothing.
1080
+ * @param centre The centre of the sphere, in world-space metres.
1081
+ * @param radius Its radius in metres, up to 256.
1082
+ * @param options `class` reports only entities of that engine class -- `AnimDoor`, `NPC_NAI`, `GeomEntity` -- and a class the engine does not know matches nothing rather than everything; omitted, every class is reported. `max` is how many to report, nearest first, up to 64. `physicalOnly` skips entities the engine has built no physics for, which is the filter the game's own proximity query applies, and is off by default.
1083
+ * @returns The entities inside it, nearest first.
1084
+ */
1085
+ entitiesInRadius(centre: Vector3, radius: number, options?: { class?: string; max?: number; physicalOnly?: boolean }): WorldNearbyEntity[];
1086
+ };
1087
+
1088
+ /**
1089
+ * The marker the player has dropped on the map, as `WorldMap.getWaypoint` reports it.
1090
+ */
1091
+ interface MapWaypoint {
1092
+ /**
1093
+ * Where the marker sits, in world-space metres. Its z is the terrain height under the point.
1094
+ */
1095
+ position: Vector3;
1096
+
1097
+ /**
1098
+ * Which map it belongs to. The maps reuse one coordinate range.
1099
+ */
1100
+ mapId: number;
1101
+ }
1102
+
1103
+ /**
1104
+ * The map screen at this machine, and the player's own marker on it. Nothing here is replicated: a marker everyone should see is one the server tells every client to make.
1105
+ */
1106
+ const WorldMap: {
1107
+ /**
1108
+ * Whether the map screen is up right now. False in the main menu and across a level load, when there is no map page at all.
1109
+ */
1110
+ readonly isOpen: boolean;
1111
+
1112
+ /**
1113
+ * Reads the marker the player has dropped on the map they are looking at. The game keeps at most one per map.
1114
+ * @returns The marker's position and the map it belongs to, or null when there is none.
1115
+ */
1116
+ getWaypoint(): MapWaypoint | null;
1117
+
1118
+ /**
1119
+ * Moves the marker the player has already dropped. It cannot create one, so it reads false when there is nothing down.
1120
+ * @param position Where to put it, in world-space metres. Nothing snaps it to the terrain.
1121
+ * @returns True when there was a marker to move.
1122
+ */
1123
+ moveWaypoint(position: Vector3): boolean;
1124
+
1125
+ /**
1126
+ * Takes the player's marker off the map they are looking at. It runs the game's own removal, so `mapWaypointCleared` is raised as it would be for the player.
1127
+ * @returns True when there was a marker to take off.
1128
+ */
1129
+ clearWaypoint(): boolean;
1130
+
1131
+ /**
1132
+ * Whether marks of this type are currently drawn on the compass and listed in the map legend.
1133
+ * @param type One of the game's own compass mark types, spelled the way the game spells it -- `Shop`, `QuestGiver`, `GeneralPoi`. The full list is the `type` a `Blip` accepts.
1134
+ * @returns True when they are shown.
1135
+ */
1136
+ isCategoryVisible(type: string): boolean;
1137
+
1138
+ /**
1139
+ * Shows or hides a whole category of the game's own map markers -- every shop, every quest giver -- through the switch the map legend's rows drive. It affects the marks already placed as well as later ones. DLC icons share a legend row with the entry they belong to, so setting one sets the group.
1140
+ * @param type One of the game's own compass mark types, spelled the way the game spells it -- `Shop`, `QuestGiver`, `GeneralPoi`. The full list is the `type` a `Blip` accepts.
1141
+ * @param visible Whether marks of that type should be drawn.
1142
+ * @returns True when the map page was there to take it.
1143
+ */
1144
+ setCategoryVisible(type: string, visible: boolean): boolean;
1145
+ };
1146
+
1147
+ /**
1148
+ * The compass strip along the top of the HUD, which is what this game has instead of a minimap. Marks go on it through `Blip`; this is the strip itself.
1149
+ */
1150
+ const Compass: {
1151
+ /**
1152
+ * How many marks the compass carried at the last tick, the game's own included. Sampled rather than read live: the vector it comes from is reallocated by the thread that adds to it.
1153
+ */
1154
+ readonly markCount: number;
1155
+
1156
+ /**
1157
+ * Whether the compass is showing. Assignment pushes the game's own suppression, the one a cutscene uses, so it takes the whole strip rather than emptying it. It reads the mod's own view -- a suppression the game pushed is invisible here -- and the mod's is released when the session ends.
1158
+ */
1159
+ visible: boolean;
1160
+ };
1161
+
1162
+ /**
1163
+ * The local player's fast travel, as something to read. There is deliberately no verb: starting a travel moves the player, advances the world clock and can fire a random event, so in a session that is the server's decision rather than one for a resource on the traveller's own machine.
1164
+ */
1165
+ const Travel: {
1166
+ /**
1167
+ * Whether a fast travel is running right now.
1168
+ */
1169
+ readonly active: boolean;
1170
+
1171
+ /**
1172
+ * Where the travel has got to along its route, in world-space metres. Zero while none is running: check `active` first.
1173
+ */
1174
+ readonly position: Vector3;
1175
+
1176
+ /**
1177
+ * Asks the game whether a fast travel could begin right now, without starting one. The answer is the game's own refusal code; only 0 is proven, and it means yes.
1178
+ * @returns The refusal code, or null before the player module is up.
1179
+ */
1180
+ canStart(): number | null;
1181
+ };
1182
+
1183
+ /**
1184
+ * Where the free camera is and what it is doing.
1185
+ */
1186
+ interface NoClipState {
1187
+ /**
1188
+ * Whether the player's body is carried through the world or left behind.
1189
+ */
1190
+ mode: "body" | "camera";
1191
+
1192
+ /**
1193
+ * Whether this machine's own keyboard and mouse are flying the camera.
1194
+ */
1195
+ input: boolean;
1196
+
1197
+ /**
1198
+ * Where the camera is, in world-space metres.
1199
+ */
1200
+ position: Vector3;
1201
+
1202
+ /**
1203
+ * The unit direction it is looking along.
1204
+ */
1205
+ forward: Vector3;
1206
+
1207
+ /**
1208
+ * The unit direction to its right, level with the horizon.
1209
+ */
1210
+ right: Vector3;
1211
+
1212
+ /**
1213
+ * The unit direction out of the top of the frame.
1214
+ */
1215
+ up: Vector3;
1216
+
1217
+ /**
1218
+ * Its heading in degrees, wrapped to -180..180. Zero faces +Y and a rising yaw swings left.
1219
+ */
1220
+ yaw: number;
1221
+
1222
+ /**
1223
+ * Its elevation in degrees, clamped to -89..89. Positive looks up.
1224
+ */
1225
+ pitch: number;
1226
+
1227
+ /**
1228
+ * Metres a second at rest, before boost or crawl scales it.
1229
+ */
1230
+ speed: number;
1231
+
1232
+ /**
1233
+ * The vertical field of view in degrees the view was asked for.
1234
+ */
1235
+ fov: number;
1236
+
1237
+ /**
1238
+ * The vertical field of view the renderer settled on, which `Hor+` adaptation and the window's aspect both move.
1239
+ */
1240
+ renderedFov: number;
1241
+
1242
+ /**
1243
+ * Width over height, as the renderer reports it.
1244
+ */
1245
+ aspectRatio: number;
1246
+ }
1247
+
1248
+ /**
1249
+ * This machine's free camera, and what happens to the player's body while it is flying.
1250
+ *
1251
+ * The view is a bodyless anchor entity made the active camera through the engine's own view system, so nothing is ever asked to sweep against the world. In `body` mode the player's entity is taken out of the physical world and placed at the camera each frame -- the pair a FiveM noclip composes out of `SetEntityCollision` and `SetEntityCoordsNoOffset`.
1252
+ *
1253
+ * Client-only, and nothing here is an order another machine takes. It is not invisible to the session either: in `body` mode the thing being flown is the entity this client replicates, so the other players watch the flier go. In `camera` mode the body never moves.
1254
+ *
1255
+ * The game's controls are held for as long as the flight lasts, whichever side is driving. F7's map editor flies the same one camera: a flight in progress ends when the editor opens, and `enable` refuses while it is open.
1256
+ */
1257
+ const NoClip: {
1258
+ /**
1259
+ * Starts flying. The camera begins where the player was looking, so this reads as stopping rather than as a cut.
1260
+ * @param options `mode` decides what happens to the player. `body`, the default, carries them: they pass through geometry, the world streams around them, the other players see them fly, and they land wherever the flight ends. `camera` leaves the body where it stands and touches nothing about its physics. A name that is neither is rejected rather than guessed at.
1261
+ *
1262
+ * `input` is whether this machine's keyboard and mouse fly the camera -- on the keys the game's own photo mode is bound to in the controls menu (forward, back, left, right, jump to rise, crouch to sink, fast movement to boost), read through the active keyboard layout so AZERTY and the like work as the game does; Alt to crawl, mouse to turn. On by default; off, drive it with `move`.
1263
+ *
1264
+ * `speed` is metres a second at rest, 0.05 to 400 and 12 by default. `fov` is the vertical field of view in degrees, up to 140; omitted, the view keeps the game's.
1265
+ * @returns `enabled` when the flight started. `alreadyActive` when one was already running -- the options are not re-applied. `noCamera` when there is no level to spawn the camera's anchor into. `cameraBusy` when F7's map editor holds the camera.
1266
+ */
1267
+ enable(options?: { mode?: "body" | "camera"; input?: boolean; speed?: number; fov?: number }): "enabled" | "alreadyActive" | "noCamera" | "cameraBusy";
1268
+
1269
+ /**
1270
+ * Ends the flight, hands the view back and puts the body back into the physical world. Does nothing when no flight is running.
1271
+ * @param options `keepPosition` leaves the body where the camera stopped, and is the default. False puts it back where it took off from, facing the way it was. Neither means anything in `camera` mode.
1272
+ * @returns Nothing. `noclipChanged` reports the end with reason `script`.
1273
+ */
1274
+ disable(options?: { keepPosition?: boolean }): void;
1275
+
1276
+ /**
1277
+ * Whether a flight is running at this machine.
1278
+ * @returns True while the free camera has the view.
1279
+ */
1280
+ isActive(): boolean;
1281
+
1282
+ /**
1283
+ * Everything about the flight in one read, rather than six calls that could each land on a different frame.
1284
+ * @returns The state, or null when no flight is running.
1285
+ */
1286
+ getState(): NoClipState | null;
1287
+
1288
+ /**
1289
+ * Where the camera is, in world-space metres.
1290
+ * @returns Its position, or null when no flight is running.
1291
+ */
1292
+ getPosition(): Vector3 | null;
1293
+
1294
+ /**
1295
+ * Puts the camera somewhere else without turning it.
1296
+ * @param position Where to put it, in world-space metres. A non-finite position is ignored.
1297
+ * @returns True when the camera took the position; false when no flight is running.
1298
+ */
1299
+ setPosition(position: Vector3): boolean;
1300
+
1301
+ /**
1302
+ * How the camera is aimed, in degrees. Two angles rather than a quaternion: that is what flying with a mouse produces, and it keeps the horizon level for free.
1303
+ * @returns Its angles, or null when no flight is running.
1304
+ */
1305
+ getRotation(): { yaw: number; pitch: number } | null;
1306
+
1307
+ /**
1308
+ * Aims the camera without moving it.
1309
+ * @param rotation The angles to take, in degrees. Either may be left out to keep the one the camera has. Yaw wraps to -180..180 and pitch is clamped to -89..89.
1310
+ * @returns True when the camera took the angles; false when no flight is running.
1311
+ */
1312
+ setRotation(rotation: { yaw?: number; pitch?: number }): boolean;
1313
+
1314
+ /**
1315
+ * The unit direction the camera is looking along.
1316
+ * @returns Its view direction, or null when no flight is running.
1317
+ */
1318
+ getForward(): Vector3 | null;
1319
+
1320
+ /**
1321
+ * Places and aims the camera in one go.
1322
+ * @param position Where to put the camera, in world-space metres.
1323
+ * @param forward The direction to aim it along. Need not be normalized; a direction of no length is ignored.
1324
+ * @returns True when the camera took the pose; false when no flight is running.
1325
+ */
1326
+ setPose(position: Vector3, forward: Vector3): boolean;
1327
+
1328
+ /**
1329
+ * Turns the camera to face a point, leaving it where it is.
1330
+ * @param point The world-space point to face.
1331
+ * @returns True when the camera turned; false when no flight is running.
1332
+ */
1333
+ lookAt(point: Vector3): boolean;
1334
+
1335
+ /**
1336
+ * Turns to face a point and then stands back from it, which is what framing an object wants.
1337
+ * @param target The world-space point to look at.
1338
+ * @param distance How far back to stand from it, in metres, from 1 to 4096. 6 by default.
1339
+ * @returns True when the camera moved; false when no flight is running.
1340
+ */
1341
+ focus(target: Vector3, distance?: number): boolean;
1342
+
1343
+ /**
1344
+ * Metres a second the camera flies at rest, before boost or crawl scales it.
1345
+ * @returns The speed, or 0 when there is no application to ask.
1346
+ */
1347
+ getSpeed(): number;
1348
+
1349
+ /**
1350
+ * Sets how fast the camera flies. Kept across flights, so a resource can set it once.
1351
+ * @param metresPerSecond The new speed, clamped to 0.05..400.
1352
+ * @returns Nothing.
1353
+ */
1354
+ setSpeed(metresPerSecond: number): void;
1355
+
1356
+ /**
1357
+ * The vertical field of view in degrees the view was last asked for, which is not what came back: `getState` reports the rendered one separately as `renderedFov`.
1358
+ * @returns The requested field of view.
1359
+ */
1360
+ getFov(): number;
1361
+
1362
+ /**
1363
+ * Sets the camera's lens.
1364
+ * @param degrees The vertical field of view, clamped to 20..140.
1365
+ * @returns Nothing.
1366
+ */
1367
+ setFov(degrees: number): void;
1368
+
1369
+ /**
1370
+ * Whether this machine's own keyboard and mouse are flying the camera.
1371
+ * @returns True while the built-in driver is on.
1372
+ */
1373
+ isInputEnabled(): boolean;
1374
+
1375
+ /**
1376
+ * Hands the camera between the built-in driver and the resource, mid-flight. The game's controls stay held either way: the choice is who flies the camera, not whether the player can walk.
1377
+ * @param enabled True to let this machine's keyboard and mouse fly the camera, false to leave it to `move`.
1378
+ * @returns Nothing.
1379
+ */
1380
+ setInputEnabled(enabled: boolean): void;
1381
+
1382
+ /**
1383
+ * Moves the camera by one frame of flight the resource resolved itself. Refused while the built-in driver is on, so the two cannot both integrate the same frame.
1384
+ * @param input One frame of flight. `forward`, `strafe` and `lift` are -1..1 along the view's heading, its right and world up -- lift is along world up rather than the view's, so rising and falling stay vertical while looking down. `yaw` and `pitch` are this frame's turn in degrees. `boost` multiplies the speed by six and `crawl` divides it by five, as Shift and Alt do.
1385
+ * @param deltaSeconds How long this frame is. Anything over 0.1 is treated as 0.1, so a stalled frame does not launch the camera across the map.
1386
+ * @returns True when the frame was applied. False when no flight is running and when the built-in driver has the camera.
1387
+ */
1388
+ move(input: { forward?: number; strafe?: number; lift?: number; yaw?: number; pitch?: number; boost?: boolean; crawl?: boolean }, deltaSeconds: number): boolean;
1389
+
1390
+ /**
1391
+ * The world direction through a point on the camera's near plane.
1392
+ *
1393
+ * Normalized device coordinates rather than pixels, because the mod does not own the back buffer's size. Pair it with `World.raycast` from `getPosition()` to find what is under a point of the frame.
1394
+ * @param x Across the frame, -1 at the left edge and +1 at the right.
1395
+ * @param y Up the frame, -1 at the bottom and +1 at the top.
1396
+ * @returns A unit direction, or null when no flight is running.
1397
+ */
1398
+ rayThroughScreen(x: number, y: number): Vector3 | null;
1399
+
1400
+ /**
1401
+ * Where a world point lands on the camera's frame, in the same normalized device coordinates `rayThroughScreen` takes.
1402
+ * @param point The world-space point to project.
1403
+ * @returns Its place on the frame, or null when no flight is running and when the point is behind the camera.
1404
+ */
1405
+ projectToScreen(point: Vector3): { x: number; y: number } | null;
1406
+ };
1407
+
1408
+ /**
1409
+ * Where this client is drawing from, as the renderer settled on it this frame.
1410
+ */
1411
+ interface CameraPose {
1412
+ /**
1413
+ * The eye position, in world-space metres.
1414
+ */
1415
+ position: Vector3;
1416
+
1417
+ /**
1418
+ * Where it looks, as a unit vector.
1419
+ */
1420
+ forward: Vector3;
1421
+
1422
+ /**
1423
+ * Its own right, as a unit vector. Read off the camera rather than rebuilt from a yaw, so it carries roll.
1424
+ */
1425
+ right: Vector3;
1426
+
1427
+ /**
1428
+ * Its own up, as a unit vector.
1429
+ */
1430
+ up: Vector3;
1431
+
1432
+ /**
1433
+ * Vertical field of view in degrees. What the renderer settled on, which Hor+ adaptation and the window's aspect both move -- not what the game asked for.
1434
+ */
1435
+ fov: number;
1436
+
1437
+ /**
1438
+ * Width over height.
1439
+ */
1440
+ aspectRatio: number;
1441
+ }
1442
+
1443
+ /**
1444
+ * A ray out of the camera, ready to hand to `World.raycast`.
1445
+ */
1446
+ interface CameraRay {
1447
+ /**
1448
+ * Where it starts: the eye position.
1449
+ */
1450
+ origin: Vector3;
1451
+
1452
+ /**
1453
+ * Where it points, as a unit vector.
1454
+ */
1455
+ direction: Vector3;
1456
+
1457
+ /**
1458
+ * Where it ends, which is `origin` plus `direction` times the range asked for.
1459
+ */
1460
+ target: Vector3;
1461
+ }
1462
+
1463
+ /**
1464
+ * The view this client is drawing through. Nothing here is replicated and nothing here is authority: it describes one machine's own camera at one moment.
1465
+ *
1466
+ * This is the game's camera, not a camera of the mod's own -- it follows the player, a dialogue, a cutscene or a free flight, whichever the game currently has. `NoClip` is what takes it over.
1467
+ */
1468
+ const Camera: {
1469
+ /**
1470
+ * Where the camera is this frame, and what it can see from there.
1471
+ * @returns The pose, or null in the main menu and across a level load, when there is no active view at all.
1472
+ */
1473
+ getPose(): CameraPose | null;
1474
+
1475
+ /**
1476
+ * A ray out of the camera through a point on screen. This is what turns "what is the player looking at" into the two points `World.raycast` takes.
1477
+ * @param options `x` and `y` are a point on screen in normalized device coordinates -- both run -1 at the left and bottom to +1 at the right and top, so the default (0, 0) is the centre of the screen, which is where the crosshair is. `range` is how far out to carry `target`, in metres, 100 by default and up to 4096.
1478
+ * @returns The ray, or null when there is no active view.
1479
+ */
1480
+ screenRay(options?: { x?: number; y?: number; range?: number }): CameraRay | null;
1481
+ };
1482
+
1483
+ /**
1484
+ * The box a ghost occupies, in world space.
1485
+ */
1486
+ interface PropGhostBounds {
1487
+ /**
1488
+ * The low corner, in world-space metres.
1489
+ */
1490
+ min: Vector3;
1491
+
1492
+ /**
1493
+ * The high corner.
1494
+ */
1495
+ max: Vector3;
1496
+
1497
+ /**
1498
+ * The middle of the box.
1499
+ */
1500
+ centre: Vector3;
1501
+
1502
+ /**
1503
+ * How big it is on each axis, in metres.
1504
+ */
1505
+ size: Vector3;
1506
+ }
1507
+
1508
+ /**
1509
+ * A preview this client is drawing: one or more of the game's meshes standing in the world with no body and no collision.
1510
+ */
1511
+ class PropGhost {
1512
+ /**
1513
+ * Creates a handle for a ghost that already exists; use PropGhost.create() to make one.
1514
+ * @param id Identifier of a ghost that already exists.
1515
+ */
1516
+ constructor(id: number);
1517
+
1518
+ /**
1519
+ * Identifier of this ghost, unique for the lifetime of the session. Ids are not reused.
1520
+ */
1521
+ readonly id: number;
1522
+
1523
+ /**
1524
+ * Whether the ghost is still standing. A handle to a destroyed one keeps reading; every call on it answers false. A level load destroys every ghost, because the nodes they are made of belong to the level that went.
1525
+ */
1526
+ readonly valid: boolean;
1527
+
1528
+ /**
1529
+ * Formats this ghost handle for logging and debugging.
1530
+ * @returns The ghost's id, and whether it is still standing.
1531
+ */
1532
+ toString(): string;
1533
+
1534
+ /**
1535
+ * Moves the whole ghost, parts and all. Cheap enough to call every frame: a part is moved with one engine call that re-sorts it into the world by itself.
1536
+ * @param position Where the ghost stands, in world-space metres.
1537
+ * @param rotation Which way it faces. The identity by default, which faces +Y.
1538
+ * @param scale Uniform scale, 1 by default and clamped to 0.01 - 100.
1539
+ * @returns True while the ghost is still standing.
1540
+ */
1541
+ setPose(position: Vector3, rotation?: Quaternion, scale?: number): boolean;
1542
+
1543
+ /**
1544
+ * Recolours the ghost.
1545
+ *
1546
+ * This is a real tint rather than a swapped material: the ghost's materials are private copies, and writing an opacity under 1 on one is what moves it into the renderer's transparent pass. A tint it already carries costs nothing, so this is safe to call every frame.
1547
+ * @param tint The colour to wash the ghost in, with `a` below 1 making it translucent. Omit it, or pass null, to put every mesh back to the materials it shipped with.
1548
+ * @returns True while the ghost is still standing.
1549
+ */
1550
+ setTint(tint?: Color): boolean;
1551
+
1552
+ /**
1553
+ * Hides or shows the ghost without dropping it, which is cheaper than destroying and rebuilding one.
1554
+ * @param hidden Whether to take it out of the draw.
1555
+ * @returns True while the ghost is still standing.
1556
+ */
1557
+ setHidden(hidden: boolean): boolean;
1558
+
1559
+ /**
1560
+ * The box the ghost occupies right now, in world space, as the engine reports it for the meshes themselves.
1561
+ * @returns Its bounds, or null once it is gone and for a ghost whose meshes carry none.
1562
+ */
1563
+ getBounds(): PropGhostBounds | null;
1564
+
1565
+ /**
1566
+ * Takes the ghost out of the world.
1567
+ * @returns True when it was still there to take.
1568
+ */
1569
+ destroy(): boolean;
1570
+
1571
+ /**
1572
+ * Puts a preview into the world: the game's own geometry, with no body, no collision and nothing replicated.
1573
+ *
1574
+ * This is what a build preview, a placement outline or a menu turntable is made of. It is not a prop -- nobody else can see it, and it does not survive a level load.
1575
+ * @param options `model` is one mesh from the shared prop catalog; `models` is several, which is how a blueprint of more than one piece is previewed. `offsets` and `rotations` line up with `models` by index and place each piece inside the ghost's own frame, so the whole thing turns and scales as one. A path the catalog does not carry is refused, because it is a path the server could never be asked to spawn afterwards.
1576
+ *
1577
+ * `position`, `rotation` and `scale` are where the ghost stands. `tint` washes it in a colour, with `a` below 1 making it translucent; omitted, every mesh keeps the materials it shipped with.
1578
+ * @returns The ghost, or null when this client has no world, at the ghost limit, and when not one of the meshes would load.
1579
+ */
1580
+ static create(options: { model?: string; models?: string[]; offsets?: Vector3[]; rotations?: Quaternion[]; position: Vector3; rotation?: Quaternion; scale?: number; tint?: Color }): PropGhost | null;
1581
+
1582
+ /**
1583
+ * Takes every ghost this client is drawing out of the world, including other resources'.
1584
+ */
1585
+ static destroyAll(): void;
1586
+ }
1587
+
1588
+ /**
1589
+ * Where a placement is aimed, and what it is aimed at.
1590
+ */
1591
+ interface PlacementPose {
1592
+ /**
1593
+ * Where the preview stands, in world-space metres.
1594
+ */
1595
+ position: Vector3;
1596
+
1597
+ /**
1598
+ * Which way it faces, including whatever the surface and the rotate keys added.
1599
+ */
1600
+ rotation: Quaternion;
1601
+
1602
+ /**
1603
+ * The surface normal under the aim, as a unit vector. Straight up when nothing was hit.
1604
+ */
1605
+ normal: Vector3;
1606
+
1607
+ /**
1608
+ * The game's own name for what is underfoot -- `mat_dirt`, `mat_stone`. Empty when nothing was hit.
1609
+ */
1610
+ surface: string;
1611
+
1612
+ /**
1613
+ * How far the aim point is from the camera, in metres.
1614
+ */
1615
+ distance: number;
1616
+
1617
+ /**
1618
+ * Whether the aim actually met something. False when the ray left the level, and the preview is standing at the fallback distance in mid-air.
1619
+ */
1620
+ onSurface: boolean;
1621
+ }
1622
+
1623
+ /**
1624
+ * Placement mode: a translucent preview under the crosshair, tinted for whether the spot is accepted, put down with a click.
1625
+ *
1626
+ * The loop is native and runs with the game's own frame, so the preview tracks the camera exactly and no script runs per frame. While a session is up this client's input belongs to it, the way one of the game's own screens takes it -- which is what stops a confirm click also swinging the player's sword, and what stops the player walking away mid-placement.
1627
+ *
1628
+ * One session at a time, and it belongs to the resource that started it: a resource that stops takes its session with it.
1629
+ *
1630
+ * **Nothing here is authority.** The rules below colour a preview at one client. What actually gets built is the server's decision, made again from the pose the client confirmed -- two players aiming at the same patch of ground both see green.
1631
+ */
1632
+ const PropPlacer: {
1633
+ /**
1634
+ * Starts placement. The preview appears under the crosshair on the same frame.
1635
+ * @param options `model`, `models`, `offsets` and `rotations` describe the preview exactly as `PropGhost.create` takes them.
1636
+ *
1637
+ * `validTint` and `invalidTint` are the two colours the preview flips between, translucent green and translucent red by default. `range` is how far the aim ray reaches in metres (40 by default, up to 512) and `fallbackDistance` is where the preview sits when the ray reaches nothing. `verticalOffset` lifts or sinks it, `yaw` is a fixed turn added to whatever the aim settles on, and the mouse wheel moves that while a session is up.
1638
+ *
1639
+ * `alignToSurface` stands the preview on the slope it is aimed at instead of upright; `faceAwayFromPlayer` turns it to face away from where you stand, which is what a wall or a tower wants and is on by default. `keepOpen` leaves the session running after a confirm so several can be placed in one go, and is on by default.
1640
+ *
1641
+ * `rules` is what the preview is tinted by, and every one of them is off unless named. `maxSlope` is degrees the ground may lean; `surfaces` is which surface names are allowed; `minDistance` and `maxDistance` bound how far from the player it may stand; `clearance` is metres that must be free of other entities, narrowed to `clearanceClasses` when given; `requireSurface` refuses a spot the ray never reached, and is on by default.
1642
+ * @returns True when the session started; false when one is already running, when this client has no world or camera, when another part of the mod holds the controls, and when the preview could not be built.
1643
+ */
1644
+ begin(options: { model?: string; models?: string[]; offsets?: Vector3[]; rotations?: Quaternion[]; scale?: number; validTint?: Color; invalidTint?: Color; range?: number; fallbackDistance?: number; verticalOffset?: number; yaw?: number; alignToSurface?: boolean; faceAwayFromPlayer?: boolean; keepOpen?: boolean; rules?: { maxSlope?: number; surfaces?: string[]; minDistance?: number; maxDistance?: number; clearance?: number; clearanceClasses?: string[]; requireSurface?: boolean } }): boolean;
1645
+
1646
+ /**
1647
+ * Ends the session and gives the player their input back. `end` is raised. Doing nothing when no session is running is not an error.
1648
+ */
1649
+ end(): void;
1650
+
1651
+ /**
1652
+ * Whether a placement session is running at this client right now.
1653
+ * @returns True while one is up.
1654
+ */
1655
+ isActive(): boolean;
1656
+
1657
+ /**
1658
+ * Refuses every spot until cleared, which is where a rule the engine cannot answer belongs -- what the player can afford, what the server has already said no to. It latches, so it costs the placement loop nothing.
1659
+ * @param vetoed Whether to refuse the spot whatever the rules say.
1660
+ * @returns True while a session is running.
1661
+ */
1662
+ setVeto(vetoed: boolean): boolean;
1663
+
1664
+ /**
1665
+ * Turns the preview, the same way the mouse wheel does while a session is up.
1666
+ * @param degrees How far to turn it, in degrees. Negative turns the other way.
1667
+ * @returns True while a session is running.
1668
+ */
1669
+ rotate(degrees: number): boolean;
1670
+
1671
+ /**
1672
+ * Where the placement is aimed right now, without waiting for a `move`.
1673
+ * @returns The pose, or null when no session is running and before the first aim settles.
1674
+ */
1675
+ getPose(): PlacementPose | null;
1676
+
1677
+ /**
1678
+ * Listens for one of the session's events. Handlers belong to the resource that registered them and go when it stops.
1679
+ * @param event `move` fires when the aim has travelled far enough to be worth reporting, and whenever the spot flips between accepted and refused -- it is throttled on purpose, because it is the one event that could otherwise fire every frame. `confirm` is a click the rules accepted, and is the one to send to the server. `rejected` is a click they refused, so the resource can say why; the session stays up. `cancel` is the player backing out. `end` is the session stopping, however it stopped, and is always the last one.
1680
+ * @param handler Called with where the placement is aimed and whether that spot is accepted. The pose is null for `cancel` and `end`.
1681
+ * @returns A function that removes this subscription.
1682
+ */
1683
+ on(event: "move" | "confirm" | "rejected" | "cancel" | "end", handler: PlacementHandler<PlacementPose>): Unsubscribe;
1684
+ };
1685
+
1686
+ /**
1687
+ * A screen composed inside one of the game's own Scaleform movies.
1688
+ */
1689
+ class NativeScreen {
1690
+ /**
1691
+ * Rebuilds a handle for a screen that already exists; use `NativeUI.createScreen()` to open one.
1692
+ * @param id Identifier of an existing screen.
1693
+ */
1694
+ constructor(id: number);
1695
+
1696
+ /**
1697
+ * Identifier of this screen, unique for the lifetime of the session.
1698
+ */
1699
+ readonly id: number;
1700
+
1701
+ /**
1702
+ * Whether the screen is still open.
1703
+ */
1704
+ readonly valid: boolean;
1705
+
1706
+ /**
1707
+ * Whether the movie has composed it yet. A screen is asked for before its movie is ready, so this is false for the first few frames and `root` is null until it turns true.
1708
+ */
1709
+ readonly ready: boolean;
1710
+
1711
+ /**
1712
+ * The screen's own empty root clip, and the parent everything else is created under. Null until `ready`.
1713
+ */
1714
+ readonly root: NativeClip | null;
1715
+
1716
+ /**
1717
+ * Formats this handle for logging.
1718
+ */
1719
+ toString(): string;
1720
+
1721
+ /**
1722
+ * Closes the screen, removing its subtree and every handler on it.
1723
+ * @returns True when it was still open.
1724
+ */
1725
+ close(): boolean;
1726
+
1727
+ /**
1728
+ * Shows or hides this screen's own subtree, leaving anything else in the same movie alone.
1729
+ * @param visible Defaults to true.
1730
+ * @returns True when the movie accepted it.
1731
+ */
1732
+ setVisible(visible?: boolean): boolean;
1733
+
1734
+ /**
1735
+ * Takes keyboard, controller and mouse input for this screen. One screen holds it at a time, and the game takes it back whenever a higher-priority context wants it.
1736
+ * @returns True when the screen now holds focus.
1737
+ */
1738
+ focus(): boolean;
1739
+
1740
+ /**
1741
+ * Gives up input focus, if this screen holds it.
1742
+ */
1743
+ blur(): void;
1744
+
1745
+ /**
1746
+ * Whether this screen currently holds input focus.
1747
+ * @returns True while it does.
1748
+ */
1749
+ hasFocus(): boolean;
1750
+
1751
+ /**
1752
+ * The movie's authored stage size, which is what positions inside the screen are expressed in. It is independent of the player's resolution.
1753
+ * @returns The stage size, or null before the movie is composed.
1754
+ */
1755
+ stage(): { width: number; height: number } | null;
1756
+
1757
+ /**
1758
+ * Converts a point on the player's screen into this movie's stage units, through the element's own viewport mapping.
1759
+ * @param x Horizontal viewport fraction, 0 to 1.
1760
+ * @param y Vertical viewport fraction, 0 to 1.
1761
+ * @returns The stage point, or null before the movie is composed.
1762
+ */
1763
+ screenToStage(x: number, y: number): { x: number; y: number } | null;
1764
+
1765
+ /**
1766
+ * Listens for one of this screen's notifications. `ready` fires when the movie has composed the screen, which is not the same tick as the call that opened it; `unload` when the engine takes the movie away; `input` carries a focus action and its activation mode; `event` carries a declared movie event and its arguments.
1767
+ * @param event Which notification to listen for.
1768
+ * @param handler Called on the next tick after it is raised.
1769
+ */
1770
+ on(event: 'ready' | 'unload' | 'input' | 'event', handler: NativeScreenHandler): void;
1771
+
1772
+ /**
1773
+ * Removes every handler this resource put on one notification.
1774
+ * @param event The notification to stop listening for.
1775
+ */
1776
+ off(event: string): void;
1777
+ }
1778
+
1779
+ /**
1780
+ * One display object inside a native screen: a clip, an attached sprite or a text field.
1781
+ */
1782
+ class NativeClip {
1783
+ /**
1784
+ * Rebuilds a handle for a display object that already exists. Clips come from `screen.root` and the create calls on it.
1785
+ * @param screen Screen this handle belongs to.
1786
+ * @param key Handle key inside that screen.
1787
+ */
1788
+ constructor(screen: number, key: string);
1789
+
1790
+ /**
1791
+ * Identifier of the screen this handle belongs to.
1792
+ */
1793
+ readonly screen: number;
1794
+
1795
+ /**
1796
+ * The screen-local key this handle resolves through.
1797
+ */
1798
+ readonly key: string;
1799
+
1800
+ /**
1801
+ * Whether the screen still holds this object. A handle to a removed object keeps reading and every call on it fails cleanly.
1802
+ */
1803
+ readonly valid: boolean;
1804
+
1805
+ /**
1806
+ * Formats this handle for logging.
1807
+ */
1808
+ toString(): string;
1809
+
1810
+ /**
1811
+ * Attaches one of the game's own exported sprites as a child of this clip. Which names exist depends on the library the screen was opened with.
1812
+ * @param exportName Linkage name of a sprite the screen's library exports.
1813
+ * @returns The new child, or null when the library has no such export.
1814
+ */
1815
+ attach(exportName: string): NativeClip | null;
1816
+
1817
+ /**
1818
+ * Creates an empty child clip, for grouping and for drawing into.
1819
+ * @returns The new child, or null when the screen is not composed.
1820
+ */
1821
+ createClip(): NativeClip | null;
1822
+
1823
+ /**
1824
+ * Creates a native text field as a child of this clip.
1825
+ * @param options Where the field goes in this clip's own coordinates, how big it is, and what it starts with.
1826
+ * @returns The new field, or null when the screen is not composed.
1827
+ */
1828
+ createText(options: { x: number; y: number; width: number; height: number; text?: string; html?: string }): NativeClip | null;
1829
+
1830
+ /**
1831
+ * Moves, scales, rotates, fades or hides this display object.
1832
+ * @param options Only the fields present are applied. Position is in stage units, rotation in degrees, scale as a multiplier where 1 is natural size, alpha from 0 to 1.
1833
+ * @returns True when the movie accepted the update.
1834
+ */
1835
+ set(options: { x?: number; y?: number; rotation?: number; scaleX?: number; scaleY?: number; alpha?: number; visible?: boolean }): boolean;
1836
+
1837
+ /**
1838
+ * Reads one scalar property off this display object. Property access can run an ActionScript getter.
1839
+ * @param member ActionScript property name, such as `_width` or `_currentframe`.
1840
+ * @returns The value, or null when it is absent or not a scalar.
1841
+ */
1842
+ get(member: string): any;
1843
+
1844
+ /**
1845
+ * Assigns one scalar property on this display object.
1846
+ * @param member ActionScript property name.
1847
+ * @param value What to assign.
1848
+ * @returns True when the movie accepted it.
1849
+ */
1850
+ setMember(member: string, value: string | number | boolean | null): boolean;
1851
+
1852
+ /**
1853
+ * Sets how this field draws, for the text it holds and the text it is given next. A field created through `createText` already has the default applied; this restyles it.
1854
+ * @param options `font` is one of the game's own mapped names -- DefaultFont, DefaultFontBold, DefaultFontItalic, LightFont, LightFontBold, LightFontItalic, DisplayFont, Manuscript -- and not a face name. `color` is 0xRRGGBB.
1855
+ * @returns True when the movie accepted the format.
1856
+ */
1857
+ setTextStyle(options: { font?: string; size?: number; color?: number; bold?: boolean; italic?: boolean; align?: 'left' | 'center' | 'right' | 'justify' }): boolean;
1858
+
1859
+ /**
1860
+ * Writes this field's text. On a clip rather than a field it assigns the `text` property, which is not the same as writing a field inside it.
1861
+ * @param text The text to show.
1862
+ * @param html Parse it as the engine's HTML subset instead of plain text.
1863
+ * @returns True when the movie accepted the write.
1864
+ */
1865
+ setText(text: string, html?: boolean): boolean;
1866
+
1867
+ /**
1868
+ * Reads this field's text back.
1869
+ * @param html Read the generated markup instead of the plain text.
1870
+ * @returns The text, or null when there is none to read.
1871
+ */
1872
+ getText(html?: boolean): string | null;
1873
+
1874
+ /**
1875
+ * Moves this clip's own timeline. A timeline change can replace named children, so reacquire anything below it afterwards.
1876
+ * @param frameOrLabel A one-based frame number, or a frame label.
1877
+ * @param play Keep playing from there instead of stopping.
1878
+ * @returns True when the frame or label resolved.
1879
+ */
1880
+ goto(frameOrLabel: number | string, play?: boolean): boolean;
1881
+
1882
+ /**
1883
+ * Calls a method on this display object. Only scalars cross, and the result is a scalar.
1884
+ * @param method Method name on this object.
1885
+ * @param args Scalar arguments. They may also be passed loose, one per parameter.
1886
+ * @returns What ActionScript returned, or null when the call failed.
1887
+ */
1888
+ invoke(method: string, args?: (string | number | boolean | null)[]): any;
1889
+
1890
+ /**
1891
+ * Installs one ActionScript mouse handler on this clip and enables it as a mouse target. The screen also has to hold input focus for the mouse to reach it.
1892
+ * @param event Which mouse handler to install.
1893
+ * @param handler Called on the next tick after the movie raises it.
1894
+ * @returns True when the handler was installed.
1895
+ */
1896
+ on(event: 'press' | 'release' | 'releaseOutside' | 'rollOver' | 'rollOut' | 'dragOver' | 'dragOut', handler: NativeClipHandler<NativeClip>): boolean;
1897
+
1898
+ /**
1899
+ * Removes one mouse handler, deleting the ActionScript member rather than assigning null to it.
1900
+ * @param event The handler to take off.
1901
+ */
1902
+ off(event: string): void;
1903
+
1904
+ /**
1905
+ * Binds another clip as this one's mask. One mask belongs to one target: binding it elsewhere detaches it from here.
1906
+ * @param mask A clip from this same screen, or null to clear.
1907
+ * @returns True when the movie took the binding.
1908
+ */
1909
+ setMask(mask: NativeClip | null): boolean;
1910
+
1911
+ /**
1912
+ * Makes another clip the region this one is clicked through, for a target whose artwork is the wrong shape to click.
1913
+ * @param area A clip from this same screen, or null to clear.
1914
+ * @returns True when the movie took the binding.
1915
+ */
1916
+ setHitArea(area: NativeClip | null): boolean;
1917
+
1918
+ /**
1919
+ * Loads an external image or movie into this clip, replacing what it holds. A missing asset installs the engine's placeholder rather than failing, so a true result is not an existence check.
1920
+ * @param url `img://` or `imgps://` for the engine's image loader, or a movie path inside the mounted archive.
1921
+ * @returns True when the request was accepted.
1922
+ */
1923
+ load(url: string): boolean;
1924
+
1925
+ /**
1926
+ * Takes this display object out of the screen, with its handlers.
1927
+ * @returns True when it was still there to remove.
1928
+ */
1929
+ remove(): boolean;
1930
+ }
1931
+
1932
+ /**
1933
+ * A handle on one of the game's own UI elements, driven where it stands.
1934
+ */
1935
+ class NativeElement {
1936
+ /**
1937
+ * Rebuilds a handle for an element; use `NativeUI.element()` to get one.
1938
+ * @param name Element name, as its XML declares it.
1939
+ * @param instanceId Instance id.
1940
+ */
1941
+ constructor(name: string, instanceId: number);
1942
+
1943
+ /**
1944
+ * The element's name, as its XML declares it.
1945
+ */
1946
+ readonly name: string;
1947
+
1948
+ /**
1949
+ * Which instance this handle drives. Instance 0 is the one the game itself uses; any other number is a private copy of the same element.
1950
+ */
1951
+ readonly instanceId: number;
1952
+
1953
+ /**
1954
+ * Whether the element is still registered.
1955
+ */
1956
+ readonly valid: boolean;
1957
+
1958
+ /**
1959
+ * Whether the element is visible right now.
1960
+ */
1961
+ readonly visible: boolean;
1962
+
1963
+ /**
1964
+ * Formats this handle for logging.
1965
+ */
1966
+ toString(): string;
1967
+
1968
+ /**
1969
+ * Calls one of the element's declared functions. The element has to be loaded: show it first, or call this on one the game already has up.
1970
+ * @param fn A function the element's XML declares, by its display name or its ActionScript name.
1971
+ * @param args Scalar arguments. They may also be passed loose, one per parameter.
1972
+ * @returns What ActionScript returned, or null when the call failed.
1973
+ */
1974
+ call(fn: string, args?: (string | number | boolean | null)[]): any;
1975
+
1976
+ /**
1977
+ * Assigns one of the element's declared variables.
1978
+ * @param name A variable the element's XML declares.
1979
+ * @param value What to assign.
1980
+ * @returns True when the movie accepted it.
1981
+ */
1982
+ setVariable(name: string, value: string | number | boolean | null): boolean;
1983
+
1984
+ /**
1985
+ * Reads one of the element's declared variables.
1986
+ * @param name A variable the element's XML declares.
1987
+ * @returns The value, or null when it is absent.
1988
+ */
1989
+ getVariable(name: string): any;
1990
+
1991
+ /**
1992
+ * Replaces one of the element's declared arrays. This is how the game's own list screens are filled.
1993
+ * @param name An array the element's XML declares.
1994
+ * @param values The new contents.
1995
+ * @returns True when the movie accepted it.
1996
+ */
1997
+ setArray(name: string, values: (string | number | boolean | null)[]): boolean;
1998
+
1999
+ /**
2000
+ * Reads one of the element's declared arrays.
2001
+ * @param name An array the element's XML declares.
2002
+ * @returns Its contents, or null when it is absent.
2003
+ */
2004
+ getArray(name: string): any[] | null;
2005
+
2006
+ /**
2007
+ * Moves one of the element's declared movie clips. Two of the game's elements declare any: the HUD and the lockpicking screen.
2008
+ * @param name A movie clip the element's XML declares.
2009
+ * @param options Only the fields present are applied.
2010
+ * @returns True when the movie accepted it.
2011
+ */
2012
+ setClip(name: string, options: { x?: number; y?: number; rotation?: number; scaleX?: number; scaleY?: number; alpha?: number; visible?: boolean }): boolean;
2013
+
2014
+ /**
2015
+ * Reads one of the element's declared movie clips back. Scale and alpha come back as multipliers, the way `setClip` takes them.
2016
+ * @param name A movie clip the element's XML declares.
2017
+ * @returns Its display fields, or null when the clip is absent.
2018
+ */
2019
+ getClip(name: string): { x: number; y: number; rotation: number; scaleX: number; scaleY: number; alpha: number; visible: boolean } | null;
2020
+
2021
+ /**
2022
+ * Moves a declared movie clip's timeline, which is how a clip with several authored looks is switched between them.
2023
+ * @param name A movie clip the element's XML declares.
2024
+ * @param frameOrLabel A one-based frame number, or a frame label.
2025
+ * @param play Keep playing from there instead of stopping.
2026
+ * @returns True when the frame or label resolved.
2027
+ */
2028
+ gotoClip(name: string, frameOrLabel: number | string, play?: boolean): boolean;
2029
+
2030
+ /**
2031
+ * Shows the element, loading its movie if it was not loaded.
2032
+ * @returns True when the element took it.
2033
+ */
2034
+ show(): boolean;
2035
+
2036
+ /**
2037
+ * Hides the element at once.
2038
+ * @returns True when the element took it.
2039
+ */
2040
+ hide(): boolean;
2041
+
2042
+ /**
2043
+ * Asks the element to play its own hide transition instead of vanishing.
2044
+ * @returns True when the element took it.
2045
+ */
2046
+ requestHide(): boolean;
2047
+
2048
+ /**
2049
+ * Rebuilds the element's movie from cached assets. Everything composed into it is gone afterwards.
2050
+ * @returns True when the element took it.
2051
+ */
2052
+ reload(): boolean;
2053
+
2054
+ /**
2055
+ * Drops the element's movie. The next `show` loads it again.
2056
+ * @returns True when the element took it.
2057
+ */
2058
+ unload(): boolean;
2059
+
2060
+ /**
2061
+ * Listens for one of the element's declared events. This is how a click on a game screen reaches script.
2062
+ * @param event An event the element's XML declares, by its display name.
2063
+ * @param handler Called on the next tick after the movie raises it.
2064
+ */
2065
+ on(event: string, handler: NativeElementHandler): void;
2066
+
2067
+ /**
2068
+ * Removes every handler this resource put on one event.
2069
+ * @param event The event to stop listening for.
2070
+ */
2071
+ off(event: string): void;
2072
+ }
2073
+
2074
+ /**
2075
+ * The game's own Scaleform UI, opened from script. This is the second way to draw a UI at this client, beside `Web`: a web view is a browser and lays out anything, a native screen is composed out of the game's own movies, sits inside the game's own layer stack and is navigable with a controller.
2076
+ */
2077
+ const NativeUI: {
2078
+ /**
2079
+ * Opens a screen. It is composed a few frames later, when its movie reports ready -- listen for `ready` rather than drawing into it straight away.
2080
+ * @param options `library` names which of the game's movies the screen may attach exported sprites from, empty for the default. `movie` is a path inside this resource to a movie it ships, which opens a screen in that instead. `assets` are further files that movie loads, and `layer` is where it sits in the game's own stack.
2081
+ * @returns The screen handle.
2082
+ */
2083
+ createScreen(options?: { library?: string; movie?: string; assets?: string[]; layer?: number }): NativeScreen;
2084
+
2085
+ /**
2086
+ * Lists the game movies a screen can be opened against and the linkage names each one exports, read from the bundle rather than from a list kept in step by hand. `name` is what `createScreen({library})` takes, and the empty one is the default host.
2087
+ * @returns One entry per bundled library.
2088
+ */
2089
+ libraries(): { name: string; movie: string; exports: string[] }[];
2090
+
2091
+ /**
2092
+ * Takes a handle on one of the game's own UI elements. Picking an instance id other than 0 gives a private copy of that element, which is how a mod puts its own content on a game screen without fighting the game's copy.
2093
+ * @param name Element name, as the game's own XML declares it: `Menu`, `hud`, `ApseModalDialog` and the rest.
2094
+ * @param instanceId Which instance to drive; 0, the game's own, by default.
2095
+ * @returns The element handle.
2096
+ */
2097
+ element(name: string, instanceId?: number): NativeElement;
2098
+ };
2099
+
2100
+ /**
2101
+ * Whether this client's gameplay input reaches the game, and whether the mod draws a pointer.
2102
+ *
2103
+ * A focused web view takes both already, so a panel opened with `Web.focusView` needs nothing here. This is for what focus cannot say: a pointer without freezing the player, a freeze without a pointer, or no pointer at all for a page that draws its own.
2104
+ *
2105
+ * Every hold is counted and belongs to the resource that took it, so two resources cannot release each other's, and one that stops gives back exactly what it took.
2106
+ */
2107
+ const Controls: {
2108
+ /**
2109
+ * Takes this client's gameplay input away from the game without drawing a pointer. The camera stops turning and the character stops moving.
2110
+ */
2111
+ disable(): void;
2112
+
2113
+ /**
2114
+ * Gives back one hold taken by `disable`. Input returns once nothing else holds it -- a focused panel, the chat line, an overlay.
2115
+ */
2116
+ enable(): void;
2117
+
2118
+ /**
2119
+ * Whether gameplay input is reaching the game right now.
2120
+ * @returns False while anything holds it, this resource or not.
2121
+ */
2122
+ isEnabled(): boolean;
2123
+
2124
+ /**
2125
+ * Draws the mod's pointer without taking input. Its shape follows the topmost focused page, so a page's own `cursor` styling is what the player sees.
2126
+ */
2127
+ showCursor(): void;
2128
+
2129
+ /**
2130
+ * Gives back one hold taken by `showCursor`.
2131
+ */
2132
+ hideCursor(): void;
2133
+
2134
+ /**
2135
+ * Whether the mod's pointer is drawn right now.
2136
+ * @returns True while anything holds it, this resource or not.
2137
+ */
2138
+ isCursorVisible(): boolean;
2139
+ };
2140
+
2141
+ /**
2142
+ * One gesture of the shipped emote catalog, which is every gesture a wheel slot can choose.
2143
+ */
2144
+ interface EmoteCatalogEntry {
2145
+ /**
2146
+ * What a slot is set to, and what goes on the wire when the gesture plays.
2147
+ */
2148
+ id: number;
2149
+
2150
+ /**
2151
+ * The label the wheel draws for it.
2152
+ */
2153
+ name: string;
2154
+
2155
+ /**
2156
+ * How long the gesture plays, in seconds.
2157
+ */
2158
+ duration: number;
2159
+
2160
+ /**
2161
+ * Whether it takes the whole body. A full-body gesture holds the player still while it plays; an upper-body one plays over a walk.
2162
+ */
2163
+ fullBody: boolean;
2164
+ }
2165
+
2166
+ /**
2167
+ * Which gesture each slot of this client's emote wheel chooses.
2168
+ *
2169
+ * The wheel has a fixed number of slots, numbered clockwise from the one straight up, and each chooses one row of the shipped catalog. They start out as the stock wheel -- wave, big wave, nod, respectful nod, bow, cheer -- and stay that way until a script changes them. A change is drawn on the next frame, including on a wheel held open.
2170
+ *
2171
+ * Client-only and local: this arranges the wheel on this machine and nothing else. Every client can already play every gesture in the catalog, so a slot changes what is within reach, not what is allowed. The layout lasts for the session, and the next one starts from the default.
2172
+ */
2173
+ const EmoteWheel: {
2174
+ /**
2175
+ * How many slots the wheel has.
2176
+ * @returns The slot count, which the catalog growing does not change.
2177
+ */
2178
+ getSlotCount(): number;
2179
+
2180
+ /**
2181
+ * The catalog id each slot chooses, in slot order.
2182
+ * @returns One id per slot.
2183
+ */
2184
+ getSlots(): number[];
2185
+
2186
+ /**
2187
+ * Points one slot at a catalog gesture. The same gesture may sit in more than one slot.
2188
+ * @param slot Zero-based, clockwise from straight up.
2189
+ * @param emoteId An `id` from `getCatalog`.
2190
+ * @returns False, and nothing changes, when the slot is out of range or the id is not in the catalog.
2191
+ */
2192
+ setSlot(slot: number, emoteId: number): boolean;
2193
+
2194
+ /**
2195
+ * Lays out the whole wheel at once.
2196
+ * @param emoteIds One catalog id per slot, in slot order; exactly `getSlotCount()` of them.
2197
+ * @returns False, and nothing changes, when the list is the wrong length or any id is not in the catalog.
2198
+ */
2199
+ setSlots(emoteIds: number[]): boolean;
2200
+
2201
+ /**
2202
+ * Puts every slot back to the stock wheel: wave, big wave, nod, respectful nod, bow, cheer.
2203
+ */
2204
+ reset(): void;
2205
+
2206
+ /**
2207
+ * Every gesture a slot can choose.
2208
+ * @returns The catalog, in its own order.
2209
+ */
2210
+ getCatalog(): EmoteCatalogEntry[];
2211
+ };
2212
+
2213
+ /**
2214
+ * Mutable two-dimensional vector.
2215
+ */
2216
+ class Vector2 {
2217
+ /**
2218
+ * Creates a vector from two numeric components.
2219
+ * @param x Initial X component.
2220
+ * @param y Initial Y component.
2221
+ */
2222
+ constructor(x: number, y: number);
2223
+
2224
+ /**
2225
+ * Mutable X component.
2226
+ */
2227
+ x: number;
2228
+
2229
+ /**
2230
+ * Mutable Y component.
2231
+ */
2232
+ y: number;
2233
+
2234
+ /**
2235
+ * Read-only Euclidean magnitude of this vector.
2236
+ */
2237
+ readonly length: number;
2238
+
2239
+ /**
2240
+ * Read-only squared magnitude, avoiding a square-root calculation.
2241
+ */
2242
+ readonly lengthSquared: number;
2243
+
2244
+ /**
2245
+ * Adds another vector to this vector in place.
2246
+ * @param other Vector to add component-wise.
2247
+ * @returns This mutated vector for chaining.
2248
+ */
2249
+ add(other: Vector2): this;
2250
+
2251
+ /**
2252
+ * Subtracts another vector from this vector in place.
2253
+ * @param other Vector to subtract component-wise.
2254
+ * @returns This mutated vector for chaining.
2255
+ */
2256
+ sub(other: Vector2): this;
2257
+
2258
+ /**
2259
+ * Multiplies this vector by a scalar in place.
2260
+ * @param scalar Multiplier applied to both components.
2261
+ * @returns This mutated vector for chaining.
2262
+ */
2263
+ mul(scalar: number): this;
2264
+
2265
+ /**
2266
+ * Divides this vector by a scalar in place.
2267
+ * @param scalar Divisor applied to both components; must be non-zero.
2268
+ * @returns This mutated vector for chaining.
2269
+ */
2270
+ div(scalar: number): this;
2271
+
2272
+ /**
2273
+ * Computes the dot product without changing either vector.
2274
+ * @param other Vector used for the dot product.
2275
+ * @returns Scalar dot product.
2276
+ */
2277
+ dot(other: Vector2): number;
2278
+
2279
+ /**
2280
+ * Normalizes this vector in place; a zero vector remains unchanged.
2281
+ * @returns This mutated vector for chaining.
2282
+ */
2283
+ normalize(): this;
2284
+
2285
+ /**
2286
+ * Linearly interpolates this vector toward a target in place.
2287
+ * @param target Destination vector.
2288
+ * @param t Interpolation factor; 0 keeps the current value and 1 reaches target.
2289
+ * @returns This mutated vector for chaining.
2290
+ */
2291
+ lerp(target: Vector2, t: number): this;
2292
+
2293
+ /**
2294
+ * Replaces both components in place.
2295
+ * @param x Replacement X component.
2296
+ * @param y Replacement Y component.
2297
+ * @returns This mutated vector for chaining.
2298
+ */
2299
+ set(x: number, y: number): this;
2300
+
2301
+ /**
2302
+ * Computes Euclidean distance to another vector.
2303
+ * @param other Vector to measure from this vector.
2304
+ * @returns Distance between the two vectors.
2305
+ */
2306
+ distance(other: Vector2): number;
2307
+
2308
+ /**
2309
+ * Creates an independent copy of this vector.
2310
+ * @returns New vector with the same components.
2311
+ */
2312
+ clone(): Vector2;
2313
+
2314
+ /**
2315
+ * Formats this vector for logging and debugging.
2316
+ * @returns Text in Vector2(x, y) form.
2317
+ */
2318
+ toString(): string;
2319
+
2320
+ /**
2321
+ * Converts this vector to a plain object for JSON.stringify.
2322
+ * @returns Object containing the current components.
2323
+ */
2324
+ toJSON(): { x: number; y: number };
2325
+
2326
+ /**
2327
+ * Creates a vector whose components are zero.
2328
+ * @returns New Vector2(0, 0).
2329
+ */
2330
+ static zero(): Vector2;
2331
+
2332
+ /**
2333
+ * Creates a vector whose components are one.
2334
+ * @returns New Vector2(1, 1).
2335
+ */
2336
+ static one(): Vector2;
2337
+ }
2338
+
2339
+ /**
2340
+ * Mutable three-dimensional vector for positions, directions, and Euler angles.
2341
+ */
2342
+ class Vector3 {
2343
+ /**
2344
+ * Creates a vector from three numeric components.
2345
+ * @param x Initial X component.
2346
+ * @param y Initial Y component.
2347
+ * @param z Initial Z component.
2348
+ */
2349
+ constructor(x: number, y: number, z: number);
2350
+
2351
+ /**
2352
+ * Mutable X component.
2353
+ */
2354
+ x: number;
2355
+
2356
+ /**
2357
+ * Mutable Y component.
2358
+ */
2359
+ y: number;
2360
+
2361
+ /**
2362
+ * Mutable Z component.
2363
+ */
2364
+ z: number;
2365
+
2366
+ /**
2367
+ * Read-only Euclidean magnitude of this vector.
2368
+ */
2369
+ readonly length: number;
2370
+
2371
+ /**
2372
+ * Read-only squared magnitude, avoiding a square-root calculation.
2373
+ */
2374
+ readonly lengthSquared: number;
2375
+
2376
+ /**
2377
+ * Adds another vector to this vector in place.
2378
+ * @param other Vector to add component-wise.
2379
+ * @returns This mutated vector for chaining.
2380
+ */
2381
+ add(other: Vector3): this;
2382
+
2383
+ /**
2384
+ * Subtracts another vector from this vector in place.
2385
+ * @param other Vector to subtract component-wise.
2386
+ * @returns This mutated vector for chaining.
2387
+ */
2388
+ sub(other: Vector3): this;
2389
+
2390
+ /**
2391
+ * Multiplies this vector by a scalar in place.
2392
+ * @param scalar Multiplier applied to every component.
2393
+ * @returns This mutated vector for chaining.
2394
+ */
2395
+ mul(scalar: number): this;
2396
+
2397
+ /**
2398
+ * Divides this vector by a scalar in place.
2399
+ * @param scalar Divisor applied to every component; must be non-zero.
2400
+ * @returns This mutated vector for chaining.
2401
+ */
2402
+ div(scalar: number): this;
2403
+
2404
+ /**
2405
+ * Computes the dot product without changing either vector.
2406
+ * @param other Vector used for the dot product.
2407
+ * @returns Scalar dot product.
2408
+ */
2409
+ dot(other: Vector3): number;
2410
+
2411
+ /**
2412
+ * Replaces this vector with its cross product against another vector.
2413
+ * @param other Second vector in the cross product.
2414
+ * @returns This mutated perpendicular vector for chaining.
2415
+ */
2416
+ cross(other: Vector3): this;
2417
+
2418
+ /**
2419
+ * Normalizes this vector in place; a zero vector remains unchanged.
2420
+ * @returns This mutated vector for chaining.
2421
+ */
2422
+ normalize(): this;
2423
+
2424
+ /**
2425
+ * Linearly interpolates this vector toward a target in place.
2426
+ * @param target Destination vector.
2427
+ * @param t Interpolation factor; 0 keeps the current value and 1 reaches target.
2428
+ * @returns This mutated vector for chaining.
2429
+ */
2430
+ lerp(target: Vector3, t: number): this;
2431
+
2432
+ /**
2433
+ * Replaces all components in place.
2434
+ * @param x Replacement X component.
2435
+ * @param y Replacement Y component.
2436
+ * @param z Replacement Z component.
2437
+ * @returns This mutated vector for chaining.
2438
+ */
2439
+ set(x: number, y: number, z: number): this;
2440
+
2441
+ /**
2442
+ * Computes Euclidean distance to another vector.
2443
+ * @param other Vector to measure from this vector.
2444
+ * @returns Distance between the two vectors.
2445
+ */
2446
+ distance(other: Vector3): number;
2447
+
2448
+ /**
2449
+ * Creates an independent copy of this vector.
2450
+ * @returns New vector with the same components.
2451
+ */
2452
+ clone(): Vector3;
2453
+
2454
+ /**
2455
+ * Formats this vector for logging and debugging.
2456
+ * @returns Text in Vector3(x, y, z) form.
2457
+ */
2458
+ toString(): string;
2459
+
2460
+ /**
2461
+ * Converts this vector to a plain object for JSON.stringify.
2462
+ * @returns Object containing the current components.
2463
+ */
2464
+ toJSON(): { x: number; y: number; z: number };
2465
+
2466
+ /**
2467
+ * Creates a zero vector.
2468
+ * @returns New Vector3(0, 0, 0).
2469
+ */
2470
+ static zero(): Vector3;
2471
+
2472
+ /**
2473
+ * Creates a vector whose components are one.
2474
+ * @returns New Vector3(1, 1, 1).
2475
+ */
2476
+ static one(): Vector3;
2477
+
2478
+ /**
2479
+ * Creates the framework's positive-Y unit direction.
2480
+ * @returns New Vector3(0, 1, 0).
2481
+ */
2482
+ static up(): Vector3;
2483
+
2484
+ /**
2485
+ * Creates the framework's positive-Z unit direction.
2486
+ * @returns New Vector3(0, 0, 1).
2487
+ */
2488
+ static forward(): Vector3;
2489
+
2490
+ /**
2491
+ * Creates the framework's positive-X unit direction.
2492
+ * @returns New Vector3(1, 0, 0).
2493
+ */
2494
+ static right(): Vector3;
2495
+ }
2496
+
2497
+ /**
2498
+ * Mutable four-dimensional vector.
2499
+ */
2500
+ class Vector4 {
2501
+ /**
2502
+ * Creates a vector from four numeric components.
2503
+ * @param x Initial X component.
2504
+ * @param y Initial Y component.
2505
+ * @param z Initial Z component.
2506
+ * @param w Initial W component.
2507
+ */
2508
+ constructor(x: number, y: number, z: number, w: number);
2509
+
2510
+ /**
2511
+ * Mutable X component.
2512
+ */
2513
+ x: number;
2514
+
2515
+ /**
2516
+ * Mutable Y component.
2517
+ */
2518
+ y: number;
2519
+
2520
+ /**
2521
+ * Mutable Z component.
2522
+ */
2523
+ z: number;
2524
+
2525
+ /**
2526
+ * Mutable W component.
2527
+ */
2528
+ w: number;
2529
+
2530
+ /**
2531
+ * Read-only Euclidean magnitude of this vector.
2532
+ */
2533
+ readonly length: number;
2534
+
2535
+ /**
2536
+ * Read-only squared magnitude, avoiding a square-root calculation.
2537
+ */
2538
+ readonly lengthSquared: number;
2539
+
2540
+ /**
2541
+ * Adds another vector to this vector in place.
2542
+ * @param other Vector to add component-wise.
2543
+ * @returns This mutated vector for chaining.
2544
+ */
2545
+ add(other: Vector4): this;
2546
+
2547
+ /**
2548
+ * Subtracts another vector from this vector in place.
2549
+ * @param other Vector to subtract component-wise.
2550
+ * @returns This mutated vector for chaining.
2551
+ */
2552
+ sub(other: Vector4): this;
2553
+
2554
+ /**
2555
+ * Multiplies this vector by a scalar in place.
2556
+ * @param scalar Multiplier applied to every component.
2557
+ * @returns This mutated vector for chaining.
2558
+ */
2559
+ mul(scalar: number): this;
2560
+
2561
+ /**
2562
+ * Divides this vector by a scalar in place.
2563
+ * @param scalar Divisor applied to every component; must be non-zero.
2564
+ * @returns This mutated vector for chaining.
2565
+ */
2566
+ div(scalar: number): this;
2567
+
2568
+ /**
2569
+ * Computes the dot product without changing either vector.
2570
+ * @param other Vector used for the dot product.
2571
+ * @returns Scalar dot product.
2572
+ */
2573
+ dot(other: Vector4): number;
2574
+
2575
+ /**
2576
+ * Computes Euclidean distance to another vector.
2577
+ * @param other Vector to measure from this vector.
2578
+ * @returns Distance between the two vectors.
2579
+ */
2580
+ distance(other: Vector4): number;
2581
+
2582
+ /**
2583
+ * Normalizes this vector in place; a zero vector remains unchanged.
2584
+ * @returns This mutated vector for chaining.
2585
+ */
2586
+ normalize(): this;
2587
+
2588
+ /**
2589
+ * Linearly interpolates this vector toward a target in place.
2590
+ * @param target Destination vector.
2591
+ * @param t Interpolation factor; 0 keeps the current value and 1 reaches target.
2592
+ * @returns This mutated vector for chaining.
2593
+ */
2594
+ lerp(target: Vector4, t: number): this;
2595
+
2596
+ /**
2597
+ * Replaces all components in place.
2598
+ * @param x Replacement X component.
2599
+ * @param y Replacement Y component.
2600
+ * @param z Replacement Z component.
2601
+ * @param w Replacement W component.
2602
+ * @returns This mutated vector for chaining.
2603
+ */
2604
+ set(x: number, y: number, z: number, w: number): this;
2605
+
2606
+ /**
2607
+ * Creates an independent copy of this vector.
2608
+ * @returns New vector with the same components.
2609
+ */
2610
+ clone(): Vector4;
2611
+
2612
+ /**
2613
+ * Formats this vector for logging and debugging.
2614
+ * @returns Text in Vector4(x, y, z, w) form.
2615
+ */
2616
+ toString(): string;
2617
+
2618
+ /**
2619
+ * Converts this vector to a plain object for JSON.stringify.
2620
+ * @returns Object containing the current components.
2621
+ */
2622
+ toJSON(): { x: number; y: number; z: number; w: number };
2623
+
2624
+ /**
2625
+ * Creates a zero vector.
2626
+ * @returns New Vector4(0, 0, 0, 0).
2627
+ */
2628
+ static zero(): Vector4;
2629
+
2630
+ /**
2631
+ * Creates a vector whose components are one.
2632
+ * @returns New Vector4(1, 1, 1, 1).
2633
+ */
2634
+ static one(): Vector4;
2635
+ }
2636
+
2637
+ /**
2638
+ * Mutable quaternion for three-dimensional rotations. Components are scalar-first (w, x, y, z), matching GLM — not the x, y, z, w order some libraries use.
2639
+ */
2640
+ class Quaternion {
2641
+ /**
2642
+ * Creates a quaternion in scalar-first w, x, y, z component order. Watch the trap: the scalar w is the first argument, unlike the x, y, z, w order used by some other libraries.
2643
+ * @param w Initial scalar component (comes first — this is not x, y, z, w order).
2644
+ * @param x Initial X imaginary component.
2645
+ * @param y Initial Y imaginary component.
2646
+ * @param z Initial Z imaginary component.
2647
+ */
2648
+ constructor(w: number, x: number, y: number, z: number);
2649
+
2650
+ /**
2651
+ * Mutable scalar component.
2652
+ */
2653
+ w: number;
2654
+
2655
+ /**
2656
+ * Mutable X imaginary component.
2657
+ */
2658
+ x: number;
2659
+
2660
+ /**
2661
+ * Mutable Y imaginary component.
2662
+ */
2663
+ y: number;
2664
+
2665
+ /**
2666
+ * Mutable Z imaginary component.
2667
+ */
2668
+ z: number;
2669
+
2670
+ /**
2671
+ * Read-only magnitude (norm) of this quaternion; 1 for a unit rotation.
2672
+ */
2673
+ readonly length: number;
2674
+
2675
+ /**
2676
+ * Read-only squared magnitude, avoiding a square-root calculation.
2677
+ */
2678
+ readonly lengthSquared: number;
2679
+
2680
+ /**
2681
+ * Composes this rotation with another quaternion in place.
2682
+ * @param other Rotation composed after this quaternion.
2683
+ * @returns This mutated quaternion for chaining.
2684
+ */
2685
+ mul(other: Quaternion): this;
2686
+
2687
+ /**
2688
+ * Normalizes this quaternion in place; a zero quaternion becomes the identity rotation instead of NaN.
2689
+ * @returns This unit quaternion for chaining.
2690
+ */
2691
+ normalize(): this;
2692
+
2693
+ /**
2694
+ * Computes the conjugate without changing this quaternion.
2695
+ * @returns New conjugated quaternion.
2696
+ */
2697
+ conjugate(): Quaternion;
2698
+
2699
+ /**
2700
+ * Computes the inverse rotation without changing this quaternion.
2701
+ * @returns New inverse quaternion.
2702
+ */
2703
+ inverse(): Quaternion;
2704
+
2705
+ /**
2706
+ * Spherically interpolates this quaternion toward a target in place.
2707
+ * @param target Destination rotation.
2708
+ * @param t Interpolation factor; 0 keeps the current rotation and 1 reaches target.
2709
+ * @returns This mutated quaternion for chaining.
2710
+ */
2711
+ slerp(target: Quaternion, t: number): this;
2712
+
2713
+ /**
2714
+ * Computes the quaternion dot product.
2715
+ * @param other Quaternion used for the dot product.
2716
+ * @returns Scalar dot product.
2717
+ */
2718
+ dot(other: Quaternion): number;
2719
+
2720
+ /**
2721
+ * Applies this rotation to a vector without mutating either value.
2722
+ * @param vector Vector to rotate.
2723
+ * @returns New rotated vector.
2724
+ */
2725
+ rotateVector(vector: Vector3): Vector3;
2726
+
2727
+ /**
2728
+ * Converts this rotation to Euler angles in radians.
2729
+ * @returns Pitch, yaw, and roll as a Vector3.
2730
+ */
2731
+ toEuler(): Vector3;
2732
+
2733
+ /**
2734
+ * Replaces all quaternion components in place.
2735
+ * @param w Replacement scalar component.
2736
+ * @param x Replacement X imaginary component.
2737
+ * @param y Replacement Y imaginary component.
2738
+ * @param z Replacement Z imaginary component.
2739
+ * @returns This mutated quaternion for chaining.
2740
+ */
2741
+ set(w: number, x: number, y: number, z: number): this;
2742
+
2743
+ /**
2744
+ * Creates an independent copy of this quaternion.
2745
+ * @returns New quaternion with the same components.
2746
+ */
2747
+ clone(): Quaternion;
2748
+
2749
+ /**
2750
+ * Formats this quaternion for logging and debugging.
2751
+ * @returns Text in Quaternion(w, x, y, z) form.
2752
+ */
2753
+ toString(): string;
2754
+
2755
+ /**
2756
+ * Converts this quaternion to a plain object for JSON.stringify.
2757
+ * @returns Object containing the current components.
2758
+ */
2759
+ toJSON(): { w: number; x: number; y: number; z: number };
2760
+
2761
+ /**
2762
+ * Creates the identity rotation.
2763
+ * @returns New Quaternion(1, 0, 0, 0).
2764
+ */
2765
+ static identity(): Quaternion;
2766
+
2767
+ /**
2768
+ * Creates a rotation from Euler angles.
2769
+ * @param pitch Pitch angle in radians.
2770
+ * @param yaw Yaw angle in radians.
2771
+ * @param roll Roll angle in radians.
2772
+ * @returns New rotation quaternion.
2773
+ */
2774
+ static fromEuler(pitch: number, yaw: number, roll: number): Quaternion;
2775
+
2776
+ /**
2777
+ * Creates a rotation around an axis.
2778
+ * @param axis Rotation axis; it is normalized internally.
2779
+ * @param angle Rotation angle in radians.
2780
+ * @returns New axis-angle rotation quaternion.
2781
+ */
2782
+ static fromAxisAngle(axis: Vector3, angle: number): Quaternion;
2783
+ }
2784
+
2785
+ /**
2786
+ * Mutable RGBA color, with components stored from 0 to 1.
2787
+ */
2788
+ class Color {
2789
+ /**
2790
+ * Creates a color from normalized RGBA components.
2791
+ * @param r Initial red component from 0 to 1.
2792
+ * @param g Initial green component from 0 to 1.
2793
+ * @param b Initial blue component from 0 to 1.
2794
+ * @param a Optional alpha component from 0 to 1; defaults to 1.
2795
+ */
2796
+ constructor(r: number, g: number, b: number, a?: number);
2797
+
2798
+ /**
2799
+ * Mutable normalized red component.
2800
+ */
2801
+ r: number;
2802
+
2803
+ /**
2804
+ * Mutable normalized green component.
2805
+ */
2806
+ g: number;
2807
+
2808
+ /**
2809
+ * Mutable normalized blue component.
2810
+ */
2811
+ b: number;
2812
+
2813
+ /**
2814
+ * Mutable normalized alpha component.
2815
+ */
2816
+ a: number;
2817
+
2818
+ /**
2819
+ * Linearly interpolates every component toward a target in place.
2820
+ * @param target Destination color.
2821
+ * @param t Interpolation factor; 0 keeps this color and 1 reaches target.
2822
+ * @returns This mutated color for chaining.
2823
+ */
2824
+ lerp(target: Color, t: number): this;
2825
+
2826
+ /**
2827
+ * Replaces this color's normalized components in place.
2828
+ * @param r Replacement red component from 0 to 1.
2829
+ * @param g Replacement green component from 0 to 1.
2830
+ * @param b Replacement blue component from 0 to 1.
2831
+ * @param a Optional replacement alpha; defaults to 1 when omitted.
2832
+ * @returns This mutated color for chaining.
2833
+ */
2834
+ set(r: number, g: number, b: number, a?: number): this;
2835
+
2836
+ /**
2837
+ * Creates an independent copy of this color.
2838
+ * @returns New color with the same components.
2839
+ */
2840
+ clone(): Color;
2841
+
2842
+ /**
2843
+ * Converts normalized components to a hexadecimal CSS-style string.
2844
+ * @param includeAlpha Whether to append the alpha byte; defaults to false.
2845
+ * @returns Lowercase #rrggbb or #rrggbbaa string.
2846
+ */
2847
+ toHex(includeAlpha?: boolean): string;
2848
+
2849
+ /**
2850
+ * Formats this color for logging and debugging.
2851
+ * @returns Text in Color(r, g, b, a) form.
2852
+ */
2853
+ toString(): string;
2854
+
2855
+ /**
2856
+ * Converts this color to a plain object for JSON.stringify.
2857
+ * @returns Object containing the current normalized components.
2858
+ */
2859
+ toJSON(): { r: number; g: number; b: number; a: number };
2860
+
2861
+ /**
2862
+ * Parses a hexadecimal color string.
2863
+ * @param hex Hexadecimal color in #RRGGBB or #RRGGBBAA form; the leading # is optional. Three- and four-digit shorthands are not supported.
2864
+ * @returns Parsed color, or opaque white when the input is invalid.
2865
+ */
2866
+ static fromHex(hex: string): Color;
2867
+
2868
+ /**
2869
+ * Creates a normalized color from byte components.
2870
+ * @param r Red byte from 0 to 255.
2871
+ * @param g Green byte from 0 to 255.
2872
+ * @param b Blue byte from 0 to 255.
2873
+ * @param a Optional alpha byte from 0 to 255; defaults to 255.
2874
+ * @returns New normalized color.
2875
+ */
2876
+ static fromRGB(r: number, g: number, b: number, a?: number): Color;
2877
+
2878
+ /**
2879
+ * Creates opaque white.
2880
+ * @returns New Color(1, 1, 1, 1).
2881
+ */
2882
+ static white(): Color;
2883
+
2884
+ /**
2885
+ * Creates opaque black.
2886
+ * @returns New Color(0, 0, 0, 1).
2887
+ */
2888
+ static black(): Color;
2889
+
2890
+ /**
2891
+ * Creates opaque red.
2892
+ * @returns New Color(1, 0, 0, 1).
2893
+ */
2894
+ static red(): Color;
2895
+
2896
+ /**
2897
+ * Creates opaque green.
2898
+ * @returns New Color(0, 1, 0, 1).
2899
+ */
2900
+ static green(): Color;
2901
+
2902
+ /**
2903
+ * Creates opaque blue.
2904
+ * @returns New Color(0, 0, 1, 1).
2905
+ */
2906
+ static blue(): Color;
2907
+
2908
+ /**
2909
+ * Creates opaque yellow.
2910
+ * @returns New Color(1, 1, 0, 1).
2911
+ */
2912
+ static yellow(): Color;
2913
+
2914
+ /**
2915
+ * Creates opaque cyan.
2916
+ * @returns New Color(0, 1, 1, 1).
2917
+ */
2918
+ static cyan(): Color;
2919
+
2920
+ /**
2921
+ * Creates opaque magenta.
2922
+ * @returns New Color(1, 0, 1, 1).
2923
+ */
2924
+ static magenta(): Color;
2925
+
2926
+ /**
2927
+ * Creates fully transparent black.
2928
+ * @returns New Color(0, 0, 0, 0).
2929
+ */
2930
+ static transparent(): Color;
2931
+ }
2932
+
2933
+ /**
2934
+ * Asynchronous resource event bus.
2935
+ */
2936
+ interface EventBus {
2937
+ /**
2938
+ * Registers a persistent handler in the shared event namespace.
2939
+ * @param eventName Case-sensitive event name.
2940
+ * @param handler Resource-owned callback invoked with the emitted arguments.
2941
+ * @returns Function that removes this exact subscription.
2942
+ */
2943
+ on<K extends EventName>(eventName: K, handler: (...args: EventMap[K]) => unknown | Promise<unknown>): Unsubscribe;
2944
+
2945
+ /**
2946
+ * Registers a persistent handler in the shared event namespace.
2947
+ * @param eventName Case-sensitive event name.
2948
+ * @param handler Resource-owned callback invoked with the emitted arguments.
2949
+ * @returns Function that removes this exact subscription.
2950
+ */
2951
+ on(eventName: string, handler: EventHandler): Unsubscribe;
2952
+
2953
+ /**
2954
+ * Registers a handler that is removed before its first invocation.
2955
+ * @param eventName Case-sensitive event name.
2956
+ * @param handler Resource-owned callback invoked with the emitted arguments.
2957
+ */
2958
+ once<K extends EventName>(eventName: K, handler: (...args: EventMap[K]) => unknown | Promise<unknown>): void;
2959
+
2960
+ /**
2961
+ * Registers a handler that is removed before its first invocation.
2962
+ * @param eventName Case-sensitive event name.
2963
+ * @param handler Resource-owned callback invoked with the emitted arguments.
2964
+ */
2965
+ once(eventName: string, handler: EventHandler): void;
2966
+
2967
+ /**
2968
+ * Removes a matching handler owned by the calling resource.
2969
+ * @param eventName Case-sensitive event name.
2970
+ * @param handler Resource-owned callback invoked with the emitted arguments.
2971
+ */
2972
+ off<K extends EventName>(eventName: K, handler: (...args: EventMap[K]) => unknown | Promise<unknown>): void;
2973
+
2974
+ /**
2975
+ * Removes a matching handler owned by the calling resource.
2976
+ * @param eventName Case-sensitive event name.
2977
+ * @param handler Resource-owned callback invoked with the emitted arguments.
2978
+ */
2979
+ off(eventName: string, handler: EventHandler): void;
2980
+
2981
+ /**
2982
+ * Invokes every shared handler and waits for all synchronous and asynchronous results.
2983
+ * @param eventName Shared event name.
2984
+ * @param args Arguments delivered to every matching handler.
2985
+ * @returns Promise rejected with an AggregateError when one or more handlers fail.
2986
+ */
2987
+ emit(eventName: string, ...args: unknown[]): Promise<void>;
2988
+
2989
+ /**
2990
+ * Invokes matching handlers belonging only to one resource.
2991
+ * @param resourceName Destination running resource.
2992
+ * @param eventName Shared event name.
2993
+ * @param args Arguments delivered to matching handlers owned by the destination.
2994
+ * @returns Promise rejected when one or more destination handlers fail.
2995
+ */
2996
+ emitTo(resourceName: string, eventName: string, ...args: unknown[]): Promise<void>;
2997
+
2998
+ /**
2999
+ * Registers a handler in the calling resource's private local-event namespace.
3000
+ * @param eventName Case-sensitive event name.
3001
+ * @param handler Resource-owned callback invoked with the emitted arguments.
3002
+ */
3003
+ onLocal(eventName: string, handler: EventHandler): void;
3004
+
3005
+ /**
3006
+ * Emits an event only within the calling resource.
3007
+ * @param eventName Private local event name.
3008
+ * @param args Arguments delivered only to handlers owned by the calling resource.
3009
+ * @returns Promise rejected when one or more local handlers fail.
3010
+ */
3011
+ emitLocal(eventName: string, ...args: unknown[]): Promise<void>;
3012
+
3013
+ /**
3014
+ * Counts persistent and one-shot shared handlers across resources.
3015
+ * @param eventName Shared event name to inspect.
3016
+ * @returns Number of matching handlers.
3017
+ */
3018
+ listenerCount(eventName: string): number;
3019
+
3020
+ /**
3021
+ * Sends a named event from this client to the server's isolated onClient handlers.
3022
+ * @param eventName Server-side client-event name.
3023
+ * @param payload Optional string payload sent verbatim; other values are JSON-serialized.
3024
+ */
3025
+ emitServer(eventName: string, payload?: unknown): void;
3026
+ }
3027
+
3028
+ /**
3029
+ * Asynchronous resource event bus.
3030
+ */
3031
+ const Events: EventBus;
3032
+
3033
+ /**
3034
+ * Typed request and notification channel between local resources through the global Messages object.
3035
+ */
3036
+ const Messages: {
3037
+ /**
3038
+ * Registers or replaces a message handler owned by the calling resource.
3039
+ * @param messageType Message type unique within the receiving resource.
3040
+ * @param handler Handler invoked with the payload and a reply callback; the reply is ignored for notifications.
3041
+ */
3042
+ handle(messageType: string, handler: MessageHandler): void;
3043
+
3044
+ /**
3045
+ * Sends a request to another local resource and waits for its handler to call reply.
3046
+ * @param resourceName Destination running resource.
3047
+ * @param messageType Handler type registered by the destination.
3048
+ * @param payload Optional payload delivered to the handler.
3049
+ * @returns Promise resolved with the reply value or rejected when delivery or handling fails.
3050
+ */
3051
+ request(resourceName: string, messageType: string, payload?: unknown): Promise<unknown>;
3052
+
3053
+ /**
3054
+ * Sends a fire-and-forget notification to another local resource.
3055
+ * @param resourceName Destination running resource.
3056
+ * @param messageType Handler type registered by the destination.
3057
+ * @param payload Optional payload delivered to the handler.
3058
+ */
3059
+ send(resourceName: string, messageType: string, payload?: unknown): void;
3060
+ };
3061
+
3062
+ /**
3063
+ * Registration and lookup of cross-resource values through the global Exports object.
3064
+ */
3065
+ const Exports: {
3066
+ /**
3067
+ * Registers a value from the calling resource for use by dependent resources.
3068
+ * @param name Export name, preferably declared in the current resource manifest.
3069
+ * @param value JavaScript value or function retained by the current resource.
3070
+ * @returns True when the value was registered.
3071
+ */
3072
+ register(name: string, value: unknown): boolean;
3073
+
3074
+ /**
3075
+ * Reads one registered export from another running resource; undeclared dependencies produce a warning.
3076
+ * @param resourceName Name of the running resource that owns the export.
3077
+ * @param exportName Registered export name.
3078
+ * @returns The exported value.
3079
+ */
3080
+ get(resourceName: string, exportName: string): unknown;
3081
+ };
3082
+
3083
+ /**
3084
+ * Bulk access to values exported by another running resource through the global Imports object.
3085
+ */
3086
+ const Imports: {
3087
+ /**
3088
+ * Builds an object containing every currently registered export from another resource; undeclared dependencies produce a warning.
3089
+ * @param resourceName Name of the running resource whose exports should be read.
3090
+ * @returns Object keyed by export name, or an empty object when the resource has no exports.
3091
+ */
3092
+ get(resourceName: string): Record<string, unknown>;
3093
+ };
3094
+
3095
+ /**
3096
+ * Resource-aware console that routes output through the Framework logger.
3097
+ */
3098
+ const console: {
3099
+ /**
3100
+ * Writes an informational log entry prefixed with the current resource name.
3101
+ * @param values Values formatted and joined with spaces.
3102
+ */
3103
+ log(...values: unknown[]): void;
3104
+
3105
+ /**
3106
+ * Alias of console.log for informational output.
3107
+ * @param values Values formatted and joined with spaces.
3108
+ */
3109
+ info(...values: unknown[]): void;
3110
+
3111
+ /**
3112
+ * Writes a warning log entry prefixed with the current resource name.
3113
+ * @param values Values formatted and joined with spaces.
3114
+ */
3115
+ warn(...values: unknown[]): void;
3116
+
3117
+ /**
3118
+ * Writes an error log entry prefixed with the current resource name.
3119
+ * @param values Values formatted and joined with spaces.
3120
+ */
3121
+ error(...values: unknown[]): void;
3122
+
3123
+ /**
3124
+ * Writes a debug log entry prefixed with the current resource name.
3125
+ * @param values Values formatted and joined with spaces.
3126
+ */
3127
+ debug(...values: unknown[]): void;
3128
+ };
3129
+
3130
+ /**
3131
+ * Runtime-side flags exposed as the global ExecutionEnvironment.
3132
+ */
3133
+ const ExecutionEnvironment: {
3134
+ /**
3135
+ * True in the sandboxed client scripting runtime.
3136
+ */
3137
+ readonly isClient: boolean;
3138
+
3139
+ /**
3140
+ * True in the authoritative server scripting runtime.
3141
+ */
3142
+ readonly isServer: boolean;
3143
+ };
3144
+
3145
+ /**
3146
+ * Client-only, resource-owned CEF web-view API exposed as the global Web.
3147
+ */
3148
+ const Web: {
3149
+ /**
3150
+ * Creates an origin-locked web view owned by the calling resource.
3151
+ * @param url Resource-relative URL or allowed absolute URL loaded into the view.
3152
+ * @param options Optional initial pixel geometry, stacking, visibility, and focus settings.
3153
+ * @returns Numeric view ID used by the remaining Web methods.
3154
+ */
3155
+ createView(url: string, options?: { width?: number; height?: number; x?: number; y?: number; zIndex?: number; visible?: boolean; focus?: boolean }): number;
3156
+
3157
+ /**
3158
+ * Destroys an owned view and removes all of its script event handlers.
3159
+ * @param viewId Owned view identifier.
3160
+ * @returns True when a view was destroyed.
3161
+ */
3162
+ destroyView(viewId: number): boolean;
3163
+
3164
+ /**
3165
+ * Makes an owned view visible.
3166
+ * @param viewId Owned view identifier.
3167
+ * @returns True when the view exists and was updated.
3168
+ */
3169
+ showView(viewId: number): boolean;
3170
+
3171
+ /**
3172
+ * Hides an owned view.
3173
+ * @param viewId Owned view identifier.
3174
+ * @returns True when the view exists and was updated.
3175
+ */
3176
+ hideView(viewId: number): boolean;
3177
+
3178
+ /**
3179
+ * Changes input focus for an owned view.
3180
+ * @param viewId Owned view identifier.
3181
+ * @param focused Whether the view captures keyboard and mouse input; defaults to true.
3182
+ * @returns True when the view exists and focus was updated.
3183
+ */
3184
+ focusView(viewId: number, focused?: boolean): boolean;
3185
+
3186
+ /**
3187
+ * Checks whether an owned view is currently visible.
3188
+ * @param viewId Owned view identifier.
3189
+ * @returns False for missing or unowned views.
3190
+ */
3191
+ isViewVisible(viewId: number): boolean;
3192
+
3193
+ /**
3194
+ * Keeps a hidden view painting so something else can sample it, such as a render target drawing the page onto world geometry. A view that is merely hidden stops painting and the sampled picture freezes.
3195
+ * @param viewId Owned view identifier.
3196
+ * @param offscreen Whether the page keeps painting without being drawn on screen; defaults to true.
3197
+ * @returns True when the view exists and was updated.
3198
+ */
3199
+ setViewOffscreen(viewId: number, offscreen?: boolean): boolean;
3200
+
3201
+ /**
3202
+ * Checks whether an owned view keeps painting while hidden.
3203
+ * @param viewId Owned view identifier.
3204
+ * @returns False for missing or unowned views.
3205
+ */
3206
+ isViewOffscreen(viewId: number): boolean;
3207
+
3208
+ /**
3209
+ * Navigates a view and replaces its allowed origin with the new URL's origin.
3210
+ * @param viewId Owned view identifier.
3211
+ * @param url New resource-relative or allowed absolute URL.
3212
+ * @returns True when navigation was requested.
3213
+ */
3214
+ loadURL(viewId: number, url: string): boolean;
3215
+
3216
+ /**
3217
+ * Resizes an owned view's viewport.
3218
+ * @param viewId Owned view identifier.
3219
+ * @param width New viewport width in pixels.
3220
+ * @param height New viewport height in pixels.
3221
+ * @returns True when the view exists and was resized.
3222
+ */
3223
+ resizeView(viewId: number, width: number, height: number): boolean;
3224
+
3225
+ /**
3226
+ * Moves an owned view on screen.
3227
+ * @param viewId Owned view identifier.
3228
+ * @param x New horizontal screen position in pixels.
3229
+ * @param y New vertical screen position in pixels.
3230
+ * @returns True when the view exists and was moved.
3231
+ */
3232
+ setViewPosition(viewId: number, x: number, y: number): boolean;
3233
+
3234
+ /**
3235
+ * Registers a handler for an event emitted by an owned same-origin page.
3236
+ * @param viewId Owned view identifier.
3237
+ * @param eventName Page-to-script event name.
3238
+ * @param handler Resource-owned callback invoked by the view's callEvent bridge.
3239
+ */
3240
+ on(viewId: number, eventName: string, handler: WebEventHandler): void;
3241
+
3242
+ /**
3243
+ * Removes page-event handlers from an owned view.
3244
+ * @param viewId Owned view identifier.
3245
+ * @param eventName Page-to-script event name.
3246
+ * @param handler Optional exact callback; omitting it removes every matching handler owned by the resource.
3247
+ * @returns True when at least one handler was removed.
3248
+ */
3249
+ off(viewId: number, eventName: string, handler?: WebEventHandler): boolean;
3250
+
3251
+ /**
3252
+ * Dispatches a CustomEvent into an owned view.
3253
+ * @param viewId Owned view identifier.
3254
+ * @param eventName CustomEvent name dispatched in the page.
3255
+ * @param payload Optional JSON-serializable event detail.
3256
+ * @returns True when the dispatch script was queued.
3257
+ */
3258
+ emit(viewId: number, eventName: string, payload?: unknown): boolean;
3259
+
3260
+ /**
3261
+ * Returns the current client viewport size.
3262
+ * @returns Width and height in physical pixels.
3263
+ */
3264
+ getScreenSize(): { width: number; height: number };
3265
+ };
3266
+
3267
+ /**
3268
+ * A web view's browser finished being created.
3269
+ */
3270
+ interface BrowserCreatedEvent {
3271
+ /**
3272
+ * Identifier of the view the event belongs to.
3273
+ */
3274
+ viewId: number;
3275
+
3276
+ /**
3277
+ * URL the view was created with.
3278
+ */
3279
+ url: string;
3280
+ }
3281
+
3282
+ /**
3283
+ * A frame inside a web view started loading.
3284
+ */
3285
+ interface BrowserLoadingStartEvent {
3286
+ /**
3287
+ * Identifier of the view the event belongs to.
3288
+ */
3289
+ viewId: number;
3290
+
3291
+ /**
3292
+ * URL being loaded.
3293
+ */
3294
+ url: string;
3295
+
3296
+ /**
3297
+ * False for sub-frame loads.
3298
+ */
3299
+ isMainFrame: boolean;
3300
+ }
3301
+
3302
+ /**
3303
+ * A web view's main frame finished loading.
3304
+ */
3305
+ interface BrowserDocumentReadyEvent {
3306
+ /**
3307
+ * Identifier of the view the event belongs to.
3308
+ */
3309
+ viewId: number;
3310
+
3311
+ /**
3312
+ * URL that finished loading.
3313
+ */
3314
+ url: string;
3315
+ }
3316
+
3317
+ /**
3318
+ * A load inside a web view was aborted.
3319
+ */
3320
+ interface BrowserLoadingFailedEvent {
3321
+ /**
3322
+ * Identifier of the view the event belongs to.
3323
+ */
3324
+ viewId: number;
3325
+
3326
+ /**
3327
+ * URL that failed to load.
3328
+ */
3329
+ url: string;
3330
+
3331
+ /**
3332
+ * CEF error text, such as ERR_CONNECTION_REFUSED.
3333
+ */
3334
+ description: string;
3335
+
3336
+ /**
3337
+ * CEF error code.
3338
+ */
3339
+ errorCode: number;
3340
+
3341
+ /**
3342
+ * False for sub-frame failures.
3343
+ */
3344
+ isMainFrame: boolean;
3345
+ }
3346
+
3347
+ /**
3348
+ * A web view was asked to navigate.
3349
+ */
3350
+ interface BrowserNavigateEvent {
3351
+ /**
3352
+ * Identifier of the view the event belongs to.
3353
+ */
3354
+ viewId: number;
3355
+
3356
+ /**
3357
+ * Requested URL.
3358
+ */
3359
+ url: string;
3360
+
3361
+ /**
3362
+ * False for sub-frame navigation.
3363
+ */
3364
+ isMainFrame: boolean;
3365
+
3366
+ /**
3367
+ * Whether the request was refused.
3368
+ */
3369
+ blocked: boolean;
3370
+ }
3371
+
3372
+ /**
3373
+ * A page tried to open a new window or tab.
3374
+ */
3375
+ interface BrowserPopupEvent {
3376
+ /**
3377
+ * Identifier of the view the event belongs to.
3378
+ */
3379
+ viewId: number;
3380
+
3381
+ /**
3382
+ * Target URL of the blocked popup.
3383
+ */
3384
+ url: string;
3385
+
3386
+ /**
3387
+ * URL of the frame that requested it.
3388
+ */
3389
+ openerUrl: string;
3390
+ }
3391
+
3392
+ /**
3393
+ * The cursor shape a page is asking for.
3394
+ */
3395
+ interface BrowserCursorChangeEvent {
3396
+ /**
3397
+ * Identifier of the view the event belongs to.
3398
+ */
3399
+ viewId: number;
3400
+
3401
+ /**
3402
+ * CSS-style cursor name, or "custom" for shapes without one.
3403
+ */
3404
+ cursor: string;
3405
+
3406
+ /**
3407
+ * Raw CEF cursor type.
3408
+ */
3409
+ cursorType: number;
3410
+ }
3411
+
3412
+ /**
3413
+ * A page wants to display a tooltip.
3414
+ */
3415
+ interface BrowserTooltipEvent {
3416
+ /**
3417
+ * Identifier of the view the event belongs to.
3418
+ */
3419
+ viewId: number;
3420
+
3421
+ /**
3422
+ * Tooltip text; empty when the tooltip is dismissed.
3423
+ */
3424
+ text: string;
3425
+ }
3426
+
3427
+ /**
3428
+ * A form control inside a page gained or lost focus.
3429
+ */
3430
+ interface BrowserInputFocusChangeEvent {
3431
+ /**
3432
+ * Identifier of the view the event belongs to.
3433
+ */
3434
+ viewId: number;
3435
+
3436
+ /**
3437
+ * True while the page holds keyboard input.
3438
+ */
3439
+ focused: boolean;
3440
+ }
3441
+
3442
+ /**
3443
+ * A web view refused a request.
3444
+ */
3445
+ interface BrowserResourceBlockedEvent {
3446
+ /**
3447
+ * Identifier of the view the event belongs to.
3448
+ */
3449
+ viewId: number;
3450
+
3451
+ /**
3452
+ * URL that was refused.
3453
+ */
3454
+ url: string;
3455
+
3456
+ /**
3457
+ * Host component of that URL, empty when unparsable.
3458
+ */
3459
+ domain: string;
3460
+
3461
+ /**
3462
+ * Why the request was refused.
3463
+ */
3464
+ reason: "cross-origin" | "invalid-url" | "host-filter" | "foreign-event";
3465
+ }
3466
+
3467
+ /**
3468
+ * A console call made by a page.
3469
+ */
3470
+ interface BrowserConsoleMessageEvent {
3471
+ /**
3472
+ * Identifier of the view the event belongs to.
3473
+ */
3474
+ viewId: number;
3475
+
3476
+ /**
3477
+ * Console message body.
3478
+ */
3479
+ message: string;
3480
+
3481
+ /**
3482
+ * Script URL that logged it.
3483
+ */
3484
+ source: string;
3485
+
3486
+ /**
3487
+ * Line number within that script.
3488
+ */
3489
+ line: number;
3490
+
3491
+ /**
3492
+ * Console severity.
3493
+ */
3494
+ severity: "debug" | "info" | "warning" | "error" | "fatal";
3495
+ }
3496
+
3497
+ /**
3498
+ * A web view's allowed origin changed.
3499
+ */
3500
+ interface BrowserOriginChangeEvent {
3501
+ /**
3502
+ * Identifier of the view the event belongs to.
3503
+ */
3504
+ viewId: number;
3505
+
3506
+ /**
3507
+ * New locked origin, or "null" when the URL has none.
3508
+ */
3509
+ origin: string;
3510
+
3511
+ /**
3512
+ * URL the lock was derived from.
3513
+ */
3514
+ url: string;
3515
+ }
3516
+
3517
+ /**
3518
+ * Client-only, resource-owned physical key bindings exposed as the global Key.
3519
+ */
3520
+ const Key: {
3521
+ /**
3522
+ * Binds a resource-owned handler that fires while the game has foreground input and no UI is capturing it.
3523
+ * @param key Case-insensitive supported keyboard or mouse key name.
3524
+ * @param stateOrHandler Trigger state, or the handler itself to use the default down state.
3525
+ * @param handler Handler required when an explicit trigger state is provided.
3526
+ * @returns True after the binding is installed; invalid keys or states throw.
3527
+ */
3528
+ bind(key: string, stateOrHandler: "down" | "up" | "both" | KeyHandler, handler?: KeyHandler): boolean;
3529
+
3530
+ /**
3531
+ * Removes matching bindings owned by the calling resource; omitting filters removes every binding for the key.
3532
+ * @param key Case-insensitive supported key name.
3533
+ * @param state Optional trigger-state filter.
3534
+ * @param handler Optional exact handler filter.
3535
+ * @returns True when at least one binding was removed.
3536
+ */
3537
+ unbind(key: string, state?: "down" | "up" | "both", handler?: KeyHandler): boolean;
3538
+
3539
+ /**
3540
+ * Queries live physical key state using the same foreground and UI-input gate as binding dispatch.
3541
+ * @param key Case-insensitive supported key name.
3542
+ * @returns False when the key is up, the game is backgrounded, UI owns input, or the key name is invalid.
3543
+ */
3544
+ isDown(key: string): boolean;
3545
+ };
3546
+
3547
+ /**
3548
+ * Client chat transport and native chat-box controls.
3549
+ */
3550
+ const Chat: {
3551
+ /**
3552
+ * Sends a chat line to the server, bypassing the chatSend event; incoming lines arrive through the reserved chatMessage event.
3553
+ * @param text Player-authored chat text sent to the server.
3554
+ */
3555
+ send(text: string): void;
3556
+
3557
+ /**
3558
+ * Changes visibility of the native chat overlay without opening its input field.
3559
+ * @param visible Whether the chat overlay is rendered.
3560
+ */
3561
+ setUIVisible(visible: boolean): void;
3562
+
3563
+ /**
3564
+ * Checks whether the native chat overlay is visible.
3565
+ * @returns True when the overlay is currently rendered.
3566
+ */
3567
+ isUIVisible(): boolean;
3568
+
3569
+ /**
3570
+ * Opens and focuses the native chat input field.
3571
+ */
3572
+ open(): void;
3573
+
3574
+ /**
3575
+ * Closes the native chat input field without submitting its contents.
3576
+ */
3577
+ close(): void;
3578
+
3579
+ /**
3580
+ * Checks whether the native chat input field is active.
3581
+ * @returns True while chat is capturing keyboard input.
3582
+ */
3583
+ isOpen(): boolean;
3584
+ };
3585
+
3586
+ /**
3587
+ * Client-only Discord rich-presence composer exposed as the global Discord; setters stage values until update or setPresence publishes them.
3588
+ */
3589
+ const Discord: {
3590
+ /**
3591
+ * Stages the Discord activity verb or numeric enum value.
3592
+ * @param type the Discord activity verb or numeric enum value.
3593
+ */
3594
+ setType(type: "playing" | "streaming" | "listening" | "watching" | number): void;
3595
+
3596
+ /**
3597
+ * Stages the activity name.
3598
+ * @param name the activity name.
3599
+ */
3600
+ setName(name: string): void;
3601
+
3602
+ /**
3603
+ * Stages the top presence line.
3604
+ * @param details the top presence line.
3605
+ */
3606
+ setDetails(details: string): void;
3607
+
3608
+ /**
3609
+ * Stages the bottom presence line.
3610
+ * @param state the bottom presence line.
3611
+ */
3612
+ setState(state: string): void;
3613
+
3614
+ /**
3615
+ * Stages the elapsed-time Unix timestamp in seconds; zero clears it.
3616
+ * @param seconds the elapsed-time Unix timestamp in seconds; zero clears it.
3617
+ */
3618
+ setStartTimestamp(seconds: number): void;
3619
+
3620
+ /**
3621
+ * Stages the countdown Unix timestamp in seconds; zero clears it.
3622
+ * @param seconds the countdown Unix timestamp in seconds; zero clears it.
3623
+ */
3624
+ setEndTimestamp(seconds: number): void;
3625
+
3626
+ /**
3627
+ * Stages the supported-platform bitmask: Desktop 1, Android 2, and iOS 4.
3628
+ * @param flags the supported-platform bitmask: Desktop 1, Android 2, and iOS 4.
3629
+ */
3630
+ setSupportedPlatforms(flags: number): void;
3631
+
3632
+ /**
3633
+ * Stages the large image asset key.
3634
+ * @param assetKey the large image asset key.
3635
+ */
3636
+ setLargeImage(assetKey: string): void;
3637
+
3638
+ /**
3639
+ * Stages the large image tooltip.
3640
+ * @param text the large image tooltip.
3641
+ */
3642
+ setLargeText(text: string): void;
3643
+
3644
+ /**
3645
+ * Stages the small image asset key.
3646
+ * @param assetKey the small image asset key.
3647
+ */
3648
+ setSmallImage(assetKey: string): void;
3649
+
3650
+ /**
3651
+ * Stages the small image tooltip.
3652
+ * @param text the small image tooltip.
3653
+ */
3654
+ setSmallText(text: string): void;
3655
+
3656
+ /**
3657
+ * Stages the party grouping identifier.
3658
+ * @param id the party grouping identifier.
3659
+ */
3660
+ setPartyId(id: string): void;
3661
+
3662
+ /**
3663
+ * Stages the party join-privacy name or numeric enum value.
3664
+ * @param privacy the party join-privacy name or numeric enum value.
3665
+ */
3666
+ setPartyPrivacy(privacy: "private" | "public" | number): void;
3667
+
3668
+ /**
3669
+ * Stages the opaque match secret.
3670
+ * @param secret the opaque match secret.
3671
+ */
3672
+ setMatchSecret(secret: string): void;
3673
+
3674
+ /**
3675
+ * Stages the opaque join secret that enables invitations.
3676
+ * @param secret the opaque join secret that enables invitations.
3677
+ */
3678
+ setJoinSecret(secret: string): void;
3679
+
3680
+ /**
3681
+ * Stages the opaque spectate secret.
3682
+ * @param secret the opaque spectate secret.
3683
+ */
3684
+ setSpectateSecret(secret: string): void;
3685
+
3686
+ /**
3687
+ * Stages whether the activity represents an instanced session.
3688
+ * @param instance whether the activity represents an instanced session.
3689
+ */
3690
+ setInstance(instance: boolean): void;
3691
+
3692
+ /**
3693
+ * Stages multiple Discord image fields at once.
3694
+ * @param assets Asset keys and tooltips to merge into the staged activity.
3695
+ */
3696
+ setAssets(assets: { largeImage?: string; largeText?: string; smallImage?: string; smallText?: string }): void;
3697
+
3698
+ /**
3699
+ * Stages the party's current and maximum size.
3700
+ * @param current Current party member count.
3701
+ * @param max Maximum party capacity.
3702
+ */
3703
+ setPartySize(current: number, max: number): void;
3704
+
3705
+ /**
3706
+ * Stages multiple Discord party fields at once.
3707
+ * @param party Party fields to merge into the staged activity.
3708
+ */
3709
+ setParty(party: { id?: string; size?: [number, number]; privacy?: "private" | "public" | number }): void;
3710
+
3711
+ /**
3712
+ * Stages multiple Discord activity secrets at once.
3713
+ * @param secrets Opaque secrets to merge into the staged activity.
3714
+ */
3715
+ setSecrets(secrets: { match?: string; join?: string; spectate?: string }): void;
3716
+
3717
+ /**
3718
+ * Merges a complete option batch into the staged activity and publishes it immediately.
3719
+ * @param options Batch of supported activity, timestamp, asset, party, secret, instance, and platform fields.
3720
+ * @returns True when the update was dispatched; false when Discord is unavailable.
3721
+ */
3722
+ setPresence(options: Record<string, unknown>): boolean;
3723
+
3724
+ /**
3725
+ * Publishes the currently staged activity as one rate-limited Discord update.
3726
+ * @returns True when dispatched; false when Discord is unavailable.
3727
+ */
3728
+ update(): boolean;
3729
+
3730
+ /**
3731
+ * Clears the published Discord activity and resets staged state.
3732
+ * @returns True when dispatched; false when Discord is unavailable.
3733
+ */
3734
+ clear(): boolean;
3735
+
3736
+ /**
3737
+ * Resets staged activity fields without publishing a Discord update.
3738
+ */
3739
+ reset(): void;
3740
+
3741
+ /**
3742
+ * Returns the signed-in Discord user's snowflake.
3743
+ * @returns User ID string, or an empty string until available.
3744
+ */
3745
+ getUserId(): string;
3746
+
3747
+ /**
3748
+ * Checks whether Discord is connected and can publish presence.
3749
+ * @returns True when rich presence is initialized.
3750
+ */
3751
+ isAvailable(): boolean;
3752
+ };
3753
+
3754
+ /**
3755
+ * Local player's proximity voice chat settings: on/off, playback volume, hearing range and the push-to-talk binding.
3756
+ */
3757
+ const Voice: {
3758
+ /**
3759
+ * Turns voice chat on or off. Off closes the microphone and playback devices and tells the server to stop relaying voice to this client.
3760
+ * @param enabled Whether voice chat runs at all for this player.
3761
+ */
3762
+ setEnabled(enabled: boolean): void;
3763
+
3764
+ /**
3765
+ * Checks whether voice chat is enabled for this player.
3766
+ * @returns True unless the player turned voice chat off.
3767
+ */
3768
+ isEnabled(): boolean;
3769
+
3770
+ /**
3771
+ * Sets the playback volume of incoming voice. A game that plays voice through its own audio engine applies the same gain there.
3772
+ * @param volume Playback gain, where 1 is unattenuated. Clamped to 0..4.
3773
+ */
3774
+ setVolume(volume: number): void;
3775
+
3776
+ /**
3777
+ * Reads the voice playback volume.
3778
+ * @returns Current gain, where 1 is unattenuated.
3779
+ */
3780
+ getVolume(): number;
3781
+
3782
+ /**
3783
+ * Narrows how far this player hears others. Can only reduce the server's range, since a talker beyond it is never relayed.
3784
+ * @param range Audibility radius in world units; 0 removes the local limit.
3785
+ */
3786
+ setHearingRange(range: number): void;
3787
+
3788
+ /**
3789
+ * Reads the local hearing-range limit.
3790
+ * @returns Radius in world units, or 0 when the server's range applies unreduced.
3791
+ */
3792
+ getHearingRange(): number;
3793
+
3794
+ /**
3795
+ * Reads the server's proximity range for talkers with no override of their own.
3796
+ * @returns Radius in world units.
3797
+ */
3798
+ getRange(): number;
3799
+
3800
+ /**
3801
+ * Rebinds push-to-talk. Unknown key names throw.
3802
+ * @param key Case-insensitive key name, using the same names as Key.bind.
3803
+ */
3804
+ setPushToTalkKey(key: string): void;
3805
+
3806
+ /**
3807
+ * Reads the push-to-talk binding.
3808
+ * @returns Canonical key name, e.g. "v".
3809
+ */
3810
+ getPushToTalkKey(): string;
3811
+
3812
+ /**
3813
+ * Sets how long transmission continues after push-to-talk is released, so letting go slightly early does not clip the end of a word. Muting, turning voice off and losing input focus still stop it at once.
3814
+ * @param milliseconds How long to keep transmitting after the key goes up. Clamped to 0..2000.
3815
+ */
3816
+ setPushToTalkReleaseDelay(milliseconds: number): void;
3817
+
3818
+ /**
3819
+ * Reads the push-to-talk release delay.
3820
+ * @returns Delay in milliseconds; 0 when transmission stops the moment the key is released.
3821
+ */
3822
+ getPushToTalkReleaseDelay(): number;
3823
+
3824
+ /**
3825
+ * Checks whether the local player is speaking right now. The same state raises the voiceStart and voiceStop events.
3826
+ * @returns True while push-to-talk is open -- held, or still inside the release delay -- and the microphone is producing audio.
3827
+ */
3828
+ isTalking(): boolean;
3829
+
3830
+ /**
3831
+ * Checks whether a capture device opened for this session.
3832
+ * @returns False when the player has no working microphone, i.e. they are listen-only.
3833
+ */
3834
+ hasMicrophone(): boolean;
3835
+
3836
+ /**
3837
+ * Chooses what opens the microphone. Switching closes whatever the previous mode had open. Unknown modes throw.
3838
+ * @param mode pushToTalk sends while the key is held; voiceActivity sends whenever the microphone is louder than the activation threshold.
3839
+ */
3840
+ setTransmitMode(mode: 'pushToTalk' | 'voiceActivity'): void;
3841
+
3842
+ /**
3843
+ * Reads what opens the microphone.
3844
+ * @returns The current transmit mode.
3845
+ */
3846
+ getTransmitMode(): 'pushToTalk' | 'voiceActivity';
3847
+
3848
+ /**
3849
+ * Sets the voice-activation sensitivity: lower sends quieter speech, higher ignores more background noise. Clamped to 0..1.
3850
+ * @param level Microphone level, 0 to 1 on the scale getInputLevel reports, above which voice activation sends.
3851
+ */
3852
+ setActivationThreshold(level: number): void;
3853
+
3854
+ /**
3855
+ * Reads the voice-activation threshold.
3856
+ * @returns Level from 0 to 1.
3857
+ */
3858
+ getActivationThreshold(): number;
3859
+
3860
+ /**
3861
+ * Reads how loud the microphone is right now, whether or not anything is being sent -- the value to draw a level meter from and to tune the activation threshold against.
3862
+ * @returns Smoothed level from 0 to 1; 0 while no microphone is open.
3863
+ */
3864
+ getInputLevel(): number;
3865
+
3866
+ /**
3867
+ * Turns noise suppression on or off. It runs before the level is measured, so it also keeps steady noise from tripping voice activation.
3868
+ * @param enabled Whether to filter background noise out of the microphone.
3869
+ */
3870
+ setNoiseSuppression(enabled: boolean): void;
3871
+
3872
+ /**
3873
+ * Checks whether noise suppression is on.
3874
+ * @returns True while background noise is being filtered.
3875
+ */
3876
+ isNoiseSuppressionEnabled(): boolean;
3877
+
3878
+ /**
3879
+ * Lists the microphones voice can record from.
3880
+ * @returns Device names as the player would recognise them; empty when the game chooses the device itself.
3881
+ */
3882
+ getInputDevices(): string[];
3883
+
3884
+ /**
3885
+ * Chooses the microphone. A running microphone is reopened on the new device; a device that is no longer connected falls back to the default.
3886
+ * @param name A name from getInputDevices, or an empty string for the system default.
3887
+ */
3888
+ setInputDevice(name: string): void;
3889
+
3890
+ /**
3891
+ * Reads the chosen microphone.
3892
+ * @returns Its name, or an empty string for the system default.
3893
+ */
3894
+ getInputDevice(): string;
3895
+ };
3896
+
3897
+ /**
3898
+ * The local player's view of the nametags above other players: whether they draw at all, and whether they carry a health bar.
3899
+ */
3900
+ const Nametags: {
3901
+ /**
3902
+ * Shows or hides all nametags for this player only. A player hidden with Player.setNametagVisible stays hidden either way.
3903
+ * @param visible True to draw nametags, false to hide every one of them.
3904
+ */
3905
+ setVisible(visible: boolean): void;
3906
+
3907
+ /**
3908
+ * Checks whether this player draws nametags.
3909
+ * @returns True unless they were hidden locally.
3910
+ */
3911
+ isVisible(): boolean;
3912
+
3913
+ /**
3914
+ * Shows or hides the health bar on all nametags for this player only, leaving the names alone.
3915
+ * @param visible True to draw the health bar under each name, false to hide it.
3916
+ */
3917
+ setHealthVisible(visible: boolean): void;
3918
+
3919
+ /**
3920
+ * Checks whether this player draws health bars on nametags.
3921
+ * @returns True unless they were hidden locally.
3922
+ */
3923
+ isHealthVisible(): boolean;
3924
+
3925
+ /**
3926
+ * Hangs a transient line on that entity's nametag, above its name -- speech, an emote, a status. It follows the body, fades with distance and hides behind cover exactly as the name does. Local to this player: the line is not replicated, and a nametag hidden with Nametags.setVisible draws neither. Player.setNametagText is the server-side counterpart for a lasting name.
3927
+ * @param entityId Network id of the entity to label (server-side `player.id`).
3928
+ * @param text Label text; '\n' splits lines. Empty clears the label.
3929
+ * @param durationMs How long to hold it (default 6000). <= 0 holds until cleared.
3930
+ * @param color Packed 0xAARRGGBB; 0 (default) uses the nametag's own colour.
3931
+ */
3932
+ setLabel(entityId: number, text: string, durationMs?: number, color?: number): void;
3933
+
3934
+ /**
3935
+ * Removes an entity's label before its duration elapses.
3936
+ * @param entityId Network id of the entity whose label to remove.
3937
+ */
3938
+ clearLabel(entityId: number): void;
3939
+
3940
+ /**
3941
+ * Removes every label this player is drawing.
3942
+ */
3943
+ clearLabels(): void;
3944
+ };
3945
+
3946
+ /**
3947
+ * Base handle for a live replicated network entity.
3948
+ */
3949
+ class Entity {
3950
+ /**
3951
+ * Creates a script wrapper for an existing entity with this ID; it does not spawn an entity.
3952
+ * @param id Network entity identifier.
3953
+ */
3954
+ constructor(id: number);
3955
+
3956
+ /**
3957
+ * Immutable network entity identifier.
3958
+ */
3959
+ readonly id: number;
3960
+
3961
+ /**
3962
+ * Current virtual-world identifier.
3963
+ */
3964
+ readonly virtualWorld: number;
3965
+
3966
+ /**
3967
+ * Authoritative world-space position; assignment forces replicated state.
3968
+ */
3969
+ position: Vector3;
3970
+
3971
+ /**
3972
+ * Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.
3973
+ */
3974
+ rotation: Quaternion | Vector3;
3975
+
3976
+ /**
3977
+ * Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.
3978
+ */
3979
+ readonly state: StateBag;
3980
+
3981
+ /**
3982
+ * Formats this entity handle for logging and debugging.
3983
+ * @returns Text containing the network entity ID.
3984
+ */
3985
+ toString(): string;
3986
+ }
3987
+
3988
+ /**
3989
+ * Arbitrary key/value state attached to one replicated entity, reached as `entity.state`. Keys set on the server replicate to every client that can currently see the entity.
3990
+ */
3991
+ class StateBag {
3992
+ /**
3993
+ * Reads one key from this entity's state.
3994
+ * @param key Key to read.
3995
+ * @returns The stored value, or undefined when the key is not set.
3996
+ */
3997
+ get(key: string): any;
3998
+
3999
+ /**
4000
+ * Checks whether this entity's state holds a key.
4001
+ * @param key Key to test.
4002
+ * @returns True when the key is set.
4003
+ */
4004
+ has(key: string): boolean;
4005
+
4006
+ /**
4007
+ * Lists the keys this entity's state holds, sorted.
4008
+ * @returns Every key currently set, in ascending order.
4009
+ */
4010
+ keys(): string[];
4011
+
4012
+ /**
4013
+ * Copies this entity's whole state into a plain object.
4014
+ * @returns Every key and value currently set. The copy does not track later changes.
4015
+ */
4016
+ toObject(): Record<string, any>;
4017
+
4018
+ /**
4019
+ * Watches this entity's state. The filter is applied before the handler runs, so a listener watching one key of one entity is not woken by unrelated changes. The subscription is dropped when the registering resource stops.
4020
+ * @param key Only report this key, or null to report every key of this entity.
4021
+ * @param handler Called as (key: string, value: any, previous: any) with the changed key, its new value and the value before it. `value` is undefined when the key was removed and `previous` is undefined when it held nothing.
4022
+ * @returns A zero-argument function that cancels this subscription.
4023
+ */
4024
+ onChange(key: string | null, handler: Function): Function;
4025
+ }
4026
+
4027
+ /**
4028
+ * Framework-owned base handle for a connected player, extended by each game or mod.
4029
+ */
4030
+ class BasePlayer {
4031
+ /**
4032
+ * Creates a wrapper for an existing connected player with this ID; it does not connect or spawn a player.
4033
+ * @param id Network entity identifier.
4034
+ */
4035
+ constructor(id: number);
4036
+
4037
+ /**
4038
+ * Formats this player handle for logging and debugging.
4039
+ * @returns Text containing the player's network entity ID.
4040
+ */
4041
+ toString(): string;
4042
+
4043
+ /**
4044
+ * Checks whether this player's nametag is shown to other players.
4045
+ * @returns True unless the nametag was hidden; false also when this game has no nametags.
4046
+ */
4047
+ isNametagVisible(): boolean;
4048
+
4049
+ /**
4050
+ * Checks whether the health bar under this player's nametag is shown.
4051
+ * @returns True unless the health bar was hidden; false also when this game has no nametags.
4052
+ */
4053
+ isNametagHealthVisible(): boolean;
4054
+
4055
+ /**
4056
+ * Reads this player's nametag text override.
4057
+ * @returns The override, or an empty string when the player's own name is drawn.
4058
+ */
4059
+ getNametagText(): string;
4060
+
4061
+ /**
4062
+ * Reads this player's nametag color.
4063
+ * @returns Packed 0xAARRGGBB color; opaque white when untinted.
4064
+ */
4065
+ getNametagColor(): number;
4066
+ }
4067
+
4068
+ interface BasePlayer extends Entity {}
4069
+
4070
+ /**
4071
+ * The player sitting at this machine, or null while this client has no body -- before the session spawns one, and again once it ends. Read it fresh each time rather than holding onto it.
4072
+ */
4073
+ const LocalPlayer: Player | null;
4074
+
4075
+ /**
4076
+ * Calls a function once after a delay.
4077
+ * @param handler Function to call.
4078
+ * @param milliseconds Delay before the call.
4079
+ * @param args Arguments passed to the handler.
4080
+ * @returns Handle to pass to the matching clear function.
4081
+ */
4082
+ function setTimeout(handler: (...args: any[]) => void, milliseconds?: number, ...args: unknown[]): number;
4083
+
4084
+ /**
4085
+ * Calls a function repeatedly, waiting the delay between calls.
4086
+ * @param handler Function to call.
4087
+ * @param milliseconds Delay before the call.
4088
+ * @param args Arguments passed to the handler.
4089
+ * @returns Handle to pass to the matching clear function.
4090
+ */
4091
+ function setInterval(handler: (...args: any[]) => void, milliseconds?: number, ...args: unknown[]): number;
4092
+
4093
+ /**
4094
+ * Cancels a pending setTimeout.
4095
+ * @param handle Handle returned when the timer was scheduled; anything else is ignored.
4096
+ */
4097
+ function clearTimeout(handle?: number): void;
4098
+
4099
+ /**
4100
+ * Cancels a setInterval.
4101
+ * @param handle Handle returned when the timer was scheduled; anything else is ignored.
4102
+ */
4103
+ function clearInterval(handle?: number): void;
4104
+
4105
+ /**
4106
+ * Queues a function on the microtask queue.
4107
+ * @param callback Function to run once the current task completes.
4108
+ */
4109
+ function queueMicrotask(callback: () => void): void;
4110
+ }
4111
+
4112
+ export {};