xray16 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/package.json +1 -1
  2. package/types/xr_ai/xr_action.d.ts +1321 -29
  3. package/types/xr_ai/xr_alife.d.ts +1336 -32
  4. package/types/xr_ai/xr_enemy_evaluation.d.ts +112 -19
  5. package/types/xr_ai/xr_goap.d.ts +450 -3
  6. package/types/xr_ai/xr_graph.d.ts +94 -6
  7. package/types/xr_ai/xr_memory.d.ts +240 -6
  8. package/types/xr_lib/xr_animation.d.ts +185 -14
  9. package/types/xr_lib/xr_bitwise.d.ts +20 -8
  10. package/types/xr_lib/xr_color.d.ts +103 -6
  11. package/types/xr_lib/xr_debug.d.ts +110 -12
  12. package/types/xr_lib/xr_dialog.d.ts +99 -7
  13. package/types/xr_lib/xr_flags.d.ts +78 -15
  14. package/types/xr_lib/xr_fs.d.ts +395 -5
  15. package/types/xr_lib/xr_game.d.ts +101 -0
  16. package/types/xr_lib/xr_hit.d.ts +84 -0
  17. package/types/xr_lib/xr_ini.d.ts +60 -2
  18. package/types/xr_lib/xr_level.d.ts +182 -39
  19. package/types/xr_lib/xr_luabind.d.ts +37 -11
  20. package/types/xr_lib/xr_map.d.ts +137 -6
  21. package/types/xr_lib/xr_math.d.ts +56 -0
  22. package/types/xr_lib/xr_multiplayer.d.ts +729 -1
  23. package/types/xr_lib/xr_profile.d.ts +80 -0
  24. package/types/xr_lib/xr_properties.d.ts +159 -4
  25. package/types/xr_lib/xr_relation.d.ts +147 -0
  26. package/types/xr_lib/xr_render.d.ts +99 -3
  27. package/types/xr_lib/xr_save.d.ts +110 -4
  28. package/types/xr_lib/xr_sound.d.ts +373 -9
  29. package/types/xr_lib/xr_stats.ts +33 -4
  30. package/types/xr_lib/xr_task.d.ts +277 -0
  31. package/types/xr_lib/xr_time.d.ts +11 -0
  32. package/types/xr_object/client/xr_anomaly.d.ts +20 -0
  33. package/types/xr_object/client/xr_artefact.d.ts +57 -2
  34. package/types/xr_object/client/xr_client_object.d.ts +131 -0
  35. package/types/xr_object/client/xr_creature.d.ts +79 -0
  36. package/types/xr_object/client/xr_item.d.ts +108 -2
  37. package/types/xr_object/client/xr_level.d.ts +482 -14
  38. package/types/xr_object/client/xr_physic.d.ts +459 -29
  39. package/types/xr_object/client/xr_zone.d.ts +38 -0
  40. package/types/xr_object/script/xr_script_interface.d.ts +236 -1
  41. package/types/xr_object/script/xr_script_object.d.ts +3402 -82
  42. package/types/xr_object/script/xr_script_trade.d.ts +25 -15
  43. package/types/xr_object/server/xr_server_object.d.ts +707 -15
  44. package/types/xr_ui/xr_ui_asset.d.ts +241 -6
  45. package/types/xr_ui/xr_ui_core.d.ts +327 -9
  46. package/types/xr_ui/xr_ui_event.d.ts +1067 -1
  47. package/types/xr_ui/xr_ui_interface.d.ts +1563 -17
  48. package/types/xr_ui/xr_ui_menu.d.ts +259 -16
  49. package/types/xrf_plugin.d.ts +44 -14
@@ -1,98 +1,317 @@
1
1
  declare module "xray16" {
2
2
  /**
3
+ * Main-menu options manager binding.
4
+ *
3
5
  * @source C++ class COptionsManager
4
6
  * @customConstructor COptionsManager
5
7
  * @group xr_ui_menu
8
+ *
9
+ * @remarks
10
+ * Operates on option item groups registered by the options UI.
6
11
  */
7
12
  export class COptionsManager {
13
+ /**
14
+ * Create an options manager script proxy.
15
+ */
8
16
  public constructor();
9
17
 
18
+ /**
19
+ * Send a UI options message to every option item in a group.
20
+ *
21
+ * @param group - Options group name.
22
+ * @param message - Message name.
23
+ */
10
24
  public SendMessage2Group(group: string, message: string): void;
11
25
 
26
+ /**
27
+ * Restore options in a group from their backup values.
28
+ *
29
+ * @param group - Options group name.
30
+ */
12
31
  public UndoGroup(group: string): void;
13
32
 
33
+ /**
34
+ * Save current option values as the backup for a group.
35
+ *
36
+ * @param group - Options group name.
37
+ */
14
38
  public SaveBackupValues(group: string): void;
15
39
 
16
- public IsGroupChanged(group: string): boolean;
17
-
40
+ /**
41
+ * Persist current option values for a group.
42
+ *
43
+ * @param group - Options group name.
44
+ */
18
45
  public SaveValues(group: string): void;
19
46
 
47
+ /**
48
+ * Apply current engine option values to controls in a group.
49
+ *
50
+ * @param group - Options group name.
51
+ */
20
52
  public SetCurrentValues(group: string): void;
21
53
 
54
+ /**
55
+ * Check whether accepted options require a system restart.
56
+ *
57
+ * @returns Whether a system restart is needed.
58
+ */
22
59
  public NeedSystemRestart(): boolean;
23
60
 
61
+ /**
62
+ * Check whether accepted options require a video restart.
63
+ *
64
+ * @returns Whether a video restart is needed.
65
+ */
24
66
  public NeedVidRestart(): boolean;
25
67
 
68
+ /**
69
+ * Run post-accept handling after options are saved.
70
+ */
26
71
  public OptionsPostAccept(): void;
27
72
  }
28
73
 
29
74
  /**
75
+ * Main menu binding.
76
+ *
30
77
  * @source C++ class CMainMenu
31
78
  * @customConstructor CMainMenu
32
79
  * @group xr_ui_menu
80
+ *
81
+ * @remarks
82
+ * Engine-owned singleton returned by `main_menu.get_main_menu()`.
33
83
  */
34
84
  export class CMainMenu {
85
+ /**
86
+ * Get the CD key stored by the game.
87
+ *
88
+ * @returns CD key string.
89
+ */
35
90
  public GetCDKey(): string;
36
91
 
92
+ /**
93
+ * Get the multiplayer account manager.
94
+ *
95
+ * @returns Account manager.
96
+ */
37
97
  public GetAccountMngr(): account_manager;
38
98
 
99
+ /**
100
+ * Read metadata for a recorded demo file.
101
+ *
102
+ * @param fileName - Demo file name.
103
+ * @returns Demo info, or `null` when it cannot be read.
104
+ */
39
105
  public GetDemoInfo(fileName: string): demo_info | null;
40
106
 
107
+ /**
108
+ * Get patch download progress.
109
+ *
110
+ * @returns Patch progress object.
111
+ */
41
112
  public GetPatchProgress(): Patch_Dawnload_Progress;
42
113
 
114
+ /**
115
+ * Get the multiplayer profile store.
116
+ *
117
+ * @returns Profile store.
118
+ */
43
119
  public GetProfileStore(): profile_store;
44
120
 
121
+ /**
122
+ * Get GameSpy protocol version string.
123
+ *
124
+ * @returns GameSpy version.
125
+ */
45
126
  public GetGSVer(): string;
46
127
 
128
+ /**
129
+ * Get the multiplayer login manager.
130
+ *
131
+ * @returns Login manager.
132
+ */
47
133
  public GetLoginMngr(): login_manager;
48
134
 
135
+ /**
136
+ * Get the current player name.
137
+ *
138
+ * @returns Player name.
139
+ */
49
140
  public GetPlayerName(): string;
50
141
 
142
+ /**
143
+ * Cancel the active multiplayer map download.
144
+ */
51
145
  public CancelDownload(): void;
52
146
 
147
+ /**
148
+ * Validate the stored CD key.
149
+ *
150
+ * @returns Whether the CD key is valid.
151
+ */
53
152
  public ValidateCDKey(): boolean;
54
153
  }
55
154
 
56
155
  /**
156
+ * In-game UI root binding.
157
+ *
57
158
  * @source C++ class CUIGameCustom
58
159
  * @customConstructor CUIGameCustom
59
160
  * @group xr_ui_menu
161
+ *
162
+ * @remarks
163
+ * Current in-game HUD UI. Global helpers dereference the current game UI, so call them only while a level UI exists.
60
164
  */
61
165
  export class CUIGameCustom {
62
- public AddCustomStatic(id: string, b: boolean): StaticDrawableWrapper;
166
+ /**
167
+ * Add a custom HUD static by XML id.
168
+ *
169
+ * @remarks
170
+ * If `singleInstance` is true and an active static with this id already exists, that wrapper is returned.
171
+ *
172
+ * @param id - Static descriptor id.
173
+ * @param singleInstance - Whether an existing static with the same id should be reused.
174
+ * @returns Drawable wrapper for the static.
175
+ */
176
+ public AddCustomStatic(id: string, singleInstance: boolean): StaticDrawableWrapper;
63
177
 
64
- public AddCustomStatic(id: string, b: boolean, n: f32): StaticDrawableWrapper;
178
+ /**
179
+ * Add a custom HUD static by XML id and lifetime.
180
+ *
181
+ * @remarks
182
+ * The static is initialized from `ui_custom_msgs.xml`. Positive lifetime values remove it automatically after
183
+ * that many seconds unless the XML entry overrides `ttl`.
184
+ *
185
+ * @param id - Static descriptor id.
186
+ * @param singleInstance - Whether an existing static with the same id should be reused.
187
+ * @param lifetime - Time before the static is removed.
188
+ * @returns Drawable wrapper for the static.
189
+ */
190
+ public AddCustomStatic(id: string, singleInstance: boolean, lifetime: f32): StaticDrawableWrapper;
65
191
 
192
+ /**
193
+ * Add a dialog window to the HUD render list.
194
+ *
195
+ * @remarks
196
+ * Adds the window to the HUD dialog holder. It shows the window but does not take ownership of it.
197
+ *
198
+ * @param window - Dialog window.
199
+ */
66
200
  public AddDialogToRender(window: CUIWindow): void;
67
201
 
68
- public CurrentItemAtCell(): game_object;
202
+ /**
203
+ * Get the inventory item currently under the actor menu cursor.
204
+ *
205
+ * @since OpenXRay 2015-07-07, 6e703b4c
206
+ *
207
+ * @remarks
208
+ * Requires the actor menu to have a current inventory cell.
209
+ *
210
+ * @returns Game object for the item, or `null` when the cell has no item.
211
+ */
212
+ public CurrentItemAtCell(): game_object | null;
69
213
 
70
- public GetCustomStatic(value: string): StaticDrawableWrapper | null;
214
+ /**
215
+ * Get an active custom HUD static by id.
216
+ *
217
+ * @param id - Static descriptor id.
218
+ * @returns Drawable wrapper, or `null` when missing.
219
+ */
220
+ public GetCustomStatic(id: string): StaticDrawableWrapper | null;
71
221
 
222
+ /**
223
+ * Hide the actor inventory menu.
224
+ *
225
+ * @remarks
226
+ * No-op when the actor menu is already hidden.
227
+ */
72
228
  public HideActorMenu(): void;
73
229
 
230
+ /**
231
+ * Show the actor inventory menu.
232
+ *
233
+ * @remarks
234
+ * Toggles the actor menu. If it is already shown, the call hides it instead.
235
+ *
236
+ * @returns `true` after handling the toggle.
237
+ */
74
238
  public ShowActorMenu(): boolean;
75
239
 
240
+ /**
241
+ * Hide the PDA menu.
242
+ *
243
+ * @remarks
244
+ * No-op when the PDA menu is already hidden.
245
+ */
76
246
  public HidePdaMenu(): void;
77
247
 
248
+ /**
249
+ * Remove a custom HUD static.
250
+ *
251
+ * @remarks
252
+ * Destroys the matching HUD-owned wrapper when it exists.
253
+ *
254
+ * @param id - Static descriptor id.
255
+ */
78
256
  public RemoveCustomStatic(id: string): void;
79
257
 
258
+ /**
259
+ * Remove a dialog window from the HUD render list.
260
+ *
261
+ * @remarks
262
+ * Hides and disables the window in the HUD dialog holder. It does not destroy the window.
263
+ *
264
+ * @param window - Dialog window.
265
+ */
80
266
  public RemoveDialogToRender(window: CUIWindow): void;
81
267
 
268
+ /**
269
+ * Refresh actor menu state.
270
+ *
271
+ * @since OpenXRay 2015-07-07, 6e703b4c
272
+ *
273
+ * @remarks
274
+ * Updates the actor menu only when it is currently shown.
275
+ */
82
276
  public UpdateActorMenu(): void;
83
277
 
278
+ /**
279
+ * Enable or disable fake HUD indicators.
280
+ *
281
+ * @param enabled - New fake-indicator state.
282
+ */
84
283
  public enable_fake_indicators(enabled: boolean): void;
85
284
 
285
+ /**
286
+ * Hide HUD messages.
287
+ */
86
288
  public hide_messages(): void;
87
289
 
290
+ /**
291
+ * Show HUD messages.
292
+ */
88
293
  public show_messages(): void;
89
294
 
90
- public update_fake_indicators(u8: number, enabled: boolean): void;
295
+ /**
296
+ * Update fake indicator visibility.
297
+ *
298
+ * @param indicator - Indicator id.
299
+ * @param enabled - New indicator state.
300
+ */
301
+ public update_fake_indicators(indicator: number, enabled: boolean): void;
91
302
 
92
- public update_fake_indicators(u8: number, value: f32): void;
303
+ /**
304
+ * Update fake indicator value.
305
+ *
306
+ * @param indicator - Indicator id.
307
+ * @param value - New indicator value.
308
+ */
309
+ public update_fake_indicators(indicator: number, value: f32): void;
93
310
  }
94
311
 
95
312
  /**
313
+ * Main menu namespace exposed to scripts.
314
+ *
96
315
  * @source namespace main_menu
97
316
  * @group xr_ui_menu
98
317
  */
@@ -104,22 +323,39 @@ declare module "xray16" {
104
323
  }
105
324
 
106
325
  /**
326
+ * Actor/PDA menu namespace exposed to scripts.
327
+ *
107
328
  * @source namespace ActorMenu
108
329
  * @group xr_ui_menu
330
+ *
331
+ * @remarks
332
+ * These helpers dereference `CurrentGameUI()` directly. Use them only in-game after the HUD UI has been created.
109
333
  */
110
334
  export interface IXR_ActorMenu {
335
+ /**
336
+ * Get the current PDA menu window.
337
+ *
338
+ * @throws When called without an active current game UI.
339
+ *
340
+ * @returns PDA menu window.
341
+ */
111
342
  get_pda_menu(this: void): CUIPdaWnd;
343
+
344
+ /**
345
+ * Get the current actor menu window.
346
+ *
347
+ * @throws When called without an active current game UI.
348
+ *
349
+ * @returns Actor menu window.
350
+ */
112
351
  get_actor_menu(this: void): CUIActorMenu;
113
352
 
114
353
  /**
115
- * Enum EMenuMode
116
- * {
117
- * mmUndefined,
118
- * mmInventory,
119
- * mmTrade,
120
- * mmUpgrade,
121
- * mmDeadBodySearch,
122
- * }.
354
+ * Get current actor menu mode.
355
+ *
356
+ * @throws When called without an active current game UI.
357
+ *
358
+ * @returns Numeric `EMenuMode` value.
123
359
  */
124
360
  get_menu_mode(this: void): number;
125
361
  // Get_maingame(this: void): unknown; // CUIMainIngameWnd - not registered, throws exception
@@ -136,7 +372,14 @@ declare module "xray16" {
136
372
  export const main_menu: IXR_main_menu;
137
373
 
138
374
  /**
375
+ * Get the current game HUD UI.
376
+ *
139
377
  * @group xr_ui_menu
378
+ *
379
+ * @remarks
380
+ * The binding returns `CurrentGameUI()`. Call it only while a level HUD exists.
381
+ *
382
+ * @returns Current HUD UI controller.
140
383
  */
141
384
  export function get_hud(this: void): CUIGameCustom;
142
385
  }
@@ -1,58 +1,88 @@
1
1
  declare global {
2
2
  /**
3
- * Utility to get current file name as inline value during transpiling, similar to __filename in node.
3
+ * Current source file name injected at transpile time.
4
4
  *
5
5
  * @group xrf_plugin
6
6
  */
7
7
  const $filename: string;
8
8
 
9
9
  /**
10
- * Utility to get current directory name as inline value during transpiling, similar to __dirname in node.
10
+ * Current source directory name injected at transpile time.
11
11
  *
12
12
  * @group xrf_plugin
13
13
  */
14
14
  const $dirname: string;
15
15
 
16
16
  /**
17
- * Utility to transform TS provided array to a lua one.
18
- * Just wrapper that is stripped compile time, but simplifies unit testing with TS.
17
+ * Treat a TypeScript array as a Lua array.
18
+ *
19
+ * The transformer removes this call and emits its argument.
19
20
  *
20
21
  * @group xrf_plugin
21
22
  *
22
- * @param array
23
+ * @param array - TypeScript array.
24
+ * @returns Same value typed as a Lua array.
23
25
  */
24
26
  function $fromArray<T>(array: Array<T>): LuaTable<number, T>;
25
27
 
26
28
  /**
27
- * Utility to transform LUA array to JS array.
28
- * Just wrapper that is stripped compile time, but simplifies unit testing with TS.
29
+ * Treat a Lua array as a TypeScript array.
30
+ *
31
+ * The transformer removes this call and emits its argument.
29
32
  *
30
33
  * @group xrf_plugin
31
34
  *
32
- * @param array
35
+ * @param array - Lua array.
36
+ * @returns Same value typed as a TypeScript array.
33
37
  */
34
38
  function $fromLuaArray<T>(array: LuaTable<number, T>): Array<T>;
35
39
 
36
40
  /**
37
- * Utility to transform TS provided object to a lua table.
38
- * Just wrapper that is stripped compile time, but simplifies unit testing with TS.
41
+ * Treat a TypeScript object as a Lua table.
42
+ *
43
+ * The transformer removes this call and emits its argument.
39
44
  *
40
45
  * @group xrf_plugin
41
46
  *
42
- * @param object
47
+ * @param object - TypeScript object.
48
+ * @returns Same value typed as a Lua table.
43
49
  */
44
50
  function $fromObject<K extends string | number, T>(object: Record<K, T>): LuaTable<K, T>;
51
+
52
+ /**
53
+ * Treat a TypeScript object as a Lua table.
54
+ *
55
+ * The transformer removes this call and emits its argument.
56
+ *
57
+ * @group xrf_plugin
58
+ *
59
+ * @param object - TypeScript object.
60
+ * @returns Same value typed as a Lua table.
61
+ */
45
62
  function $fromObject<D>(object: D): LuaTable<keyof D, D[keyof D]>;
46
63
 
47
64
  /**
48
- * Utility to transform LUA provided table to a TS one.
49
- * Just wrapper that is stripped compile time, but simplifies unit testing with TS.
65
+ * Treat a Lua table as a TypeScript object.
66
+ *
67
+ * The transformer removes this call and emits its argument.
50
68
  *
51
69
  * @group xrf_plugin
52
70
  *
53
- * @param object
71
+ * @param object - Lua table.
72
+ * @returns Same value typed as a TypeScript object.
54
73
  */
55
74
  function $fromLuaTable<K extends string | number, T>(object: LuaTable<K, T>): Record<K, T>;
75
+
76
+ /**
77
+ * Treat a Lua table as a TypeScript object.
78
+ *
79
+ * The transformer removes this call and emits its argument.
80
+ *
81
+ * @group xrf_plugin
82
+ *
83
+ * @param object - Lua table.
84
+ * @returns Same value typed as a TypeScript object.
85
+ */
56
86
  function $fromLuaTable<D>(object: LuaTable<keyof D, D[keyof D]>): D;
57
87
  }
58
88