xray16 1.0.5 → 1.0.8

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 (65) hide show
  1. package/README.md +4 -1
  2. package/package.json +4 -3
  3. package/types/index.d.ts +46 -22
  4. package/types/{xr_object → xr_ai}/xr_action.d.ts +163 -135
  5. package/types/xr_ai/xr_alife.d.ts +552 -0
  6. package/types/xr_ai/xr_enemy_evaluation.d.ts +41 -0
  7. package/types/xr_ai/xr_goap.d.ts +668 -0
  8. package/types/xr_ai/xr_graph.d.ts +47 -0
  9. package/types/xr_ai/xr_memory.d.ts +148 -0
  10. package/types/xr_lib/xr_animation.d.ts +81 -0
  11. package/types/xr_lib/xr_bitwise.d.ts +21 -0
  12. package/types/xr_lib/xr_color.d.ts +40 -0
  13. package/types/xr_lib/xr_debug.d.ts +100 -0
  14. package/types/{xr_object → xr_lib}/xr_dialog.d.ts +7 -1
  15. package/types/xr_lib/xr_flags.d.ts +148 -0
  16. package/types/xr_lib/xr_fs.d.ts +37 -229
  17. package/types/xr_lib/xr_game.d.ts +159 -0
  18. package/types/xr_lib/xr_hit.d.ts +41 -0
  19. package/types/xr_lib/xr_ini.d.ts +176 -0
  20. package/types/xr_lib/xr_level.d.ts +225 -0
  21. package/types/xr_lib/xr_luabind.d.ts +59 -0
  22. package/types/{xr_map → xr_lib}/xr_map.d.ts +19 -0
  23. package/types/xr_lib/xr_math.d.ts +65 -0
  24. package/types/{xr_online → xr_lib}/xr_multiplayer.d.ts +52 -0
  25. package/types/xr_lib/xr_properties.d.ts +166 -0
  26. package/types/xr_lib/xr_relation.d.ts +84 -0
  27. package/types/xr_lib/xr_render.d.ts +70 -0
  28. package/types/xr_lib/xr_save.d.ts +223 -0
  29. package/types/{xr_sound → xr_lib}/xr_sound.d.ts +10 -12
  30. package/types/xr_lib/xr_stats.ts +20 -0
  31. package/types/{xr_object/xr_quest.d.ts → xr_lib/xr_task.d.ts} +54 -2
  32. package/types/xr_lib/xr_time.d.ts +61 -0
  33. package/types/{xr_type → xr_lib}/xr_type.d.ts +13 -13
  34. package/types/xr_object/client/xr_client_object.d.ts +76 -0
  35. package/types/xr_object/{xr_level.d.ts → client/xr_level.d.ts} +69 -0
  36. package/types/xr_object/{xr_physic.d.ts → client/xr_physic.d.ts} +58 -0
  37. package/types/xr_object/client/xr_zone.d.ts +40 -0
  38. package/types/xr_object/script/xr_script_interface.d.ts +429 -0
  39. package/types/xr_object/{xr_client_object.d.ts → script/xr_script_object.d.ts} +449 -522
  40. package/types/xr_object/script/xr_script_trade.d.ts +26 -0
  41. package/types/xr_object/{xr_server_object.d.ts → server/xr_server_object.d.ts} +152 -73
  42. package/types/xr_ui/xr_ui_asset.d.ts +123 -0
  43. package/types/xr_ui/xr_ui_core.d.ts +33 -123
  44. package/types/xr_ui/xr_ui_event.d.ts +382 -0
  45. package/types/xr_ui/xr_ui_interface.d.ts +213 -0
  46. package/types/xr_ui/xr_ui_menu.d.ts +142 -0
  47. package/types/xr_constant.d.ts +0 -976
  48. package/types/xr_core.d.ts +0 -347
  49. package/types/xr_global.d.ts +0 -648
  50. package/types/xr_lib/xr_utils.d.ts +0 -407
  51. package/types/xr_luabind.d.ts +0 -34
  52. package/types/xr_object/xr_alife.d.ts +0 -206
  53. package/types/xr_type/xr_enums.d.ts +0 -17
  54. package/types/xr_ui/README.md +0 -277
  55. package/types/xr_ui/demo/CServerList.png +0 -0
  56. package/types/xr_ui/demo/CUI3tButton.png +0 -0
  57. package/types/xr_ui/demo/CUICheckButton.png +0 -0
  58. package/types/xr_ui/demo/CUIComboBox.png +0 -0
  59. package/types/xr_ui/demo/CUICustomEdit.png +0 -0
  60. package/types/xr_ui/demo/CUIStatic.png +0 -0
  61. package/types/xr_ui/demo/CUITrackBar.png +0 -0
  62. /package/types/xr_object/{xr_anomaly.d.ts → client/xr_anomaly.d.ts} +0 -0
  63. /package/types/xr_object/{xr_artefact.d.ts → client/xr_artefact.d.ts} +0 -0
  64. /package/types/xr_object/{xr_creature.d.ts → client/xr_creature.d.ts} +0 -0
  65. /package/types/xr_object/{xr_item.d.ts → client/xr_item.d.ts} +0 -0
@@ -6,7 +6,9 @@ declare module "xray16" {
6
6
  */
7
7
  export class FS_file_list {
8
8
  public Free(): void;
9
+
9
10
  public GetAt(number: u32): FS_item;
11
+
10
12
  public Size(): u32;
11
13
  }
12
14
 
@@ -17,7 +19,9 @@ declare module "xray16" {
17
19
  */
18
20
  export class FS_file_list_ex {
19
21
  public Sort(number: u32): void;
22
+
20
23
  public GetAt(index: u32): FS_item;
24
+
21
25
  public Size(): u32;
22
26
  }
23
27
 
@@ -28,24 +32,14 @@ declare module "xray16" {
28
32
  */
29
33
  export class FS_item {
30
34
  public Modif(): string;
35
+
31
36
  public NameFull(): string;
37
+
32
38
  public NameShort(): string;
33
- public ModifDigitOnly(): string;
34
- public Size(): u32;
35
- }
36
39
 
37
- /**
38
- * @source C++ class CSavedGameWrapper
39
- * @customConstructor CSavedGameWrapper
40
- * @group xr_fs
41
- */
42
- export class CSavedGameWrapper extends EngineBinding {
43
- public constructor(name: string);
40
+ public ModifDigitOnly(): string;
44
41
 
45
- public level_name(): string;
46
- public level_id(): u8;
47
- public game_time(): CTime;
48
- public actor_health(): f32;
42
+ public Size(): u32;
49
43
  }
50
44
 
51
45
  /**
@@ -79,34 +73,58 @@ declare module "xray16" {
79
73
  public static FS_sort_by_size_up: 2;
80
74
 
81
75
  public append_path(a: string, b: string, c: string, d: number): unknown /* FS_Path */;
76
+
82
77
  public dir_delete(fs: FS, a: string, b: string, c: number): void;
78
+
83
79
  public dir_delete(fs: FS, a: string, c: number): void;
80
+
84
81
  public exist(folderAlias: string, filename: string, fs_type: TXR_fs_type): i32 | null;
82
+
85
83
  public exist(folderAlias: string, filename: string): i32 | null;
84
+
86
85
  public exist(path: string): i32 | null;
86
+
87
87
  public file_copy(a: string, b: string): void;
88
+
88
89
  public file_length(a: string): i32;
90
+
89
91
  public file_list_open(a: string, b: string, c: u32): FS_file_list;
92
+
90
93
  public file_list_open(a: string, b: u32): FS_file_list;
94
+
91
95
  public file_list_open_ex(a: string, b: u32, c: string): FS_file_list_ex;
96
+
92
97
  public file_rename(a: string, b: string, c: boolean): void;
98
+
93
99
  public get_file_age(a: string): u32;
100
+
94
101
  public get_file_age_str(fs: FS, a: string): u32;
102
+
95
103
  public path_exist(a: string): boolean;
104
+
96
105
  public r_close(reader: reader): void;
106
+
97
107
  public r_open(a: string): reader;
108
+
98
109
  public r_open(a: string, b: string): reader;
110
+
99
111
  public update_path(alias: string, addition: string): string;
112
+
100
113
  public w_close(writer: unknown /* IWriter */): void;
114
+
101
115
  public rescan_path(path: string): void;
102
116
 
103
117
  /**
104
118
  * Not registered in LUA, will throw.
105
119
  */
106
120
  public get_path(alias: string): unknown;
121
+
107
122
  public file_delete(a: string, b: string): void;
123
+
108
124
  public file_delete(fs: string): void;
125
+
109
126
  public w_open(a: string, b: string): unknown /* IWriter */;
127
+
110
128
  public w_open(a: string): unknown /* IWriter */;
111
129
  }
112
130
 
@@ -116,225 +134,15 @@ declare module "xray16" {
116
134
  export type TXR_fs_type = EnumeratedStaticsValues<typeof FS>;
117
135
 
118
136
  /**
119
- * @source C++ class ini_file
120
- * @customConstructor ini_file
121
- * @group xr_fs
122
- */
123
- export class ini_file {
124
- public constructor();
125
- /**
126
- * Create ini file representation based on file name.
127
- * Full path is limited to 520 chars.
128
- *
129
- * @param path - file name and relative path to gamedata configs folder
130
- */
131
- public constructor(path: string);
132
- /**
133
- * Create ini file representation based on file name.
134
- * Full path is limited to 520 chars.
135
- *
136
- * @param initial - base to count relative path from, `$game_data$` is an example
137
- * @param path - file name and relative path from initial entrypoint
138
- */
139
- public constructor(initial: string, path: string);
140
-
141
- /**
142
- * @param section - target section to check lines count
143
- * @returns count of lines for provided section
144
- */
145
- public line_count(section: string): u32;
146
-
147
- /**
148
- * @returns sections count for ini file
149
- */
150
- public section_count(): u32;
151
-
152
- /**
153
- * Remove ini file section field.
154
- *
155
- * @param section - target section to modify
156
- * @param field - target section field to remove
157
- */
158
- public remove_line(section: string, field: string): void;
159
-
160
- public r_bool(section: string, field: string): boolean;
161
- public section_exist(section: string | null): boolean;
162
- public r_float(section: string, field: string): f32;
163
- public r_clsid(section: string, field: string): i32;
164
- public r_s32(section: string, field: string): i32;
165
-
166
- /**
167
- * Read text line from ini config file.
168
- *
169
- * @returns tuple with three elements, where first is success status, second is key, third is value.
170
- */
171
- public r_line<T extends string = string, P extends string = string>(
172
- section: string,
173
- line_number: i32,
174
- c: string,
175
- d: string
176
- ): LuaMultiReturn<[boolean, T, P]>;
177
- public r_token(section: string, field: string, list: token_list): i32;
178
- public r_vector(section: string, field: string): vector;
179
- public r_u32(section: string, field: string): u32;
180
- public r_string_wq(section: string, field: string): string;
181
- public r_string(section: string, field: string): string;
182
-
183
- /**
184
- * @param section - target section to check
185
- * @param field - section field to check
186
- * @returns whether line exists
187
- */
188
- public line_exist(section: string | null, field: string): boolean;
189
-
190
- public w_fvector2(section: string, field: string, vector: vector2, comment?: string): void;
191
- public w_fvector3(section: string, field: string, vector: vector, comment?: string): void;
192
- public w_fvector4(section: string, field: string, vector: never, comment?: string): void; // struct _vector4<float>
193
- public w_fcolor(section: string, field: string, color: fcolor, comment?: string): void;
194
- public w_color(section: string, field: string, color: u32, comment?: string): void;
195
-
196
- public w_bool(section: string, field: string, bool: boolean, comment?: string): void;
197
- public w_s8(section: string, field: string, uchar: u8, comment?: string): void;
198
- public w_u8(section: string, field: string, uchar: u8, comment?: string): void;
199
- public w_s16(section: string, field: string, sshort: i16, comment?: string): void;
200
- public w_u16(section: string, field: string, ushort: u16, comment?: string): void;
201
- public w_s32(section: string, field: string, sint: i32, comment?: string): void;
202
- public w_u32(section: string, field: string, uint: u32, comment?: string): void;
203
- public w_s64(section: string, field: string, sint: i64, comment?: string): void;
204
- public w_u64(section: string, field: string, uint: u64, comment?: string): void;
205
- public w_float(section: string, field: string, float: f32, comment?: string): void;
206
- public w_string(section: string, field: string, string: string, comment?: string): void;
207
-
208
- /**
209
- * Get file name of ini file.
210
- */
211
- public fname(): string;
212
- public set_readonly(is_readonly: boolean): void;
213
- public set_override_names(override: boolean): void;
214
- public save_as(path: string): boolean;
215
-
216
- /**
217
- * Adjust saving on file closing/destructor calls.
218
- *
219
- * @param should_save - whether ini file should be saved when destructor is called
220
- */
221
- public save_at_end(should_save: boolean): void;
222
-
223
- /**
224
- * Iterate over ini file sections.
225
- * Calls provided callback for each ini section in file.
226
- *
227
- * @param cb - callback to call on each ini file section, where name is section name
228
- */
229
- public section_for_each(cb: (this: void, name: string) => void): void;
230
- }
231
-
232
- /**
233
- * @source C++ class net_packet
234
- * @customConstructor net_packet
235
137
  * @group xr_fs
236
138
  */
237
- export class net_packet {
238
- public r_advance(value: u32): void;
239
- public r_angle16(value: f32): void;
240
- public r_angle8(value: f32): void;
241
- public r_begin(value: u16): u32;
242
- public r_bool(): boolean;
243
- public r_clientID(): ClientID;
244
- public r_dir(vector: vector): void;
245
- public r_elapsed(): u32;
246
- public r_eof(): boolean;
247
- public r_float(): f32;
248
- public r_float(value: f32): f32;
249
- public r_float_q16(value1: f32, value2: f32, value3: f32): f32;
250
- public r_float_q8(value1: f32, value2: f32, value3: f32): f32;
251
- public r_matrix(matrix: matrix): matrix;
252
- public r_s16(): i16;
253
- public r_s16(value: u16): u16;
254
- public r_s32(): i32;
255
- public r_s32(value: i32): i32;
256
- public r_s64(): i64;
257
- public r_s64(value: i64): i64;
258
- public r_s8(): i8;
259
- public r_s8(value: i8): i8;
260
- public r_sdir(vector: vector): void;
261
- public r_seek(value: u32): void;
262
- public r_stringZ<T extends string>(): T;
263
- public r_tell(): u32;
264
- public r_u16(): u16;
265
- public r_u16(value: u16): u16;
266
- public r_u32(): u32;
267
- public r_u32(value: u32): u32;
268
- public r_u64(): u64;
269
- public r_u64(value: u64): u64;
270
- public r_u8(): u8;
271
- public r_u8(value: u8): u8;
272
- public r_vec3(vector: vector): void;
273
- public w_angle16(value: f32): void;
274
- public w_angle8(value: f32): void;
275
- public w_begin(value: u16): void;
276
- public w_bool(value: boolean): void;
277
- public w_chunk_close16(value: u32): void;
278
- public w_chunk_close8(value: u32): void;
279
- public w_chunk_open16(value: u32): void;
280
- public w_chunk_open8(value: u32): void;
281
- public w_clientID(ClientID: ClientID): void;
282
- public w_dir(vector: vector): void;
283
- public w_float(value: f32): void;
284
- public w_float_q16(value1: f32, value2: f32, value3: f32): void;
285
- public w_float_q8(value1: f32, value2: f32, value3: f32): void;
286
- public w_matrix(matrix: matrix): void;
287
- public w_s16(value: i16): void;
288
- public w_s32(value: i32): void;
289
- public w_s64(value: i64): void;
290
- public w_sdir(vector: vector): void;
291
- public w_stringZ(value: string | null): void;
292
- public w_tell(): u32;
293
- public w_u16(value: u16): void;
294
- public w_u32(value: u32): void;
295
- public w_u64(value: u64): void;
296
- public w_u8(value: u8): void;
297
- public w_vec3(vector: vector): void;
298
- }
299
-
300
- /**
301
- * @source C++ class reader
302
- * @customConstructor reader
303
- * @group xr_fs
304
- */
305
- export class reader {
306
- public r_advance(value: u64): void;
307
- public r_elapsed(): i64;
308
- public r_eof(): boolean;
309
- public r_sdir(vector: vector): void;
310
- public r_seek(value: u64): void;
311
- public r_tell(): u64;
312
-
313
- public r_dir(vector: vector): void;
314
- public r_vec3(vector: vector): void;
315
- public r_angle16(): f32;
316
- public r_angle8(): f32;
317
-
318
- public r_bool(): boolean;
319
- public r_stringZ<T extends string>(): T;
320
-
321
- public r_float<T extends f32>(value?: T): T;
322
- public r_float_q16<T extends f32>(value1: T, value2: T): T;
323
- public r_float_q8<T extends f32>(value1: T, value2: T): T;
324
-
325
- public r_s16<T extends i16 = i16>(value?: T): T;
326
- public r_s32<T extends i32 = i32>(value?: T): T;
327
- public r_s64<T extends i64 = i64>(value?: T): T;
328
- public r_s8<T extends i8 = i8>(value?: T): T;
329
-
330
- public r_u16<T extends u16 = u16>(value?: T): T;
331
- public r_u32<T extends u32 = u32>(value?: T): T;
332
- public r_u64<T extends u64 = u64>(value?: T): T;
333
- public r_u8<T extends u8 = u8>(value?: T): T;
334
- }
139
+ export function getFS(this: void): FS;
335
140
 
336
141
  /**
142
+ * Get operating system active username.
143
+ *
337
144
  * @group xr_fs
145
+ * @returns username string
338
146
  */
339
- export type TXR_net_processor = reader | net_packet;
147
+ export function user_name(this: void): string;
340
148
  }
@@ -0,0 +1,159 @@
1
+ declare module "xray16" {
2
+
3
+ /**
4
+ * Enumeration with possible game types:
5
+ * - eGameIDNoGame = u32(0),
6
+ * - eGameIDSingle = u32(1) << 0,
7
+ * - eGameIDDeathmatch = u32(1) << 1,
8
+ * - eGameIDTeamDeathmatch = u32(1) << 2,
9
+ * - eGameIDArtefactHunt = u32(1) << 3,
10
+ * - eGameIDCaptureTheArtefact = u32(1) << 4,
11
+ * - eGameIDDominationZone = u32(1) << 5,
12
+ * - eGameIDTeamDominationZone = u32(1) << 6,
13
+ *
14
+ * @source C++ enum EGameIDs
15
+ * @group xr_game
16
+ */
17
+ export type TXR_EGameID = 0 | 1 | 2 | 8 | 16 | 32 | 64;
18
+
19
+ /**
20
+ * @source C++ class GAME_TYPE
21
+ * @customConstructor GAME_TYPE
22
+ * @group xr_game
23
+ */
24
+ export class GAME_TYPE {
25
+ public static readonly eGameIDArtefactHunt: 8;
26
+ public static readonly eGameIDCaptureTheArtefact: 16;
27
+ public static readonly eGameIDDeathmatch: 2;
28
+ public static readonly eGameIDTeamDeathmatch: 4;
29
+
30
+ public static readonly GAME_UNKNOWN: -1;
31
+ public static readonly GAME_ANY: 0;
32
+ public static readonly GAME_SINGLE: 1;
33
+ public static readonly GAME_DEATHMATCH: 2;
34
+ // GAME_CTF = 3,
35
+ // GAME_ASSAULT = 4, // Team1 - assaulting, Team0 - Defending
36
+ public static readonly GAME_CS: 5;
37
+ public static readonly GAME_TEAMDEATHMATCH: 6;
38
+ public static readonly GAME_ARTEFACTHUNT: 7;
39
+ public static readonly GAME_CAPTURETHEARTEFACT: 8;
40
+ // identifiers in range [100...254] are registered for script game type
41
+ public static readonly GAME_DUMMY: 255; // temporary g
42
+ }
43
+
44
+ /**
45
+ * @group xr_game
46
+ */
47
+ type TXR_GAME_TYPE = EnumeratedStaticsValues<typeof GAME_TYPE>;
48
+
49
+ /**
50
+ * @source C++ class game_difficulty
51
+ * @customConstructor game_difficulty
52
+ * @group xr_game
53
+ */
54
+ export class game_difficulty {
55
+ public static readonly novice: 0;
56
+ public static readonly stalker: 1;
57
+ public static readonly veteran: 2;
58
+ public static readonly master: 3;
59
+ }
60
+
61
+ /**
62
+ * @group xr_game
63
+ */
64
+ export type TXR_game_difficulty_name = EnumeratedStaticsKeys<typeof game_difficulty>;
65
+
66
+ /**
67
+ * @group xr_game
68
+ */
69
+ export type TXR_game_difficulty = EnumeratedStaticsValues<typeof game_difficulty>;
70
+
71
+ /**
72
+ * @source namespace game
73
+ * @group xr_game
74
+ */
75
+ export interface IXR_game {
76
+ CTime: (this: void) => CTime;
77
+
78
+ translate_string(this: void, translation_key: string): string;
79
+
80
+ time(this: void): u32;
81
+
82
+ reload_language(this: void): void;
83
+
84
+ get_game_time(this: void): CTime;
85
+
86
+ log_stack_trace(this: void): void;
87
+
88
+ jump_to_level(this: void, level_name: string): void;
89
+
90
+ jump_to_level(this: void, position: vector, lvi: u32, gvi: u16): void;
91
+
92
+ jump_to_level(this: void, position: vector, lvi: u32, gvi: u16, direction: vector): void;
93
+
94
+ start_tutorial(this: void, tutorial_id: string): void;
95
+
96
+ has_active_tutorial(this: void): boolean;
97
+
98
+ active_tutorial_name(this: void): string;
99
+
100
+ stop_tutorial(this: void): void;
101
+ }
102
+
103
+ /**
104
+ * @group xr_game
105
+ */
106
+ export const game: IXR_game;
107
+
108
+ /**
109
+ * Check whether dynamic music setting is enabled.
110
+ * Dynamic music starts playing different kind of ambient sounds in actor combat.
111
+ *
112
+ * @group xr_game
113
+ * @returns is dynamic music allowed in game settings.
114
+ */
115
+ export function IsDynamicMusic(this: void): boolean;
116
+
117
+ /**
118
+ * Whether auto-save on important checkpoints option is turned on.
119
+ *
120
+ * @group xr_game
121
+ */
122
+ export function IsImportantSave(this: void): boolean;
123
+
124
+ /**
125
+ * @group xr_game
126
+ */
127
+ export function IsGameTypeSingle(this: void): boolean;
128
+
129
+ /**
130
+ * @group xr_game
131
+ * @returns is dev editor tool enabled currently used.
132
+ */
133
+ export function editor(this: void): boolean;
134
+
135
+ /**
136
+ * @group xr_game
137
+ */
138
+ export function set_start_position(position: vector): void;
139
+
140
+ /**
141
+ * @group xr_game
142
+ */
143
+ export function set_start_game_vertex_id(gvid: i32): void;
144
+
145
+ /**
146
+ * @group xr_game
147
+ */
148
+ export function is_enough_address_space_available(this: void): boolean;
149
+
150
+ /**
151
+ * @group xr_game
152
+ */
153
+ export function verify_if_thread_is_running(this: void): void;
154
+
155
+ /**
156
+ * @group xr_game
157
+ */
158
+ export function script_server_object_version(this: void): u16;
159
+ }
@@ -0,0 +1,41 @@
1
+ declare module "xray16" {
2
+ /**
3
+ * @source C++ class hit
4
+ * @customConstructor hit
5
+ * @group xr_hit
6
+ */
7
+ export class hit {
8
+ public static readonly burn = 0;
9
+ public static readonly chemical_burn = 2;
10
+ public static readonly dummy = 12;
11
+ public static readonly explosion = 7;
12
+ public static readonly fire_wound = 8;
13
+ public static readonly light_burn = 11;
14
+ public static readonly radiation = 3;
15
+ public static readonly shock = 1;
16
+ public static readonly strike = 5;
17
+ public static readonly telepatic = 4;
18
+ public static readonly wound = 6;
19
+
20
+ public direction: vector;
21
+ public draftsman: game_object | null;
22
+ public impulse: f32;
23
+ public power: f32;
24
+ public type: TXR_hit_type;
25
+
26
+ public constructor();
27
+ public constructor(hit: hit);
28
+
29
+ public bone(bone: string): void;
30
+ }
31
+
32
+ /**
33
+ * @group xr_hit
34
+ */
35
+ export type TXR_hit_types = typeof hit;
36
+
37
+ /**
38
+ * @group xr_hit
39
+ */
40
+ export type TXR_hit_type = EnumeratedStaticsValues<TXR_hit_types>;
41
+ }
@@ -0,0 +1,176 @@
1
+ declare module "xray16" {
2
+ /**
3
+ * Implementation of streaming ini file container.
4
+ * Allows reading / writing field in file by section/field.
5
+ *
6
+ * Supports custom extension with section overriding and custom `#include` statements.
7
+ *
8
+ * @source C++ class ini_file
9
+ * @customConstructor ini_file
10
+ * @group xr_ini
11
+ */
12
+ export class ini_file {
13
+ public constructor();
14
+ /**
15
+ * Create ini file representation based on file name.
16
+ * Full path is limited to 520 chars.
17
+ *
18
+ * @param path - file name and relative path to gamedata configs folder
19
+ */
20
+ public constructor(path: string);
21
+ /**
22
+ * Create ini file representation based on file name.
23
+ * Full path is limited to 520 chars.
24
+ *
25
+ * @param initial - base to count relative path from, `$game_data$` is an example
26
+ * @param path - file name and relative path from initial entrypoint
27
+ */
28
+ public constructor(initial: string, path: string);
29
+
30
+ /**
31
+ * @param section - target section to check lines count
32
+ * @returns count of lines for provided section
33
+ */
34
+ public line_count(section: string): u32;
35
+
36
+ /**
37
+ * @returns sections count for ini file
38
+ */
39
+ public section_count(): u32;
40
+
41
+ /**
42
+ * Remove ini file section field.
43
+ *
44
+ * @param section - target section to modify
45
+ * @param field - target section field to remove
46
+ */
47
+ public remove_line(section: string, field: string): void;
48
+
49
+ public r_bool(section: string, field: string): boolean;
50
+
51
+ public section_exist(section: string | null): boolean;
52
+
53
+ public r_float(section: string, field: string): f32;
54
+
55
+ public r_clsid(section: string, field: string): i32;
56
+
57
+ public r_s32(section: string, field: string): i32;
58
+
59
+ /**
60
+ * Read text line from ini config file.
61
+ *
62
+ * @returns tuple with three elements, where first is success status, second is key, third is value.
63
+ */
64
+ public r_line<T extends string = string, P extends string = string>(
65
+ section: string,
66
+ line_number: i32,
67
+ c: string,
68
+ d: string
69
+ ): LuaMultiReturn<[boolean, T, P]>;
70
+
71
+ public r_token(section: string, field: string, list: token_list): i32;
72
+
73
+ public r_vector(section: string, field: string): vector;
74
+
75
+ public r_u32(section: string, field: string): u32;
76
+
77
+ public r_string_wq(section: string, field: string): string;
78
+
79
+ public r_string(section: string, field: string): string;
80
+
81
+ /**
82
+ * Check if line exists in the file by section and field.
83
+ *
84
+ * @param section - target section to check
85
+ * @param field - section field to check
86
+ * @returns whether line exists
87
+ */
88
+ public line_exist(section: string | null, field: string): boolean;
89
+
90
+ public w_fvector2(section: string, field: string, vector: vector2, comment?: string): void;
91
+
92
+ public w_fvector3(section: string, field: string, vector: vector, comment?: string): void;
93
+
94
+ public w_fvector4(section: string, field: string, vector: never, comment?: string): void; // struct _vector4<float>
95
+
96
+ public w_fcolor(section: string, field: string, color: fcolor, comment?: string): void;
97
+
98
+ public w_color(section: string, field: string, color: u32, comment?: string): void;
99
+
100
+ public w_bool(section: string, field: string, bool: boolean, comment?: string): void;
101
+
102
+ public w_s8(section: string, field: string, uchar: u8, comment?: string): void;
103
+
104
+ public w_u8(section: string, field: string, uchar: u8, comment?: string): void;
105
+
106
+ public w_s16(section: string, field: string, sshort: i16, comment?: string): void;
107
+
108
+ public w_u16(section: string, field: string, ushort: u16, comment?: string): void;
109
+
110
+ public w_s32(section: string, field: string, sint: i32, comment?: string): void;
111
+
112
+ public w_u32(section: string, field: string, uint: u32, comment?: string): void;
113
+
114
+ public w_s64(section: string, field: string, sint: i64, comment?: string): void;
115
+
116
+ public w_u64(section: string, field: string, uint: u64, comment?: string): void;
117
+
118
+ public w_float(section: string, field: string, float: f32, comment?: string): void;
119
+
120
+ public w_string(section: string, field: string, string: string, comment?: string): void;
121
+
122
+ /**
123
+ * Get file name and path of ini file.
124
+ *
125
+ * @example `f:\applications\steam\steamapps\common\stalker call of pripyat\gamedata\configs\misc\task_manager.ltx`
126
+ *
127
+ * @returns full path to ini file
128
+ */
129
+ public fname(): string;
130
+
131
+ public set_readonly(is_readonly: boolean): void;
132
+
133
+ public set_override_names(override: boolean): void;
134
+
135
+ public save_as(path: string): boolean;
136
+
137
+ /**
138
+ * Adjust saving on file closing/destructor calls.
139
+ *
140
+ * @param should_save - whether ini file should be saved when destructor is called
141
+ */
142
+ public save_at_end(should_save: boolean): void;
143
+
144
+ /**
145
+ * Iterate over ini file sections.
146
+ * Calls provided callback for each ini section in file.
147
+ *
148
+ * @param cb - callback to call on each ini file section, where name is section name
149
+ */
150
+ public section_for_each(cb: (this: void, name: string) => void): void;
151
+ }
152
+
153
+ /**
154
+ * Create ini file instance based on provided string content.
155
+ *
156
+ * @group xr_ini
157
+ * @param content - string value to be read as ini file
158
+ * @returns new ini file instance based on provided content
159
+ */
160
+ export function create_ini_file(this: void, content: string): ini_file;
161
+
162
+ /**
163
+ * @group xr_ini
164
+ */
165
+ export function game_ini(this: void): ini_file;
166
+
167
+ /**
168
+ * @group xr_ini
169
+ */
170
+ export function system_ini(this: void): ini_file;
171
+
172
+ /**
173
+ * @group xr_ini
174
+ */
175
+ export function reload_system_ini(this: void): ini_file;
176
+ }