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,77 +1,181 @@
1
- declare module "xray16" {
2
- /**
3
- * @source C++ class CConsole
4
- * @customConstructor CConsole
5
- * @group xr_debug
6
- */
7
- export class CConsole extends EngineBinding {
8
- private constructor();
9
-
10
- public execute(command: string): void;
11
-
12
- public execute_deferred(command: string): void;
13
-
14
- public execute_script(script: string): void;
15
-
16
- public show(): void;
17
-
18
- public hide(): void;
19
-
20
- public get_bool(key: string): boolean;
21
-
22
- public get_float(key: string): f32;
23
-
24
- public get_integer(key: string): i32;
25
-
26
- public get_string(key: string): string;
27
-
28
- public get_token(key: string): string;
29
- }
30
-
31
- /**
32
- * Log formatted message in game console and log file.
33
- * Resulting message looks like "[LUA] %s", where message is provided text parameter.
34
- *
35
- * Note: text length is limited and supplying too long value will crash the game. todo: check exact limit.
36
- *
37
- * @group xr_debug
38
- * @param text - string to print
39
- */
40
- export function log(this: void, text: string): void;
41
-
42
- /**
43
- * @group xr_debug
44
- */
45
- export function error_log(this: void, text: string): void;
46
-
47
- /**
48
- * @group xr_debug
49
- */
50
- export function print_stack(this: void): void;
51
-
52
- /**
53
- * @group xr_debug
54
- */
55
- export function flush(this: void): void;
56
-
57
- /**
58
- * Get console object reference.
59
- * Allows flushing logs / executing commands / getting global engine variables.
60
- *
61
- * @group xr_debug
62
- * @returns console object reference
63
- */
64
- export function get_console(this: void): CConsole;
65
-
66
- /**
67
- * @group xr_debug
68
- */
69
- export function command_line(this: void): string;
70
-
71
- /**
72
- * Prefetch provided script before executing next lines.
73
- *
74
- * @group xr_global_declaration
75
- */
76
- export function prefetch(this: void, path: string): void;
77
- }
1
+ declare module "xray16" {
2
+ /**
3
+ * Engine console interface.
4
+ *
5
+ * @source C++ class CConsole
6
+ * @customConstructor CConsole
7
+ * @group xr_debug
8
+ *
9
+ * @remarks
10
+ * Use `get_console()` to access the engine-owned console. Scripts do not create console instances.
11
+ */
12
+ export class CConsole extends EngineBinding {
13
+ /**
14
+ * Engine-owned console singleton.
15
+ */
16
+ private constructor();
17
+
18
+ /**
19
+ * Execute console command immediately.
20
+ *
21
+ * @remarks
22
+ * Executes without adding the command to console history.
23
+ *
24
+ * @param command - Console command.
25
+ */
26
+ public execute(command: string): void;
27
+
28
+ /**
29
+ * Queue console command for deferred execution.
30
+ *
31
+ * @remarks
32
+ * Schedules a `KERNEL:console` event, so the command runs later on the engine event queue.
33
+ *
34
+ * @param command - Console command.
35
+ */
36
+ public execute_deferred(command: string): void;
37
+
38
+ /**
39
+ * Execute a config file through the console.
40
+ *
41
+ * @remarks
42
+ * The binding prepends `cfg_load` to the provided path.
43
+ *
44
+ * @param script - Config file path.
45
+ */
46
+ public execute_script(script: string): void;
47
+
48
+ /**
49
+ * Show the console window.
50
+ */
51
+ public show(): void;
52
+
53
+ /**
54
+ * Hide the console window.
55
+ */
56
+ public hide(): void;
57
+
58
+ /**
59
+ * Read console variable as boolean.
60
+ *
61
+ * @remarks
62
+ * Returns `false` when the command is missing or is not a boolean-compatible mask/integer command.
63
+ *
64
+ * @param key - Console variable name.
65
+ * @returns Boolean value.
66
+ */
67
+ public get_bool(key: string): boolean;
68
+
69
+ /**
70
+ * Read console variable as float.
71
+ *
72
+ * @remarks
73
+ * Returns `0` when the command is missing or is not a float command.
74
+ *
75
+ * @param key - Console variable name.
76
+ * @returns Float value.
77
+ */
78
+ public get_float(key: string): f32;
79
+
80
+ /**
81
+ * Read console variable as integer.
82
+ *
83
+ * @remarks
84
+ * Mask commands are returned as `0` or `1`. Missing or incompatible commands return `0`.
85
+ *
86
+ * @param key - Console variable name.
87
+ * @returns Integer value.
88
+ */
89
+ public get_integer(key: string): i32;
90
+
91
+ /**
92
+ * Read console variable as string.
93
+ *
94
+ * @remarks
95
+ * Returns `null` when the command does not exist.
96
+ *
97
+ * @param key - Console variable name.
98
+ * @returns String value.
99
+ */
100
+ public get_string(key: string): string | null;
101
+
102
+ /**
103
+ * Read console variable token text.
104
+ *
105
+ * @remarks
106
+ * Uses the same engine path as `get_string`, so missing commands return `null`.
107
+ *
108
+ * @param key - Console variable name.
109
+ * @returns Token text.
110
+ */
111
+ public get_token(key: string): string | null;
112
+ }
113
+
114
+ /**
115
+ * Log a message through the script log channel.
116
+ *
117
+ * @group xr_debug
118
+ *
119
+ * @remarks
120
+ * In non-master builds the message is sent to `CScriptEngine::script_log`.
121
+ *
122
+ * @param text - Message to print.
123
+ */
124
+ export function log(this: void, text: string): void;
125
+
126
+ /**
127
+ * Log an error message and print the current script stack.
128
+ *
129
+ * @group xr_debug
130
+ *
131
+ * @remarks
132
+ * The C++ binding asserts after logging the message.
133
+ *
134
+ * @param text - Error message.
135
+ */
136
+ export function error_log(this: void, text: string): void;
137
+
138
+ /**
139
+ * Print the current script stack to the log.
140
+ *
141
+ * @group xr_debug
142
+ */
143
+ export function print_stack(this: void): void;
144
+
145
+ /**
146
+ * Flush pending script log output in debug builds.
147
+ *
148
+ * @group xr_debug
149
+ */
150
+ export function flush(this: void): void;
151
+
152
+ /**
153
+ * Get console object reference.
154
+ *
155
+ * @group xr_debug
156
+ *
157
+ * @remarks
158
+ * Returns the global engine console pointer.
159
+ *
160
+ * @returns Console object reference.
161
+ */
162
+ export function get_console(this: void): CConsole;
163
+
164
+ /**
165
+ * Get process command-line parameters.
166
+ *
167
+ * @group xr_debug
168
+ *
169
+ * @returns Engine command-line string.
170
+ */
171
+ export function command_line(this: void): string;
172
+
173
+ /**
174
+ * Load and compile a script before continuing execution.
175
+ *
176
+ * @group xr_global_declaration
177
+ *
178
+ * @param path - Script file path.
179
+ */
180
+ export function prefetch(this: void, path: string): void;
181
+ }
@@ -1,40 +1,132 @@
1
- declare module "xray16" {
2
- /**
3
- * @source C++ class CPhraseScript
4
- * @customConstructor CPhraseScript
5
- * @group xr_dialog
6
- */
7
- export class CPhraseScript {
8
- public AddAction(value: string): void;
9
-
10
- public AddDisableInfo(value: string): void;
11
-
12
- public AddDontHasInfo(value: string): void;
13
-
14
- public AddGiveInfo(value: string): void;
15
-
16
- public AddHasInfo(value: string): void;
17
-
18
- public AddPrecondition(value: string): void;
19
-
20
- public SetScriptText(value: string): void;
21
- }
22
-
23
- /**
24
- * @source C++ class CPhrase
25
- * @customConstructor CPhrase
26
- * @group xr_dialog
27
- */
28
- export class CPhrase {
29
- public GetPhraseScript(): CPhraseScript;
30
- }
31
-
32
- /**
33
- * @source C++ class CPhraseDialog
34
- * @customConstructor CPhraseDialog
35
- * @group xr_dialog
36
- */
37
- export class CPhraseDialog {
38
- public AddPhrase(text: string, phrase_id: string, prev_phrase_id: string, goodwill_level: i32): CPhrase;
39
- }
40
- }
1
+ declare module "xray16" {
2
+ /**
3
+ * Script rules attached to a dialog phrase.
4
+ *
5
+ * @source C++ class CPhraseScript
6
+ * @customConstructor CPhraseScript
7
+ * @group xr_dialog
8
+ *
9
+ * @remarks
10
+ * Phrase scripts are evaluated by the dialog engine against the current actor/NPC speakers. Info portion checks use
11
+ * the actor info registry.
12
+ */
13
+ export class CPhraseScript {
14
+ /**
15
+ * Run a script action after the phrase is spoken.
16
+ *
17
+ * @remarks
18
+ * In active two-speaker dialogs the function receives `(speaker, listener, dialog_id, phrase_id)`. In simpler
19
+ * dialog checks it receives `(speaker, dialog_id)`.
20
+ *
21
+ * @throws If the function name cannot be resolved.
22
+ *
23
+ * @param function_name - Script function name.
24
+ */
25
+ public AddAction(function_name: string): void;
26
+
27
+ /**
28
+ * Disable an info portion when phrase actions run.
29
+ *
30
+ * @remarks
31
+ * Applied after the phrase is accepted and its actions run.
32
+ *
33
+ * @param info_portion - Info portion id.
34
+ */
35
+ public AddDisableInfo(info_portion: string): void;
36
+
37
+ /**
38
+ * Require an info portion to be absent before the phrase is available.
39
+ *
40
+ * @param info_portion - Info portion id.
41
+ */
42
+ public AddDontHasInfo(info_portion: string): void;
43
+
44
+ /**
45
+ * Give an info portion when phrase actions run.
46
+ *
47
+ * @remarks
48
+ * Applied after the phrase is accepted and its actions run.
49
+ *
50
+ * @param info_portion - Info portion id.
51
+ */
52
+ public AddGiveInfo(info_portion: string): void;
53
+
54
+ /**
55
+ * Require an info portion before the phrase is available.
56
+ *
57
+ * @param info_portion - Info portion id.
58
+ */
59
+ public AddHasInfo(info_portion: string): void;
60
+
61
+ /**
62
+ * Add a script predicate checked before the phrase is available.
63
+ *
64
+ * @remarks
65
+ * In active two-speaker dialogs the function receives `(speaker, listener, dialog_id, phrase_id, next_phrase_id)`.
66
+ * It should return `true` when the phrase may be shown.
67
+ *
68
+ * @throws If the function name cannot be resolved.
69
+ *
70
+ * @param function_name - Script function name.
71
+ */
72
+ public AddPrecondition(function_name: string): void;
73
+
74
+ /**
75
+ * Use a script function to provide phrase text.
76
+ *
77
+ * @remarks
78
+ * The function is called when the dialog asks for phrase text. Use it for text that depends on the current speaker
79
+ * or dialog state.
80
+ *
81
+ * @throws If the function name cannot be resolved.
82
+ *
83
+ * @param function_name - Script function name.
84
+ */
85
+ public SetScriptText(function_name: string): void;
86
+ }
87
+
88
+ /**
89
+ * Runtime phrase in a phrase dialog.
90
+ *
91
+ * @source C++ class CPhrase
92
+ * @customConstructor CPhrase
93
+ * @group xr_dialog
94
+ *
95
+ * @remarks
96
+ * Phrase instances are owned by the dialog graph. Script code usually configures them immediately after
97
+ * `CPhraseDialog.AddPhrase`.
98
+ */
99
+ export class CPhrase {
100
+ /**
101
+ * @returns Script helper used to configure phrase conditions and actions.
102
+ */
103
+ public GetPhraseScript(): CPhraseScript;
104
+ }
105
+
106
+ /**
107
+ * Phrase dialog built or extended from scripts.
108
+ *
109
+ * @source C++ class CPhraseDialog
110
+ * @customConstructor CPhraseDialog
111
+ * @group xr_dialog
112
+ *
113
+ * @remarks
114
+ * A phrase dialog is a directed phrase graph. Phrase id `"0"` is the start phrase used by loaded XML dialogs.
115
+ */
116
+ export class CPhraseDialog {
117
+ /**
118
+ * Add a phrase to the dialog tree.
119
+ *
120
+ * @remarks
121
+ * `prev_phrase_id` creates the edge from the previous phrase to the new one. Pass an empty string for a root phrase.
122
+ * Reusing an existing `phrase_id` returns the existing phrase and still links it from `prev_phrase_id`.
123
+ *
124
+ * @param text - Text or string table id.
125
+ * @param phrase_id - New phrase id.
126
+ * @param prev_phrase_id - Parent phrase id, or an empty string.
127
+ * @param goodwill_level - Goodwill value used when the engine orders available replies.
128
+ * @returns Created phrase.
129
+ */
130
+ public AddPhrase(text: string, phrase_id: string, prev_phrase_id: string, goodwill_level: i32): CPhrase;
131
+ }
132
+ }