xray16 1.0.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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -0
  3. package/package.json +38 -0
  4. package/plugins/built_at_info.ts +18 -0
  5. package/plugins/from_cast_utils.ts +34 -0
  6. package/plugins/global_declarations_transform.ts +24 -0
  7. package/plugins/inject_filename.ts +22 -0
  8. package/plugins/strip_lua_logger.ts +73 -0
  9. package/plugins/transform_luabind_class/plugin.ts +51 -0
  10. package/plugins/transform_luabind_class/transformation/class_declaration.ts +226 -0
  11. package/plugins/transform_luabind_class/transformation/constants.ts +4 -0
  12. package/plugins/transform_luabind_class/transformation/decorators.ts +16 -0
  13. package/plugins/transform_luabind_class/transformation/errors.ts +31 -0
  14. package/plugins/transform_luabind_class/transformation/index.ts +5 -0
  15. package/plugins/transform_luabind_class/transformation/members/accessors.ts +48 -0
  16. package/plugins/transform_luabind_class/transformation/members/constructor.ts +107 -0
  17. package/plugins/transform_luabind_class/transformation/members/fields.ts +53 -0
  18. package/plugins/transform_luabind_class/transformation/members/method.ts +70 -0
  19. package/plugins/transform_luabind_class/transformation/new.ts +14 -0
  20. package/plugins/transform_luabind_class/transformation/setup.ts +128 -0
  21. package/plugins/transform_luabind_class/transformation/super.ts +92 -0
  22. package/plugins/transform_luabind_class/transformation/utils.ts +90 -0
  23. package/plugins/utils/diagnostics.ts +24 -0
  24. package/src/index.d.ts +63 -0
  25. package/src/xr_constant.d.ts +976 -0
  26. package/src/xr_core.d.ts +347 -0
  27. package/src/xr_global.d.ts +613 -0
  28. package/src/xr_lib/xr_fs.d.ts +333 -0
  29. package/src/xr_lib/xr_math.d.ts +165 -0
  30. package/src/xr_lib/xr_utils.d.ts +407 -0
  31. package/src/xr_luabind.d.ts +34 -0
  32. package/src/xr_map/xr_map.d.ts +42 -0
  33. package/src/xr_object/xr_action.d.ts +482 -0
  34. package/src/xr_object/xr_alife.d.ts +206 -0
  35. package/src/xr_object/xr_anomaly.d.ts +50 -0
  36. package/src/xr_object/xr_artefact.d.ts +98 -0
  37. package/src/xr_object/xr_client_object.d.ts +1255 -0
  38. package/src/xr_object/xr_creature.d.ts +157 -0
  39. package/src/xr_object/xr_dialog.d.ts +34 -0
  40. package/src/xr_object/xr_item.d.ts +239 -0
  41. package/src/xr_object/xr_level.d.ts +166 -0
  42. package/src/xr_object/xr_physic.d.ts +119 -0
  43. package/src/xr_object/xr_quest.d.ts +47 -0
  44. package/src/xr_object/xr_server_object.d.ts +686 -0
  45. package/src/xr_online/xr_multiplayer.d.ts +299 -0
  46. package/src/xr_sound/xr_sound.d.ts +153 -0
  47. package/src/xr_type/xr_enums.d.ts +17 -0
  48. package/src/xr_type/xr_type.d.ts +70 -0
  49. package/src/xr_ui/README.md +277 -0
  50. package/src/xr_ui/demo/CServerList.png +0 -0
  51. package/src/xr_ui/demo/CUI3tButton.png +0 -0
  52. package/src/xr_ui/demo/CUICheckButton.png +0 -0
  53. package/src/xr_ui/demo/CUIComboBox.png +0 -0
  54. package/src/xr_ui/demo/CUICustomEdit.png +0 -0
  55. package/src/xr_ui/demo/CUIStatic.png +0 -0
  56. package/src/xr_ui/demo/CUITrackBar.png +0 -0
  57. package/src/xr_ui/xr_ui_core.d.ts +185 -0
  58. package/src/xr_ui/xr_ui_interface.d.ts +666 -0
@@ -0,0 +1,299 @@
1
+ declare module "xray16" {
2
+ /**
3
+ * @source C++ class demo_info
4
+ * @customConstructor demo_info
5
+ * @group xr_multiplayer
6
+ */
7
+ export class demo_info {
8
+ protected constructor();
9
+
10
+ public get_author_name(): string;
11
+ public get_game_score(): string;
12
+ public get_game_type(): string;
13
+ public get_map_name(): string;
14
+ public get_map_version(): string;
15
+ public get_player(value: u32): demo_player_info;
16
+ public get_players_count(): u32;
17
+ }
18
+
19
+ /**
20
+ * @source C++ class demo_player_info
21
+ * @customConstructor demo_player_info
22
+ * @group xr_multiplayer
23
+ */
24
+ export class demo_player_info {
25
+ public get_artefacts(): u16;
26
+ public get_deaths(): i16;
27
+ public get_frags(): i16;
28
+ public get_name(): string;
29
+ public get_rank(): u8;
30
+ public get_spots(): i16;
31
+ public get_team(): u8;
32
+ }
33
+
34
+ /**
35
+ * @source C++ class SServerFilters
36
+ * @customConstructor SServerFilters
37
+ * @group xr_multiplayer
38
+ */
39
+ export class SServerFilters {
40
+ public empty: boolean;
41
+ public full: boolean;
42
+ public listen_servers: boolean;
43
+ public with_pass: boolean;
44
+ public without_ff: boolean;
45
+ public without_pass: boolean;
46
+
47
+ public constructor();
48
+ }
49
+
50
+ /**
51
+ * @source C++ class profile
52
+ * @customConstructor XR_profile
53
+ * @group xr_multiplayer
54
+ */
55
+ export class profile {
56
+ public unique_nick(): string;
57
+ public online(): boolean;
58
+ }
59
+
60
+ /**
61
+ * @source C++ class account_manager
62
+ * @customConstructor account_manager
63
+ * @group xr_multiplayer
64
+ */
65
+ export class account_manager {
66
+ private constructor();
67
+
68
+ public create_profile(acc: string, nick: string, mail: string, password: string, cb: account_profiles_cb): void;
69
+ public delete_profile(operation: account_operation_cb): void;
70
+ public get_account_profiles(email: string, password: string, cb: account_profiles_cb): unknown;
71
+ public get_found_profiles(): LuaIterable<string>;
72
+ public get_suggested_unicks(): LuaIterable<string>;
73
+ public get_verify_error_descr(): string;
74
+ public search_for_email(email: string, cb: found_email_cb): void;
75
+ public stop_fetching_account_profiles(): void;
76
+ public stop_searching_email(): void;
77
+ public stop_suggest_unique_nicks(): void;
78
+ public suggest_unique_nicks(nick: string, b: suggest_nicks_cb): void;
79
+ public verify_email(email: string): boolean;
80
+ public verify_password(password: string): boolean;
81
+ public verify_unique_nick(nick: string): boolean;
82
+ public is_get_account_profiles_active(): boolean;
83
+ public is_email_searching_active(): boolean;
84
+ }
85
+
86
+ /**
87
+ * @source C++ class login_manager
88
+ * @customConstructor login_manager
89
+ * @group xr_multiplayer
90
+ */
91
+ export class login_manager {
92
+ private constructor();
93
+
94
+ public forgot_password(url: string): void;
95
+ public get_current_profile(): profile | null;
96
+ public get_email_from_registry(): string;
97
+ public get_nick_from_registry(): string;
98
+ public get_password_from_registry(): string;
99
+ public get_remember_me_from_registry(): boolean;
100
+ public login(mail: string, profile: string, password: string, cb: login_operation_cb): void;
101
+ public login_offline(nick: string, cb: login_operation_cb): void;
102
+ public logout(): void;
103
+ public save_email_to_registry(email: string): void;
104
+ public save_nick_to_registry(nick: string): void;
105
+ public save_password_to_registry(password: string): void;
106
+ public save_remember_me_to_registry(remember_me: boolean): void;
107
+ public set_unique_nick(nick: string, cb: login_operation_cb): void;
108
+ public stop_login(): void;
109
+ public stop_setting_unique_nick(): void;
110
+ }
111
+
112
+ /**
113
+ * @source C++ class award_pair_t
114
+ * @customConstructor award_pair_t
115
+ * @group xr_multiplayer
116
+ */
117
+ export class award_pair_t {
118
+ public readonly first: award_data;
119
+ public readonly second: award_data;
120
+ }
121
+
122
+ /**
123
+ * @source C++ class best_scores_pair_t
124
+ * @customConstructor best_scores_pair_t
125
+ * @group xr_multiplayer
126
+ */
127
+ export class best_scores_pair_t {
128
+ public first: award_data;
129
+ public second: award_data;
130
+ }
131
+
132
+ /**
133
+ * @source C++ class account_profiles_cb
134
+ * @customConstructor account_profiles_cb
135
+ * @group xr_multiplayer
136
+ */
137
+ export class account_profiles_cb {
138
+ public constructor(object: object, cb: (this: object, code: number, description: string) => void);
139
+
140
+ public bind(object: object, cb: (this: object, code: number, description: string) => void): void;
141
+ public clear(): void;
142
+ }
143
+
144
+ /**
145
+ * @source C++ class login_operation_cb
146
+ * @customConstructor login_operation_cb
147
+ * @group xr_multiplayer
148
+ */
149
+ export class login_operation_cb {
150
+ public constructor(object: object, cb: (this: object, profile: profile | null, description: string) => void);
151
+
152
+ public bind(object: object, cb: (this: object, profile: profile | null, description: string) => void): void;
153
+ public clear(): void;
154
+ }
155
+
156
+ /**
157
+ * @source C++ class connect_error_cb
158
+ * @customConstructor connect_error_cb
159
+ * @group xr_multiplayer
160
+ */
161
+ export class connect_error_cb {
162
+ public constructor(object: object, cb: (this: object, code: number, description: string) => void);
163
+
164
+ public bind(object: object, cb: (this: object, code: number, description: string) => void): void;
165
+ public clear(): void;
166
+ }
167
+
168
+ /**
169
+ * @source C++ class account_operation_cb
170
+ * @customConstructor account_operation_cb
171
+ * @group xr_multiplayer
172
+ */
173
+ export class account_operation_cb {
174
+ public constructor(object: object, cb: (this: object, code: number, description: string) => void);
175
+
176
+ public bind(object: object, cb: (this: object, code: number, description: string) => void): void;
177
+ public clear(): void;
178
+ }
179
+
180
+ /**
181
+ * @source C++ class found_email_cb
182
+ * @customConstructor found_email_cb
183
+ * @group xr_multiplayer
184
+ */
185
+ export class found_email_cb {
186
+ public constructor(object: object, cb: (this: object, found: boolean, description: string) => void);
187
+
188
+ public bind(object: object, cb: (this: object, found: boolean, description: string) => void): void;
189
+ public clear(): void;
190
+ }
191
+
192
+ /**
193
+ * @source C++ class store_operation_cb
194
+ * @customConstructor store_operation_cb
195
+ * @group xr_multiplayer
196
+ */
197
+ export class store_operation_cb {
198
+ public constructor(object: object, cb: (this: object, code: number | boolean, description: string) => void);
199
+
200
+ public bind(object: object, cb: (this: object, code: number, description: string) => void): void;
201
+ public clear(): void;
202
+ }
203
+
204
+ /**
205
+ * @source C++ class suggest_nicks_cb
206
+ * @customConstructor suggest_nicks_cb
207
+ * @group xr_multiplayer
208
+ */
209
+ export class suggest_nicks_cb {
210
+ public constructor(object: object, cb: (this: object, result: number, description: string) => void);
211
+
212
+ public bind(object: object, cb: (this: object, result: number, description: string) => void): void;
213
+ public clear(): void;
214
+ }
215
+
216
+ /**
217
+ * @source C++ class Patch_Dawnload_Progress
218
+ * @customConstructor Patch_Dawnload_Progress
219
+ * @group xr_multiplayer
220
+ */
221
+ export class Patch_Dawnload_Progress {
222
+ public GetProgress(): f32;
223
+ public GetInProgress(): boolean;
224
+ public GetStatus(): string;
225
+ public GetFlieName(): string;
226
+ }
227
+
228
+ /**
229
+ * @source C++ class profile_store
230
+ * @customConstructor profile_store
231
+ * @group xr_multiplayer
232
+ */
233
+ export class profile_store {
234
+ public static readonly at_award_massacre: 0;
235
+ public static readonly at_awards_count: 30;
236
+ public static readonly bst_backstabs_in_row: 2;
237
+ public static readonly bst_bleed_kills_in_row: 2;
238
+ public static readonly bst_explosive_kills_in_row: 3;
239
+ public static readonly bst_eye_kills_in_row: 4;
240
+ public static readonly bst_head_shots_in_row: 3;
241
+ public static readonly bst_kills_in_row: 0;
242
+ public static readonly bst_kinife_kills_in_row: 1;
243
+ public static readonly bst_score_types_count: 7;
244
+
245
+ protected constructor();
246
+
247
+ public get_awards(): LuaIterable<award_pair_t>;
248
+ public get_best_scores(): LuaIterable<best_scores_pair_t>;
249
+ public load_current_profile(onProgress: store_operation_cb, onComlete: store_operation_cb): void;
250
+ public stop_loading(): void;
251
+ }
252
+
253
+ /**
254
+ * @source C++ class award_data
255
+ * @customConstructor award_data
256
+ * @group xr_multiplayer
257
+ */
258
+ export class award_data {
259
+ public m_count: u16;
260
+ public m_last_reward_date: u32;
261
+ }
262
+
263
+ /**
264
+ * @source C++ class game_messages
265
+ * @customConstructor game_messages
266
+ * @group xr_multiplayer
267
+ */
268
+ export class game_messages {
269
+ public static GAME_EVENT_ARTEFACT_DESTROYED: 17;
270
+ public static GAME_EVENT_ARTEFACT_DROPPED: 19;
271
+ public static GAME_EVENT_ARTEFACT_ONBASE: 20;
272
+ public static GAME_EVENT_ARTEFACT_SPAWNED: 16;
273
+ public static GAME_EVENT_ARTEFACT_TAKEN: 18;
274
+ public static GAME_EVENT_BUY_MENU_CLOSED: 23;
275
+ public static GAME_EVENT_PLAYER_BUY_FINISHED: 2;
276
+ public static GAME_EVENT_PLAYER_CHANGE_SKIN: 6;
277
+ public static GAME_EVENT_PLAYER_CHANGE_TEAM: 6;
278
+ public static GAME_EVENT_PLAYER_CONNECTED: 8;
279
+ public static GAME_EVENT_PLAYER_DISCONNECTED: 9;
280
+ public static GAME_EVENT_PLAYER_ENTER_TEAM_BASE: 21;
281
+ public static GAME_EVENT_PLAYER_JOIN_TEAM: 13;
282
+ public static GAME_EVENT_PLAYER_KILL: 1;
283
+ public static GAME_EVENT_PLAYER_KILLED: 11;
284
+ public static GAME_EVENT_PLAYER_LEAVE_TEAM_BASE: 22;
285
+ public static GAME_EVENT_PLAYER_READY: 0;
286
+ public static GAME_EVENT_ROUND_END: 15;
287
+ public static GAME_EVENT_ROUND_STARTED: 14;
288
+ public static GAME_EVENT_SCRIPT_BEGINS_FROM: 46;
289
+ public static GAME_EVENT_SKIN_MENU_CLOSED: 25;
290
+ public static GAME_EVENT_TEAM_MENU_CLOSED: 24;
291
+
292
+ protected constructor();
293
+ }
294
+
295
+ /**
296
+ * @group xr_multiplayer
297
+ */
298
+ export type TXR_game_message = EnumeratedStaticsValues<game_messages>;
299
+ }
@@ -0,0 +1,153 @@
1
+ declare module "xray16" {
2
+ /**
3
+ * @source C++ class sound_params
4
+ * @customConstructor sound_params
5
+ * @group xr_sound
6
+ */
7
+ export class sound_params {
8
+ public frequency: f32;
9
+ public max_distance: f32;
10
+ public min_distance: f32;
11
+ public position: vector;
12
+ public volume: f32;
13
+
14
+ private constructor();
15
+ }
16
+
17
+ /**
18
+ * @source C++ class sound_object
19
+ * @customConstructor sound_object
20
+ * @group xr_sound
21
+ */
22
+ export class sound_object {
23
+ public static s3d: 0;
24
+ public static looped: 1;
25
+ public static s2d: 2;
26
+
27
+ public frequency: f32;
28
+ public max_distance: f32;
29
+ public min_distance: f32;
30
+ public volume: f32;
31
+
32
+ /**
33
+ * @param sound_path - file path
34
+ */
35
+ public constructor(sound_path: string);
36
+ /**
37
+ * @param sound_path - file path
38
+ * @param type - default 'no_sound' (0)
39
+ */
40
+ public constructor(sound_path: string, type: TXR_snd_type);
41
+
42
+ public length(): u32;
43
+ public playing(): boolean;
44
+ public get_position(): vector;
45
+
46
+ public set_position(vector: vector): void;
47
+ public attach_tail(sound_path: string): void;
48
+
49
+ public play(object: game_object | null): void;
50
+ public play(object: game_object | null, delay: f32): void;
51
+ public play(object: game_object | null, delay: f32, type: i32): void;
52
+ public play_at_pos(object: game_object, position: vector): void;
53
+ public play_at_pos(object: game_object, position: vector, delay: f32): void;
54
+ public play_at_pos(object: game_object, position: vector, delay: f32, type: i32): void;
55
+ public play_no_feedback(object: game_object, type: i32, value1: f32, position: vector, value2: f32): void;
56
+
57
+ public stop(): void;
58
+ public stop_deffered(): void;
59
+ }
60
+
61
+ /**
62
+ * @group xr_sound
63
+ */
64
+ export type TXR_sound_object_type = EnumeratedStaticsValues<typeof sound_object>;
65
+
66
+ /**
67
+ * @source C++ class snd_type
68
+ * @customConstructor snd_type
69
+ * @group xr_sound
70
+ */
71
+ export class snd_type {
72
+ public static ambient: 128;
73
+ public static anomaly: 268435456;
74
+ public static anomaly_idle: 268437504;
75
+ public static attack: 8192;
76
+ public static bullet_hit: 524288;
77
+ public static die: 131072;
78
+ public static drop: 33554432;
79
+ public static eat: 4096;
80
+ public static empty: 1048576;
81
+ public static hide: 16777216;
82
+ public static idle: 2048;
83
+ public static injure: 65536;
84
+ public static item: 1073741824;
85
+ public static item_drop: 1107296256;
86
+ public static item_hide: 1090519040;
87
+ public static item_pick_up: 1140850688;
88
+ public static item_take: 1082130432;
89
+ public static item_use: 1077936128;
90
+ public static monster: 536870912;
91
+ public static monster_attack: 536879104;
92
+ public static monster_die: 537001984;
93
+ public static monster_eat: 536875008;
94
+ public static monster_injure: 536936448;
95
+ public static monster_step: 536903680;
96
+ public static monster_talk: 536887296;
97
+ public static no_sound: 0;
98
+ public static object_break: 1024;
99
+ public static object_collide: 512;
100
+ public static object_explode: 256;
101
+ public static pick_up: 67108864;
102
+ public static reload: 262144;
103
+ public static shoot: 2097152;
104
+ public static step: 32768;
105
+ public static take: 8388608;
106
+ public static talk: 16384;
107
+ public static use: 4194304;
108
+ public static weapon: -2147483648;
109
+ public static weapon_bullet_hit: -2146959360;
110
+ public static weapon_empty: -2146435072;
111
+ public static weapon_reload: -2147221504;
112
+ public static weapon_shoot: -2145386496;
113
+ public static world: 134217728;
114
+ public static world_ambient: 134217856;
115
+ public static world_object_break: 134218752;
116
+ public static world_object_collide: 134218240;
117
+ public static world_object_explode: 134217984;
118
+
119
+ private constructor();
120
+ }
121
+
122
+ /**
123
+ * @group xr_sound
124
+ */
125
+ export type TXR_snd_type = EnumeratedStaticsValues<typeof snd_type>;
126
+
127
+ /**
128
+ * @source C++ class SoundInfo
129
+ * @customConstructor SoundInfo
130
+ * @group xr_sound
131
+ */
132
+ export class SoundInfo {
133
+ public danger: i32;
134
+ public position: vector;
135
+ public power: f32;
136
+ public time: i32;
137
+ public who: game_object;
138
+
139
+ private constructor();
140
+ }
141
+
142
+ /**
143
+ * @source C++ class sound_memory_object : game_memory_object
144
+ * @customConstructor sound_memory_object
145
+ * @group xr_sound
146
+ */
147
+ export class sound_memory_object extends game_memory_object {
148
+ public readonly power: f32;
149
+ public type(): i32;
150
+
151
+ protected constructor();
152
+ }
153
+ }
@@ -0,0 +1,17 @@
1
+ declare module "xray16" {
2
+ /**
3
+ * Enumeration with possible game types:
4
+ * - eGameIDNoGame = u32(0),
5
+ * - eGameIDSingle = u32(1) << 0,
6
+ * - eGameIDDeathmatch = u32(1) << 1,
7
+ * - eGameIDTeamDeathmatch = u32(1) << 2,
8
+ * - eGameIDArtefactHunt = u32(1) << 3,
9
+ * - eGameIDCaptureTheArtefact = u32(1) << 4,
10
+ * - eGameIDDominationZone = u32(1) << 5,
11
+ * - eGameIDTeamDominationZone = u32(1) << 6,
12
+ *
13
+ * @source C++ enum EGameIDs
14
+ * @group xr_types
15
+ */
16
+ export type TXR_EGameID = 0 | 1 | 2 | 8 | 16 | 32 | 64;
17
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * List of types that are all cast to similar number type in lua / ts.
3
+ * Main purpose is to indicate what is used with C++ side for better documentation.
4
+ */
5
+ declare module "xray16" {
6
+ /**
7
+ * @group xr_types
8
+ */
9
+ type i8 = number;
10
+
11
+ /**
12
+ * @group xr_types
13
+ */
14
+ type u8 = number;
15
+
16
+ /**
17
+ * @group xr_types
18
+ */
19
+ type i16 = number;
20
+
21
+ /**
22
+ * @group xr_types
23
+ */
24
+ type u16 = number;
25
+
26
+ /**
27
+ * @group xr_types
28
+ */
29
+ type f32 = number;
30
+
31
+ /**
32
+ * @group xr_types
33
+ */
34
+ type i32 = number;
35
+
36
+ /**
37
+ * @group xr_types
38
+ */
39
+ type u32 = number;
40
+
41
+ /**
42
+ * @group xr_types
43
+ */
44
+ type f64 = number;
45
+
46
+ /**
47
+ * @group xr_types
48
+ */
49
+ type i64 = number;
50
+
51
+ /**
52
+ * @group xr_types
53
+ */
54
+ type u64 = number;
55
+
56
+ /**
57
+ * @group xr_types
58
+ */
59
+ type Maybe<T> = T | null | undefined;
60
+
61
+ /**
62
+ * @group xr_types
63
+ */
64
+ type EnumeratedStaticsKeys<T> = Exclude<keyof T, "constructor" | TEngineBindingStaticMethods>;
65
+
66
+ /**
67
+ * @group xr_types
68
+ */
69
+ type EnumeratedStaticsValues<T> = T[Exclude<keyof T, "constructor" | TEngineBindingStaticMethods>];
70
+ }