xray16 1.3.4 → 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.
Files changed (84) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +112 -106
  3. package/package.json +45 -42
  4. package/plugins/built_at_info.d.ts +1 -1
  5. package/plugins/from_cast_utils.d.ts +1 -1
  6. package/plugins/global_declarations_transform.d.ts +1 -1
  7. package/plugins/inject_file_meta.d.ts +1 -1
  8. package/plugins/inject_tracy_zones.d.ts +1 -1
  9. package/plugins/inject_tracy_zones.js +2 -2
  10. package/plugins/strip_lua_logger.d.ts +1 -1
  11. package/plugins/strip_lua_logger.js +1 -1
  12. package/plugins/transform_luabind_class/plugin.d.ts +1 -1
  13. package/plugins/transform_luabind_class/transformation/class_declaration.d.ts +3 -3
  14. package/plugins/transform_luabind_class/transformation/decorators.d.ts +5 -2
  15. package/plugins/transform_luabind_class/transformation/decorators.js +3 -0
  16. package/plugins/transform_luabind_class/transformation/members/accessors.d.ts +1 -1
  17. package/plugins/transform_luabind_class/transformation/members/constructor.d.ts +2 -2
  18. package/plugins/transform_luabind_class/transformation/members/constructor.js +2 -2
  19. package/plugins/transform_luabind_class/transformation/members/fields.d.ts +5 -2
  20. package/plugins/transform_luabind_class/transformation/members/fields.js +5 -2
  21. package/plugins/transform_luabind_class/transformation/members/method.d.ts +6 -3
  22. package/plugins/transform_luabind_class/transformation/members/method.js +4 -1
  23. package/plugins/transform_luabind_class/transformation/new.d.ts +7 -3
  24. package/plugins/transform_luabind_class/transformation/new.js +5 -1
  25. package/plugins/transform_luabind_class/transformation/setup.d.ts +9 -3
  26. package/plugins/transform_luabind_class/transformation/setup.js +22 -6
  27. package/plugins/transform_luabind_class/transformation/super.d.ts +19 -3
  28. package/plugins/transform_luabind_class/transformation/super.js +17 -1
  29. package/plugins/transform_luabind_class/transformation/utils.d.ts +27 -4
  30. package/plugins/transform_luabind_class/transformation/utils.js +25 -2
  31. package/plugins/utils/ast.d.ts +1 -1
  32. package/plugins/utils/diagnostics.d.ts +9 -5
  33. package/plugins/utils/diagnostics.js +5 -1
  34. package/plugins/utils/tracy.d.ts +1 -1
  35. package/types/index.d.ts +55 -55
  36. package/types/xr_ai/xr_action.d.ts +1802 -510
  37. package/types/xr_ai/xr_alife.d.ts +1870 -566
  38. package/types/xr_ai/xr_enemy_evaluation.d.ts +134 -41
  39. package/types/xr_ai/xr_goap.d.ts +1116 -668
  40. package/types/xr_ai/xr_graph.d.ts +135 -47
  41. package/types/xr_ai/xr_memory.d.ts +382 -148
  42. package/types/xr_lib/xr_animation.d.ts +252 -81
  43. package/types/xr_lib/xr_bitwise.d.ts +44 -21
  44. package/types/xr_lib/xr_color.d.ts +142 -40
  45. package/types/xr_lib/xr_debug.d.ts +181 -77
  46. package/types/xr_lib/xr_dialog.d.ts +132 -40
  47. package/types/xr_lib/xr_flags.d.ts +592 -148
  48. package/types/xr_lib/xr_fs.d.ts +539 -148
  49. package/types/xr_lib/xr_game.d.ts +362 -158
  50. package/types/xr_lib/xr_hit.d.ts +125 -41
  51. package/types/xr_lib/xr_ini.d.ts +473 -188
  52. package/types/xr_lib/xr_level.d.ts +795 -225
  53. package/types/xr_lib/xr_luabind.d.ts +90 -59
  54. package/types/xr_lib/xr_map.d.ts +192 -61
  55. package/types/xr_lib/xr_math.d.ts +871 -233
  56. package/types/xr_lib/xr_multiplayer.d.ts +1079 -351
  57. package/types/xr_lib/xr_profile.d.ts +272 -160
  58. package/types/xr_lib/xr_properties.d.ts +610 -166
  59. package/types/xr_lib/xr_relation.d.ts +231 -84
  60. package/types/xr_lib/xr_render.d.ts +167 -69
  61. package/types/xr_lib/xr_save.d.ts +833 -223
  62. package/types/xr_lib/xr_sound.d.ts +515 -151
  63. package/types/xr_lib/xr_stats.ts +49 -20
  64. package/types/xr_lib/xr_task.d.ts +388 -111
  65. package/types/xr_lib/xr_time.d.ts +177 -61
  66. package/types/xr_lib/xr_type.d.ts +75 -75
  67. package/types/xr_object/client/xr_anomaly.d.ts +70 -50
  68. package/types/xr_object/client/xr_artefact.d.ts +153 -98
  69. package/types/xr_object/client/xr_client_object.d.ts +207 -76
  70. package/types/xr_object/client/xr_creature.d.ts +243 -164
  71. package/types/xr_object/client/xr_item.d.ts +370 -264
  72. package/types/xr_object/client/xr_level.d.ts +753 -285
  73. package/types/xr_object/client/xr_physic.d.ts +644 -214
  74. package/types/xr_object/client/xr_zone.d.ts +85 -47
  75. package/types/xr_object/script/xr_script_interface.d.ts +819 -584
  76. package/types/xr_object/script/xr_script_object.d.ts +5728 -1390
  77. package/types/xr_object/script/xr_script_trade.d.ts +51 -26
  78. package/types/xr_object/server/xr_server_object.d.ts +1486 -792
  79. package/types/xr_ui/xr_ui_asset.d.ts +364 -123
  80. package/types/xr_ui/xr_ui_core.d.ts +424 -97
  81. package/types/xr_ui/xr_ui_event.d.ts +1449 -381
  82. package/types/xr_ui/xr_ui_interface.d.ts +2447 -903
  83. package/types/xr_ui/xr_ui_menu.d.ts +385 -142
  84. package/types/xrf_plugin.d.ts +89 -51
@@ -1,20 +1,49 @@
1
- declare module "xray16" {
2
- /**
3
- * @source namespace actor_stats
4
- * @group xr_stats
5
- */
6
- export interface IXR_actor_stats {
7
- add_points_str(this: void, value1: string, value2: string, value3: string): void;
8
-
9
- get_points(this: void, value: string): i32;
10
-
11
- add_points(this: void, value1: string, value2: string, value3: i32, value4: i32): void;
12
-
13
- remove_from_ranking(this: void, object_id: number): void | null;
14
- }
15
-
16
- /**
17
- * @group xr_stats
18
- */
19
- export const actor_stats: IXR_actor_stats;
20
- }
1
+ declare module "xray16" {
2
+ /**
3
+ * Actor statistics helpers exposed through the `actor_stats` namespace.
4
+ *
5
+ * @group xr_stats
6
+ */
7
+ export interface IXR_actor_stats {
8
+ /**
9
+ * Add actor statistic points with a string value.
10
+ *
11
+ * @param section - Statistic section id.
12
+ * @param detail_key - Detail key inside the section.
13
+ * @param value - String value to add.
14
+ */
15
+ add_points_str(this: void, section: string, detail_key: string, value: string): void;
16
+
17
+ /**
18
+ * Get total actor points for a statistic section.
19
+ *
20
+ * @param section - Statistic section id.
21
+ * @returns Section points.
22
+ */
23
+ get_points(this: void, section: string): i32;
24
+
25
+ /**
26
+ * Add actor statistic points with count and score.
27
+ *
28
+ * @param section - Statistic section id.
29
+ * @param detail_key - Detail key inside the section.
30
+ * @param count - Count to add.
31
+ * @param points - Points to add.
32
+ */
33
+ add_points(this: void, section: string, detail_key: string, count: i32, points: i32): void;
34
+
35
+ /**
36
+ * Remove an object from actor ranking when this optional binding exists.
37
+ *
38
+ * @param object_id - Object id to remove.
39
+ */
40
+ remove_from_ranking(this: void, object_id: number): void | null;
41
+ }
42
+
43
+ /**
44
+ * Actor statistics namespace.
45
+ *
46
+ * @group xr_stats
47
+ */
48
+ export const actor_stats: IXR_actor_stats;
49
+ }
@@ -1,111 +1,388 @@
1
- declare module "xray16" {
2
- /**
3
- * @source C++ class task
4
- * @customConstructor task
5
- * @group xr_task
6
- */
7
- export class task {
8
- public static readonly additional: 1;
9
- public static readonly completed: 2;
10
- public static readonly fail: 0;
11
- public static readonly in_progress: 1;
12
- public static readonly storyline: 0;
13
- public static readonly task_dummy: 65535;
14
-
15
- private constructor();
16
- }
17
-
18
- /**
19
- * @group xr_task
20
- */
21
- export type TXR_TaskStateName = EnumeratedStaticsKeys<typeof task>;
22
-
23
- /**
24
- * ETaskState
25
- *
26
- * @group xr_task
27
- */
28
- export type TXR_TaskState = EnumeratedStaticsValues<typeof task>;
29
-
30
- /**
31
- * @source C++ class SGameTaskObjective
32
- * @customConstructor SGameTaskObjective
33
- * @group xr_task
34
- */
35
- export class SGameTaskObjective {
36
- public constructor(task: CGameTask, id: i32);
37
-
38
- public set_icon_name(icon_name: string): void;
39
-
40
- public get_icon_name<T extends string = string>(): T | null;
41
-
42
- public set_description(description: string): void;
43
-
44
- public get_description(): string;
45
-
46
- public set_title(title: string): void;
47
-
48
- public get_title(): string;
49
-
50
- public set_map_location(location: string): void;
51
-
52
- public add_on_complete_func(function_name: string): void;
53
-
54
- public add_complete_info(value: string): void;
55
-
56
- public add_on_fail_info(value: string): void;
57
-
58
- public add_on_fail_func(function_name: string): void;
59
-
60
- public add_on_complete_info(value: string): void;
61
-
62
- public add_complete_func(function_name: string): void;
63
-
64
- public add_fail_func(function_name: string): void;
65
-
66
- public add_fail_info(value: string): void;
67
-
68
- public get_state(): TXR_TaskState;
69
-
70
- public get_type(): number; /* ETaskType */
71
-
72
- public set_type(type: i32 /* ETaskType */): void;
73
-
74
- public set_map_hint(hint: string): void;
75
-
76
- /**
77
- * @returns target map location of task object
78
- */
79
- public get_map_location(): string;
80
-
81
- /**
82
- * @returns target map object ID of task object
83
- */
84
- public get_map_object_id(): u16;
85
-
86
- public change_map_location(new_map_location: string, new_map_object_id: u16): void;
87
-
88
- public remove_map_locations(notify: boolean): void;
89
-
90
- public create_map_location(on_load: boolean): void;
91
-
92
- public set_map_object_id(id: i32): void;
93
- }
94
-
95
- /**
96
- * @source C++ class CGameTask : SGameTaskObjective
97
- * @customConstructor CGameTask
98
- * @group xr_task
99
- */
100
- export class CGameTask extends SGameTaskObjective {
101
- public constructor();
102
-
103
- public get_id(): string;
104
-
105
- public set_priority(priority: i32): void;
106
-
107
- public set_id(id: string): void;
108
-
109
- public get_priority(): u32;
110
- }
111
- }
1
+ declare module "xray16" {
2
+ /**
3
+ * Task state and task type constants.
4
+ *
5
+ * @source C++ class task
6
+ * @customConstructor task
7
+ * @group xr_task
8
+ *
9
+ * @remarks
10
+ * State and type constants share one native export. Use the matching subset for each API.
11
+ */
12
+ export class task {
13
+ /**
14
+ * Engine enum value for `task.additional`.
15
+ */
16
+ public static readonly additional: 1;
17
+ /**
18
+ * Engine enum value for `task.completed`.
19
+ */
20
+ public static readonly completed: 2;
21
+ /**
22
+ * Engine enum value for `task.fail`.
23
+ */
24
+ public static readonly fail: 0;
25
+ /**
26
+ * Engine enum value for `task.in_progress`.
27
+ */
28
+ public static readonly in_progress: 1;
29
+ /**
30
+ * Engine enum value for `task.insignificant`.
31
+ */
32
+ public static readonly insignificant: 2;
33
+ /**
34
+ * Engine enum value for `task.storyline`.
35
+ */
36
+ public static readonly storyline: 0;
37
+ /**
38
+ * Engine enum value for `task.task_dummy`.
39
+ */
40
+ public static readonly task_dummy: 65535;
41
+
42
+ /**
43
+ * Engine-owned task constants.
44
+ */
45
+ private constructor();
46
+ }
47
+
48
+ /**
49
+ * @group xr_task
50
+ */
51
+ export type TXR_TaskStateName = EnumeratedStaticsKeys<typeof task>;
52
+
53
+ /**
54
+ * ETaskState.
55
+ *
56
+ * @group xr_task
57
+ */
58
+ export type TXR_TaskState = EnumeratedStaticsValues<typeof task>;
59
+
60
+ /**
61
+ * One objective inside a game task.
62
+ *
63
+ * @source C++ class SGameTaskObjective
64
+ * @customConstructor SGameTaskObjective
65
+ * @group xr_task
66
+ *
67
+ * @remarks
68
+ * Objective `0` is the task root objective. Additional objectives start at `1`.
69
+ */
70
+ export class SGameTaskObjective {
71
+ /**
72
+ * Whether the default map location should be visible for this objective.
73
+ *
74
+ * @remarks
75
+ * This mirrors the native `def_ml_enabled` field used by loaded task objectives.
76
+ */
77
+ public def_ml_enabled: boolean;
78
+
79
+ /**
80
+ * @remarks
81
+ * The objective stores a pointer to `task`; keep the parent task alive while using this objective.
82
+ *
83
+ * @param task - Parent task.
84
+ * @param id - Objective index.
85
+ */
86
+ public constructor(task: CGameTask, id: i32);
87
+
88
+ /**
89
+ * Get objective index inside the parent task.
90
+ *
91
+ * @returns Objective index.
92
+ */
93
+ public get_idx(): u16;
94
+
95
+ /**
96
+ * Set objective icon texture.
97
+ *
98
+ * @param icon_name - Icon texture or string table id.
99
+ */
100
+ public set_icon_name(icon_name: string): void;
101
+
102
+ /**
103
+ * @returns Objective icon name, or null when none is set.
104
+ */
105
+ public get_icon_name<T extends string = string>(): T | null;
106
+
107
+ /**
108
+ * Set objective description text.
109
+ *
110
+ * @param description - Description text or string table id.
111
+ */
112
+ public set_description(description: string): void;
113
+
114
+ /**
115
+ * @returns Objective description text or string table id.
116
+ */
117
+ public get_description(): string;
118
+
119
+ /**
120
+ * Set objective title.
121
+ *
122
+ * @param title - Title text or string table id.
123
+ */
124
+ public set_title(title: string): void;
125
+
126
+ /**
127
+ * @returns Objective title.
128
+ */
129
+ public get_title(): string;
130
+
131
+ /**
132
+ * Set encyclopedia article id unlocked with this objective.
133
+ *
134
+ * @param id - Encyclopedia article id.
135
+ */
136
+ public set_article_id(id: string): void;
137
+
138
+ /**
139
+ * Set encyclopedia article key for this objective.
140
+ *
141
+ * @param key - Article key.
142
+ */
143
+ public set_article_key(key: string): void;
144
+
145
+ /**
146
+ * Set map spot type used by this objective.
147
+ *
148
+ * @param location - Map location type.
149
+ */
150
+ public set_map_location(location: string): void;
151
+
152
+ /**
153
+ * Add a script function called after objective completion.
154
+ *
155
+ * @remarks
156
+ * Function names are resolved when a script-created objective is added to a task. Missing functions are logged and
157
+ * then skipped by the engine.
158
+ *
159
+ * @param function_name - Script function name.
160
+ */
161
+ public add_on_complete_func(function_name: string): void;
162
+
163
+ /**
164
+ * Require an info portion for objective completion.
165
+ *
166
+ * @param value - Info portion id.
167
+ */
168
+ public add_complete_info(value: string): void;
169
+
170
+ /**
171
+ * Give an info portion when objective fails.
172
+ *
173
+ * @param value - Info portion id.
174
+ */
175
+ public add_on_fail_info(value: string): void;
176
+
177
+ /**
178
+ * Add a script function called after objective failure.
179
+ *
180
+ * @remarks
181
+ * Function names are resolved when a script-created objective is added to a task. Missing functions are logged and
182
+ * then skipped by the engine.
183
+ *
184
+ * @param function_name - Script function name.
185
+ */
186
+ public add_on_fail_func(function_name: string): void;
187
+
188
+ /**
189
+ * Give an info portion when objective completes.
190
+ *
191
+ * @param value - Info portion id.
192
+ */
193
+ public add_on_complete_info(value: string): void;
194
+
195
+ /**
196
+ * Add a script predicate used to decide objective completion.
197
+ *
198
+ * @remarks
199
+ * Function names are resolved when a script-created objective is added to a task. Missing functions are logged and
200
+ * then skipped by the engine.
201
+ *
202
+ * @param function_name - Script function name.
203
+ */
204
+ public add_complete_func(function_name: string): void;
205
+
206
+ /**
207
+ * Add a script predicate used to decide objective failure.
208
+ *
209
+ * @remarks
210
+ * Function names are resolved when a script-created objective is added to a task. Missing functions are logged and
211
+ * then skipped by the engine.
212
+ *
213
+ * @param function_name - Script function name.
214
+ */
215
+ public add_fail_func(function_name: string): void;
216
+
217
+ /**
218
+ * Require an info portion for objective failure.
219
+ *
220
+ * @param value - Info portion id.
221
+ */
222
+ public add_fail_info(value: string): void;
223
+
224
+ /**
225
+ * @returns Current objective state.
226
+ */
227
+ public get_state(): TXR_TaskState;
228
+
229
+ /**
230
+ * @returns Task type, such as `task.storyline` or `task.additional`.
231
+ */
232
+ public get_type(): number; /* ETaskType */
233
+
234
+ /**
235
+ * Set task type.
236
+ *
237
+ * @param type - Task type, such as `task.storyline` or `task.additional`.
238
+ */
239
+ public set_type(type: i32 /* ETaskType */): void;
240
+
241
+ /**
242
+ * Set hint text for the linked map location.
243
+ *
244
+ * @param hint - Hint text or string table id.
245
+ */
246
+ public set_map_hint(hint: string): void;
247
+
248
+ /**
249
+ * @returns Target map location of task object.
250
+ */
251
+ public get_map_location(): string;
252
+
253
+ /**
254
+ * @returns Target map object ID of task object.
255
+ */
256
+ public get_map_object_id(): u16;
257
+
258
+ /**
259
+ * Replace linked map location data and recreate the spot.
260
+ *
261
+ * @remarks
262
+ * Removes the current linked spot, sets the objective back to `task.in_progress`, then creates a new map spot.
263
+ *
264
+ * @param new_map_location - New map location type.
265
+ * @param new_map_object_id - New target object id.
266
+ */
267
+ public change_map_location(new_map_location: string, new_map_object_id: u16): void;
268
+
269
+ /**
270
+ * Remove linked map locations.
271
+ *
272
+ * @remarks
273
+ * When `notify` is `false`, the linked map location is removed from the level map manager. The objective then clears
274
+ * its stored location type and object id.
275
+ *
276
+ * @param notify - Whether to notify task manager that the location was released.
277
+ */
278
+ public remove_map_locations(notify: boolean): void;
279
+
280
+ /**
281
+ * Create the linked map location if the objective has a spot type and object id.
282
+ *
283
+ * @remarks
284
+ * During load, the objective tries to reattach to an existing serializable spot owned by the task. During normal
285
+ * creation, it creates a new serializable spot and disables its pointer. The objective must already have a map
286
+ * location type and a valid game object id.
287
+ *
288
+ * @param on_load - Whether creation happens during save loading.
289
+ */
290
+ public create_map_location(on_load: boolean): void;
291
+
292
+ /**
293
+ * Set object id tracked by the objective map spot.
294
+ *
295
+ * @param id - Game object id.
296
+ */
297
+ public set_map_object_id(id: i32): void;
298
+
299
+ /**
300
+ * Shadow of Chernobyl alias for `set_map_object_id`.
301
+ *
302
+ * @param id - Game object id.
303
+ */
304
+ public set_object_id(id: i32): void;
305
+ }
306
+
307
+ /**
308
+ * Game task with one or more objectives.
309
+ *
310
+ * @source C++ class CGameTask : SGameTaskObjective
311
+ * @customConstructor CGameTask
312
+ * @group xr_task
313
+ *
314
+ * @remarks
315
+ * A task is also its root objective. Methods inherited from `SGameTaskObjective` operate on that root objective.
316
+ */
317
+ export class CGameTask extends SGameTaskObjective {
318
+ /**
319
+ * Create an empty game task.
320
+ */
321
+ public constructor();
322
+
323
+ /**
324
+ * Load task data from configs.
325
+ *
326
+ * @remarks
327
+ * Reads from `gameplay/game_tasks.xml`. Task XML function names are resolved immediately.
328
+ *
329
+ * @throws If the task id is missing from `game_tasks.xml` or a referenced task function cannot be resolved.
330
+ *
331
+ * @param id - Task id.
332
+ */
333
+ public load(id: string): void;
334
+
335
+ /**
336
+ * @returns Task id.
337
+ */
338
+ public get_id(): string;
339
+
340
+ /**
341
+ * Set task priority used by task UI ordering.
342
+ *
343
+ * @param priority - New priority.
344
+ */
345
+ public set_priority(priority: i32): void;
346
+
347
+ /**
348
+ * Set task id.
349
+ *
350
+ * @param id - Task id.
351
+ */
352
+ public set_id(id: string): void;
353
+
354
+ /**
355
+ * @returns Task priority.
356
+ */
357
+ public get_priority(): u32;
358
+
359
+ /**
360
+ * Add an objective to this task.
361
+ *
362
+ * @remarks
363
+ * The native binding adopts the objective and copies its current data into the task objective list. Mutating the
364
+ * original objective after this call does not update the stored copy.
365
+ *
366
+ * @param objective - Objective to adopt into the task.
367
+ */
368
+ public add_objective(objective: SGameTaskObjective): void;
369
+
370
+ /**
371
+ * Get objective by index.
372
+ *
373
+ * @remarks
374
+ * Index `0` returns the root objective. Other indices access native storage without a bounds check.
375
+ *
376
+ * @param objective_id - Objective index.
377
+ * @returns Objective instance.
378
+ */
379
+ public get_objective(objective_id: i32): SGameTaskObjective;
380
+
381
+ /**
382
+ * Count task objectives including the root objective.
383
+ *
384
+ * @returns Objective count.
385
+ */
386
+ public get_objectives_cnt(): u32;
387
+ }
388
+ }