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
@@ -25,22 +25,63 @@ declare module "xray16" {
25
25
  * @group xr_game
26
26
  */
27
27
  export class GAME_TYPE {
28
+ /**
29
+ * Engine enum value for `GAME_TYPE.eGameIDArtefactHunt`.
30
+ */
28
31
  public static readonly eGameIDArtefactHunt: 8;
32
+ /**
33
+ * Engine enum value for `GAME_TYPE.eGameIDCaptureTheArtefact`.
34
+ */
29
35
  public static readonly eGameIDCaptureTheArtefact: 16;
36
+ /**
37
+ * Engine enum value for `GAME_TYPE.eGameIDDeathmatch`.
38
+ */
30
39
  public static readonly eGameIDDeathmatch: 2;
40
+ /**
41
+ * Engine enum value for `GAME_TYPE.eGameIDTeamDeathmatch`.
42
+ */
31
43
  public static readonly eGameIDTeamDeathmatch: 4;
32
44
 
45
+ /**
46
+ * Engine enum value for `GAME_TYPE.GAME_UNKNOWN`.
47
+ */
33
48
  public static readonly GAME_UNKNOWN: -1;
49
+ /**
50
+ * Engine enum value for `GAME_TYPE.GAME_ANY`.
51
+ */
34
52
  public static readonly GAME_ANY: 0;
53
+ /**
54
+ * Engine enum value for `GAME_TYPE.GAME_SINGLE`.
55
+ */
35
56
  public static readonly GAME_SINGLE: 1;
57
+ /**
58
+ * Engine enum value for `GAME_TYPE.GAME_DEATHMATCH`.
59
+ */
36
60
  public static readonly GAME_DEATHMATCH: 2;
61
+
37
62
  // GAME_CTF = 3,
38
63
  // GAME_ASSAULT = 4, // Team1 - assaulting, Team0 - Defending
64
+
65
+ /**
66
+ * Engine enum value for `GAME_TYPE.GAME_CS`.
67
+ */
39
68
  public static readonly GAME_CS: 5;
69
+ /**
70
+ * Engine enum value for `GAME_TYPE.GAME_TEAMDEATHMATCH`.
71
+ */
40
72
  public static readonly GAME_TEAMDEATHMATCH: 6;
73
+ /**
74
+ * Engine enum value for `GAME_TYPE.GAME_ARTEFACTHUNT`.
75
+ */
41
76
  public static readonly GAME_ARTEFACTHUNT: 7;
77
+ /**
78
+ * Engine enum value for `GAME_TYPE.GAME_CAPTURETHEARTEFACT`.
79
+ */
42
80
  public static readonly GAME_CAPTURETHEARTEFACT: 8;
43
81
  // Identifiers in range [100...254] are registered for script game type
82
+ /**
83
+ * Engine enum value for `GAME_TYPE.GAME_DUMMY`.
84
+ */
44
85
  public static readonly GAME_DUMMY: 255; // Temporary g
45
86
  }
46
87
 
@@ -57,9 +98,21 @@ declare module "xray16" {
57
98
  * @group xr_game
58
99
  */
59
100
  export class game_difficulty {
101
+ /**
102
+ * Engine enum value for `game_difficulty.novice`.
103
+ */
60
104
  public static readonly novice: 0;
105
+ /**
106
+ * Engine enum value for `game_difficulty.stalker`.
107
+ */
61
108
  public static readonly stalker: 1;
109
+ /**
110
+ * Engine enum value for `game_difficulty.veteran`.
111
+ */
62
112
  public static readonly veteran: 2;
113
+ /**
114
+ * Engine enum value for `game_difficulty.master`.
115
+ */
63
116
  public static readonly master: 3;
64
117
  }
65
118
 
@@ -83,6 +136,9 @@ declare module "xray16" {
83
136
  /**
84
137
  * Create a new game time value.
85
138
  *
139
+ * @remarks
140
+ * This is the same constructor exported as `CTime`.
141
+ *
86
142
  * @returns Empty `CTime` instance.
87
143
  */
88
144
  CTime: (this: void) => CTime;
@@ -90,6 +146,8 @@ declare module "xray16" {
90
146
  /**
91
147
  * Resolve a string table key for the current language.
92
148
  *
149
+ * @since OpenXRay 2022-08-09, a2d264fc, PR #1032
150
+ *
93
151
  * @param translation_key - String table key to translate.
94
152
  * @returns Localized text or the fallback string from the string table.
95
153
  */
@@ -98,30 +156,46 @@ declare module "xray16" {
98
156
  /**
99
157
  * Get current in-game time as seconds.
100
158
  *
159
+ * @remarks
160
+ * Returns the low 32 bits of the current game time counter.
161
+ *
101
162
  * @returns Game time counter.
102
163
  */
103
164
  time(this: void): u32;
104
165
 
105
166
  /**
106
167
  * Reload string table data for the active language.
168
+ *
169
+ * @since OpenXRay 2022-08-09, a2d264fc, PR #1032
107
170
  */
108
171
  reload_language(this: void): void;
109
172
 
110
173
  /**
111
174
  * Get current in-game calendar time.
112
175
  *
176
+ * @remarks
177
+ * Uses ALife game time when ALife is available, otherwise falls back to the current level game time.
178
+ *
113
179
  * @returns Current game time value.
114
180
  */
115
181
  get_game_time(this: void): CTime;
116
182
 
117
183
  /**
118
184
  * Write the current native stack trace to the engine log.
185
+ *
186
+ * @since OpenXRay 2022-08-09, a2d264fc, PR #1032
119
187
  */
120
188
  log_stack_trace(this: void): void;
121
189
 
122
190
  /**
123
191
  * Move the actor to another level by level name.
124
192
  *
193
+ * @since OpenXRay 2014-12-27, c82669625
194
+ *
195
+ * @remarks
196
+ * If the level name is not present in the game graph, the engine logs a script error and leaves the actor in the
197
+ * current level.
198
+ *
125
199
  * @param level_name - Target level name from the game graph.
126
200
  */
127
201
  jump_to_level(this: void, level_name: string): void;
@@ -129,6 +203,8 @@ declare module "xray16" {
129
203
  /**
130
204
  * Move the actor to another level graph point.
131
205
  *
206
+ * @since OpenXRay 2014-12-27, c82669625
207
+ *
132
208
  * @param position - Target position.
133
209
  * @param level_vertex_id - Target level vertex.
134
210
  * @param game_vertex_id - Target game graph vertex.
@@ -138,6 +214,8 @@ declare module "xray16" {
138
214
  /**
139
215
  * Move the actor to another level graph point and face a direction.
140
216
  *
217
+ * @since OpenXRay 2014-12-27, c82669625
218
+ *
141
219
  * @param position - Target position.
142
220
  * @param level_vertex_id - Target level vertex.
143
221
  * @param game_vertex_id - Target game graph vertex.
@@ -148,6 +226,10 @@ declare module "xray16" {
148
226
  /**
149
227
  * Start an in-game tutorial sequence.
150
228
  *
229
+ * @remarks
230
+ * Does nothing while the load screen is active. Starting a second tutorial stores the previous one as the fallback
231
+ * input receiver.
232
+ *
151
233
  * @param tutorial_id - Tutorial identifier.
152
234
  */
153
235
  start_tutorial(this: void, tutorial_id: string): void;
@@ -162,6 +244,11 @@ declare module "xray16" {
162
244
  /**
163
245
  * Get the active tutorial identifier.
164
246
  *
247
+ * @since OpenXRay 2022-08-09, a2d264fc, PR #1032
248
+ *
249
+ * @remarks
250
+ * Call only after `has_active_tutorial()` returns `true`; the binding dereferences the active tutorial directly.
251
+ *
165
252
  * @returns Active tutorial name.
166
253
  */
167
254
  active_tutorial_name(this: void): string;
@@ -219,7 +306,11 @@ declare module "xray16" {
219
306
  /**
220
307
  * Set the actor start position used by level transition logic.
221
308
  *
309
+ * @since OpenXRay 2022-08-22, 33f6da05, PR #1006
310
+ *
222
311
  * @group xr_game
312
+ * @remarks
313
+ * Updates the global start position consumed by ALife level-transition code.
223
314
  *
224
315
  * @param position - Target start position.
225
316
  */
@@ -228,8 +319,13 @@ declare module "xray16" {
228
319
  /**
229
320
  * Set the actor start game graph vertex.
230
321
  *
322
+ * @since OpenXRay 2022-08-22, 33f6da05, PR #1006
323
+ *
231
324
  * @group xr_game
232
325
  *
326
+ * @remarks
327
+ * Updates the global start game vertex consumed by ALife level-transition code.
328
+ *
233
329
  * @param game_vertex_id - Target game graph vertex.
234
330
  */
235
331
  export function set_start_game_vertex_id(this: void, game_vertex_id: i32): void;
@@ -239,6 +335,9 @@ declare module "xray16" {
239
335
  *
240
336
  * @group xr_game
241
337
  *
338
+ * @remarks
339
+ * On non-Windows builds this always returns `true`.
340
+ *
242
341
  * @returns Whether available address space is sufficient.
243
342
  */
244
343
  export function is_enough_address_space_available(this: void): boolean;
@@ -247,6 +346,8 @@ declare module "xray16" {
247
346
  * Ask the engine to verify that its watched thread is still running.
248
347
  *
249
348
  * @group xr_game
349
+ *
350
+ * @throws If called outside the active Lua thread.
250
351
  */
251
352
  export function verify_if_thread_is_running(this: void): void;
252
353
 
@@ -1,31 +1,115 @@
1
1
  declare module "xray16" {
2
2
  /**
3
+ * Hit packet that can be sent to game objects.
4
+ *
3
5
  * @source C++ class hit
4
6
  * @customConstructor hit
5
7
  * @group xr_hit
8
+ *
9
+ * @remarks
10
+ * A new hit defaults to wound damage with power `100`, impulse `100`, direction `(1, 0, 0)`, and no draftsman.
6
11
  */
7
12
  export class hit {
13
+ /**
14
+ * Engine enum value for `hit.burn`.
15
+ */
8
16
  public static readonly burn = 0;
17
+ /**
18
+ * Engine enum value for `hit.chemical_burn`.
19
+ */
9
20
  public static readonly chemical_burn = 2;
21
+ /**
22
+ * Engine enum value for `hit.dummy`.
23
+ */
10
24
  public static readonly dummy = 12;
25
+ /**
26
+ * Engine enum value for `hit.explosion`.
27
+ */
11
28
  public static readonly explosion = 7;
29
+ /**
30
+ * Engine enum value for `hit.fire_wound`.
31
+ */
12
32
  public static readonly fire_wound = 8;
33
+ /**
34
+ * Engine enum value for `hit.light_burn`.
35
+ */
13
36
  public static readonly light_burn = 11;
37
+ /**
38
+ * Engine enum value for `hit.physic_strike`.
39
+ */
40
+ public static readonly physic_strike = 10;
41
+ /**
42
+ * Engine enum value for `hit.radiation`.
43
+ */
14
44
  public static readonly radiation = 3;
45
+ /**
46
+ * Engine enum value for `hit.shock`.
47
+ */
15
48
  public static readonly shock = 1;
49
+ /**
50
+ * Engine enum value for `hit.strike`.
51
+ */
16
52
  public static readonly strike = 5;
53
+ /**
54
+ * Engine enum value for `hit.telepatic`.
55
+ */
17
56
  public static readonly telepatic = 4;
57
+ /**
58
+ * Engine enum value for `hit.wound`.
59
+ */
18
60
  public static readonly wound = 6;
19
61
 
62
+ /**
63
+ * Hit direction.
64
+ */
20
65
  public direction: vector;
66
+
67
+ /**
68
+ * Object that caused the hit.
69
+ *
70
+ * @remarks
71
+ * Leave `null` for world or scripted damage that should not be attributed to a game object.
72
+ */
21
73
  public draftsman: game_object | null;
74
+
75
+ /**
76
+ * Physics impulse applied with the hit.
77
+ */
22
78
  public impulse: f32;
79
+
80
+ /**
81
+ * Hit damage power.
82
+ */
23
83
  public power: f32;
84
+
85
+ /**
86
+ * Hit damage type.
87
+ */
24
88
  public type: TXR_hit_type;
25
89
 
90
+ /**
91
+ * Create an empty hit packet.
92
+ *
93
+ * @remarks
94
+ * Uses the engine default values described on `hit`.
95
+ */
26
96
  public constructor();
97
+
98
+ /**
99
+ * Copy an existing hit packet.
100
+ *
101
+ * @param hit - Source hit.
102
+ */
27
103
  public constructor(hit: hit);
28
104
 
105
+ /**
106
+ * Target a model bone by name.
107
+ *
108
+ * @remarks
109
+ * Stores the bone name on the hit. The receiving object resolves it against its own model.
110
+ *
111
+ * @param bone - Bone name used by the receiver model.
112
+ */
29
113
  public bone(bone: string): void;
30
114
  }
31
115
 
@@ -8,6 +8,10 @@ declare module "xray16" {
8
8
  * @source C++ class ini_file
9
9
  * @customConstructor ini_file
10
10
  * @group xr_ini
11
+ *
12
+ * @remarks
13
+ * Most typed read methods use the engine's strict config readers. Check `section_exist` and `line_exist` first when
14
+ * missing data is valid for your script.
11
15
  */
12
16
  export class ini_file {
13
17
  /**
@@ -16,9 +20,12 @@ declare module "xray16" {
16
20
  public constructor();
17
21
 
18
22
  /**
19
- * Open an ini file from a game path.
23
+ * Open an ini file from the game config path.
24
+ *
25
+ * @remarks
26
+ * This constructor resolves `path` below `$game_config$`.
20
27
  *
21
- * @param path - File name or path relative to game data.
28
+ * @param path - File name or path relative to `$game_config$`.
22
29
  */
23
30
  public constructor(path: string);
24
31
 
@@ -31,6 +38,9 @@ declare module "xray16" {
31
38
  public constructor(initial: string, path: string);
32
39
 
33
40
  /**
41
+ * @remarks
42
+ * Missing sections are an engine assertion path. The recoverable branch returns `0`.
43
+ *
34
44
  * @param section - Target section to check lines count.
35
45
  * @returns Count of lines for provided section.
36
46
  */
@@ -69,6 +79,8 @@ declare module "xray16" {
69
79
  /**
70
80
  * Read a floating-point value.
71
81
  *
82
+ * @throws If the section or field does not exist.
83
+ *
72
84
  * @param section - Section name.
73
85
  * @param field - Field name.
74
86
  * @returns Parsed number.
@@ -87,6 +99,8 @@ declare module "xray16" {
87
99
  /**
88
100
  * Read a signed 32-bit integer.
89
101
  *
102
+ * @throws If the section or field does not exist.
103
+ *
90
104
  * @param section - Section name.
91
105
  * @param field - Field name.
92
106
  * @returns Parsed integer.
@@ -96,6 +110,11 @@ declare module "xray16" {
96
110
  /**
97
111
  * Read text line from ini config file.
98
112
  *
113
+ * @remarks
114
+ * Returns `false` for an out-of-range line index. A missing section is a hard engine error.
115
+ *
116
+ * @throws If the section does not exist.
117
+ *
99
118
  * @param section - Section name.
100
119
  * @param line_number - Zero-based line index inside the section.
101
120
  * @param key - Placeholder for Lua out parameter.
@@ -122,6 +141,8 @@ declare module "xray16" {
122
141
  /**
123
142
  * Read a 3D vector.
124
143
  *
144
+ * @throws If the section or field does not exist.
145
+ *
125
146
  * @param section - Section name.
126
147
  * @param field - Field name.
127
148
  * @returns Parsed vector.
@@ -131,6 +152,8 @@ declare module "xray16" {
131
152
  /**
132
153
  * Read an unsigned 32-bit integer.
133
154
  *
155
+ * @throws If the section or field does not exist.
156
+ *
134
157
  * @param section - Section name.
135
158
  * @param field - Field name.
136
159
  * @returns Parsed integer.
@@ -140,6 +163,9 @@ declare module "xray16" {
140
163
  /**
141
164
  * Read a quoted string value.
142
165
  *
166
+ * @remarks
167
+ * Uses the same engine reader as `r_string_wb`; quoted values may keep spaces.
168
+ *
143
169
  * @param section - Section name.
144
170
  * @param field - Field name.
145
171
  * @returns Parsed string.
@@ -147,6 +173,9 @@ declare module "xray16" {
147
173
  public r_string_wq(section: string, field: string): string;
148
174
 
149
175
  /**
176
+ * @remarks
177
+ * Reads a string with blanks preserved by the engine parser.
178
+ *
150
179
  * @param section - Ini file section.
151
180
  * @param field - Ini section field.
152
181
  * @returns If quoted, parsed string data inside quotes including spaces, else is same data as with r_string.
@@ -154,6 +183,8 @@ declare module "xray16" {
154
183
  public r_string_wb(section: string, field: string): string;
155
184
 
156
185
  /**
186
+ * @throws If the section or field does not exist.
187
+ *
157
188
  * @param section - Ini file section.
158
189
  * @param field - Ini section field.
159
190
  * @returns Raw string from ltx file without spaces in it.
@@ -172,6 +203,8 @@ declare module "xray16" {
172
203
  /**
173
204
  * Write a 2D vector value.
174
205
  *
206
+ * @since OpenXRay 2014-12-30, 565b39e5
207
+ *
175
208
  * @param section - Section name.
176
209
  * @param field - Field name.
177
210
  * @param vector - Value to write.
@@ -182,6 +215,8 @@ declare module "xray16" {
182
215
  /**
183
216
  * Write a 3D vector value.
184
217
  *
218
+ * @since OpenXRay 2014-12-30, 565b39e5
219
+ *
185
220
  * @param section - Section name.
186
221
  * @param field - Field name.
187
222
  * @param vector - Value to write.
@@ -192,6 +227,8 @@ declare module "xray16" {
192
227
  /**
193
228
  * Write a 4D vector value.
194
229
  *
230
+ * @since OpenXRay 2014-12-30, 565b39e5
231
+ *
195
232
  * @param section - Section name.
196
233
  * @param field - Field name.
197
234
  * @param vector - Value to write.
@@ -348,6 +385,8 @@ declare module "xray16" {
348
385
  /**
349
386
  * Enable or disable section override name handling.
350
387
  *
388
+ * @since OpenXRay 2014-12-30, 565b39e5
389
+ *
351
390
  * @param override - Whether override names should be used.
352
391
  */
353
392
  public set_override_names(override: boolean): void;
@@ -355,6 +394,8 @@ declare module "xray16" {
355
394
  /**
356
395
  * Save this ini file to a path.
357
396
  *
397
+ * @throws If `path` is missing.
398
+ *
358
399
  * @param path - Destination path.
359
400
  * @returns Whether saving succeeded.
360
401
  */
@@ -363,6 +404,10 @@ declare module "xray16" {
363
404
  /**
364
405
  * Adjust saving on file closing/destructor calls.
365
406
  *
407
+ * @remarks
408
+ * Intended for script-created or script-owned ini files. Be careful using it on engine-owned singletons returned
409
+ * by `game_ini` or `system_ini`.
410
+ *
366
411
  * @param should_save - Whether ini file should be saved when destructor is called.
367
412
  */
368
413
  public save_at_end(should_save: boolean): void;
@@ -381,6 +426,9 @@ declare module "xray16" {
381
426
  *
382
427
  * @group xr_ini
383
428
  *
429
+ * @remarks
430
+ * Parses the string through an in-memory reader using `$game_config$` as the base include path.
431
+ *
384
432
  * @param content - String value to be read as ini file.
385
433
  * @returns New ini file instance based on provided content.
386
434
  */
@@ -391,6 +439,9 @@ declare module "xray16" {
391
439
  *
392
440
  * @group xr_ini
393
441
  *
442
+ * @remarks
443
+ * Returns the engine-owned `pGameIni` singleton.
444
+ *
394
445
  * @returns Current game ini file.
395
446
  */
396
447
  export function game_ini(this: void): ini_file;
@@ -400,6 +451,9 @@ declare module "xray16" {
400
451
  *
401
452
  * @group xr_ini
402
453
  *
454
+ * @remarks
455
+ * Returns the engine-owned `pSettings` singleton.
456
+ *
403
457
  * @returns Current system ini file.
404
458
  */
405
459
  export function system_ini(this: void): ini_file;
@@ -409,6 +463,10 @@ declare module "xray16" {
409
463
  *
410
464
  * @group xr_ini
411
465
  *
466
+ * @remarks
467
+ * Destroys the current `pSettings` instance and reloads `system.ltx` from `$game_config$`. Avoid keeping old
468
+ * `system_ini()` references across this call.
469
+ *
412
470
  * @returns Reloaded system ini file.
413
471
  */
414
472
  export function reload_system_ini(this: void): ini_file;