xray16 1.0.1 → 1.0.4

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.
package/README.md CHANGED
@@ -41,7 +41,7 @@ Class declaration registers table as userdata and adds constructor/destructor me
41
41
  ### Typescript
42
42
 
43
43
  <p>
44
- In TS codebase '@LuabindClass' decorator can be used to modify transformation and enable virtual calls. <br/>
44
+ In TS codebase 'LuabindClass' decorator can be used to modify transformation and enable virtual calls. <br/>
45
45
  Separate transformer is needed to build luabind classes instead of table-based classes.
46
46
  </p>
47
47
 
@@ -61,7 +61,7 @@ Separate transformer is needed to build luabind classes instead of table-based c
61
61
  Package includes plugins for typescript-to-lua for easier work with xray16 typings. <br/>
62
62
  Following ones are available:
63
63
 
64
- - transform_luabind_class - transforms @LuaBind declared classes in a specific way
64
+ - transform_luabind_class - transforms LuaBind decorated classes in a specific way
65
65
  - built_at_info - adds build information in resulting files
66
66
  - from_cast_utils - additional utils that should be removed in runtime
67
67
  - global_declarations_transform - transforms xray16 imports and removes them from runtime
@@ -74,12 +74,12 @@ Plugins can be included in tsconfig file as following:
74
74
  {
75
75
  "tstl": {
76
76
  "luaPlugins": [
77
- { "name": "xray16/plugins/transform_luabind_class/plugin.ts" },
78
- { "name": "xray16/plugins/global_declarations_transform.ts" },
79
- { "name": "xray16/plugins/built_at_info.ts" },
80
- { "name": "xray16/plugins/strip_lua_logger.ts" },
81
- { "name": "xray16/plugins/inject_filename.ts" },
82
- { "name": "xray16/plugins/from_cast_utils.ts" }
77
+ { "name": "xray16/plugins/transform_luabind_class/plugin" },
78
+ { "name": "xray16/plugins/global_declarations_transform" },
79
+ { "name": "xray16/plugins/built_at_info" },
80
+ { "name": "xray16/plugins/strip_lua_logger" },
81
+ { "name": "xray16/plugins/inject_filename" },
82
+ { "name": "xray16/plugins/from_cast_utils" }
83
83
  ]
84
84
  }
85
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xray16",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "author": "Neloreck",
5
5
  "repository": "https://github.com/stalker-xrts/xray-16-types",
6
6
  "private": false,
package/types/index.d.ts CHANGED
@@ -25,39 +25,4 @@ import "./xr_core";
25
25
  import "./xr_luabind";
26
26
  import "./xr_global";
27
27
 
28
- declare module "xray16" {
29
- /**
30
- * @group export
31
- */
32
- export const actor_stats: IXR_actor_stats;
33
-
34
- /**
35
- * @group export
36
- */
37
- export const ActorMenu: IXR_ActorMenu;
38
-
39
- /**
40
- * @group export
41
- */
42
- export const game: IXR_game;
43
-
44
- /**
45
- * @group export
46
- */
47
- export const level: IXR_level;
48
-
49
- /**
50
- * @group export
51
- */
52
- export const main_menu: IXR_main_menu;
53
-
54
- /**
55
- * @group export
56
- */
57
- export const object: typeof XR_object;
58
-
59
- /**
60
- * @group export
61
- */
62
- export const relation_registry: IXR_relation_registry;
63
- }
28
+ declare module "xray16" {}
@@ -386,8 +386,8 @@ declare module "xray16" {
386
386
  * @group xr_global
387
387
  */
388
388
  export interface IXR_level {
389
- add_call(this: void, cb1: () => boolean, cb2: () => boolean): void;
390
- add_call(this: void, object: object, cb1: () => boolean, cb2: () => boolean): void;
389
+ add_call(this: void, cb1: (this: void) => boolean, cb2: (this: void) => boolean): void;
390
+ add_call(this: void, object: object, cb1: (this: void) => boolean, cb2: (this: void) => boolean): void;
391
391
  add_call(this: void, object: object, str1: string, str2: string): void;
392
392
  add_cam_effector(this: void, effect: string, id: i32, is_cyclic: boolean, callback: string): void;
393
393
  add_cam_effector2(this: void, effect: string, id: i32, is_cyclic: boolean, callback: string, camera_fov: f32): void;
@@ -449,9 +449,9 @@ declare module "xray16" {
449
449
  hide_indicators_safe(this: void): void;
450
450
  high_cover_in_direction(this: void, num: u32, vector: vector): f32;
451
451
  is_wfx_playing(this: void): boolean;
452
- iterate_online_objects(this: void, cb: (object: game_object) => void | boolean): void;
453
- iterate_sounds(this: void, str: string, num: u32, cb: () => void): void;
454
- iterate_sounds(this: void, str: string, num: u32, object: object, cb: () => void): void;
452
+ iterate_online_objects(this: void, cb: (this: void, object: game_object) => void | boolean): void;
453
+ iterate_sounds(this: void, str: string, num: u32, cb: (this: void) => void): void;
454
+ iterate_sounds(this: void, str: string, num: u32, object: object, cb: (this: void) => void): void;
455
455
  low_cover_in_direction(this: void, num: u32, vector: vector): f32;
456
456
  main_input_receiver(this: void): CUIDialogWnd;
457
457
  map_add_object_spot(this: void, id: u16, selector: string, hint: string): void;
@@ -474,8 +474,8 @@ declare module "xray16" {
474
474
  * @returns intensity of rain, 0 if no rain active
475
475
  */
476
476
  rain_factor(this: void): f32;
477
- remove_call(this: void, cb1: () => boolean, cb2: () => void): void;
478
- remove_call(this: void, object: object, cb1: () => boolean, cb2: () => void): void;
477
+ remove_call(this: void, cb1: (this: void) => boolean, cb2: (this: void) => void): void;
478
+ remove_call(this: void, object: object, cb1: (this: void) => boolean, cb2: (this: void) => void): void;
479
479
  remove_call(this: void, object: object, str1: string, str2: string): void;
480
480
  remove_calls_for_object(this: void, object: object): void;
481
481
  remove_cam_effector(this: void, id: i32): void;
@@ -610,4 +610,39 @@ declare module "xray16" {
610
610
  active_tutorial_name(this: void): string;
611
611
  stop_tutorial(this: void): void;
612
612
  }
613
+
614
+ /**
615
+ * @group xr_global
616
+ */
617
+ export const actor_stats: IXR_actor_stats;
618
+
619
+ /**
620
+ * @group xr_global
621
+ */
622
+ export const ActorMenu: IXR_ActorMenu;
623
+
624
+ /**
625
+ * @group xr_global
626
+ */
627
+ export const game: IXR_game;
628
+
629
+ /**
630
+ * @group xr_global
631
+ */
632
+ export const level: IXR_level;
633
+
634
+ /**
635
+ * @group xr_global
636
+ */
637
+ export const main_menu: IXR_main_menu;
638
+
639
+ /**
640
+ * @group xr_global
641
+ */
642
+ export const object: typeof XR_object;
643
+
644
+ /**
645
+ * @group xr_global
646
+ */
647
+ export const relation_registry: IXR_relation_registry;
613
648
  }
@@ -219,7 +219,14 @@ declare module "xray16" {
219
219
  * @param should_save - whether ini file should be saved when destructor is called
220
220
  */
221
221
  public save_at_end(should_save: boolean): void;
222
- public section_for_each(cb: (name: string) => void): 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;
223
230
  }
224
231
 
225
232
  /**
@@ -18,7 +18,7 @@ declare module "xray16" {
18
18
  ): cse_abstract;
19
19
  public dont_has_info(object_id: u16, info_id: string): boolean;
20
20
  public has_info(object_id: u16, info_id: string): boolean;
21
- public iterate_objects(cb: (object: cse_alife_object) => boolean | void): void;
21
+ public iterate_objects(cb: (this: void, object: cse_alife_object) => boolean | void): void;
22
22
  public level_id(): u32;
23
23
  public level_name<T extends string = string>(value: i32): T;
24
24
  public release(cse_abstract: cse_alife_object | null, flag: boolean): void;
@@ -200,7 +200,7 @@ declare module "xray16" {
200
200
  */
201
201
  export class client_spawn_manager {
202
202
  public remove(number1: u16, number2: u16): void;
203
- public add(number1: u16, number2: u16, cb: () => void): void;
204
- public add(number1: u16, number2: u16, cb: () => void, object: XR_object): void;
203
+ public add(number1: u16, number2: u16, cb: (this: void) => void): void;
204
+ public add(number1: u16, number2: u16, cb: (this: void) => void, object: XR_object): void;
205
205
  }
206
206
  }
@@ -26,6 +26,8 @@ declare module "xray16" {
26
26
  }
27
27
 
28
28
  /**
29
+ * Class to link client side object implementation and wrap it with custom lua side logics.
30
+ *
29
31
  * @source C++ class object_binder
30
32
  * @customConstructor object_binder
31
33
  * @group xr_client_object
@@ -253,7 +255,7 @@ declare module "xray16" {
253
255
  */
254
256
  public set_callback(
255
257
  type: TXR_callbacks["trade_sell_buy_item"],
256
- cb?: ((item: game_object, money_direction: boolean, money: number) => void) | null,
258
+ cb?: ((this: void, item: game_object, money_direction: boolean, money: number) => void) | null,
257
259
  object?: object_binder | null
258
260
  ): void;
259
261
 
@@ -264,7 +266,7 @@ declare module "xray16" {
264
266
  */
265
267
  public set_callback(
266
268
  type: TXR_callbacks["zone_enter"],
267
- cb?: ((zone: game_object, object: game_object) => void) | null,
269
+ cb?: ((this: void, zone: game_object, object: game_object) => void) | null,
268
270
  object?: object_binder | null
269
271
  ): void;
270
272
 
@@ -273,7 +275,7 @@ declare module "xray16" {
273
275
  */
274
276
  public set_callback(
275
277
  type: TXR_callbacks["zone_exit"],
276
- cb?: ((zone: game_object, object: game_object) => void) | null,
278
+ cb?: ((this: void, zone: game_object, object: game_object) => void) | null,
277
279
  object?: object_binder | null
278
280
  ): void;
279
281
 
@@ -286,7 +288,7 @@ declare module "xray16" {
286
288
  */
287
289
  public set_callback(
288
290
  type: TXR_callbacks["death"],
289
- cb?: (target: game_object, killer: game_object) => void,
291
+ cb?: (this: void, target: game_object, killer: game_object) => void,
290
292
  object?: object_binder
291
293
  ): void;
292
294
 
@@ -295,7 +297,7 @@ declare module "xray16" {
295
297
  */
296
298
  public set_callback(
297
299
  type: TXR_callbacks["patrol_path_in_point"],
298
- cb?: ((object: game_object, action_type: number, point_index: number) => void) | null,
300
+ cb?: ((this: void, object: game_object, action_type: number, point_index: number) => void) | null,
299
301
  object?: object_binder | null
300
302
  ): void;
301
303
 
@@ -306,7 +308,7 @@ declare module "xray16" {
306
308
  */
307
309
  public set_callback(
308
310
  type: TXR_callbacks["inventory_info"],
309
- cb?: ((npc: game_object, info_id: string) => void) | null,
311
+ cb?: ((this: void, npc: game_object, info_id: string) => void) | null,
310
312
  object?: object_binder | null
311
313
  ): void;
312
314
 
@@ -317,7 +319,7 @@ declare module "xray16" {
317
319
  */
318
320
  public set_callback(
319
321
  type: TXR_callbacks["task_state"],
320
- cb?: ((task: CGameTask, state: TXR_TaskState) => void) | null,
322
+ cb?: ((this: void, task: CGameTask, state: TXR_TaskState) => void) | null,
321
323
  object?: object_binder | null
322
324
  ): void;
323
325
 
@@ -328,12 +330,12 @@ declare module "xray16" {
328
330
  */
329
331
  public set_callback(
330
332
  type: TXR_callbacks["use_object"],
331
- cb?: ((object: game_object) => void) | null,
333
+ cb?: ((this: void, object: game_object) => void) | null,
332
334
  object?: object_binder | null
333
335
  ): void;
334
336
  public set_callback(
335
337
  type: TXR_callbacks["use_object"],
336
- cb?: ((object: game_object, who: game_object) => void) | null,
338
+ cb?: ((this: void, object: game_object, who: game_object) => void) | null,
337
339
  object?: object_binder | null
338
340
  ): void;
339
341
 
@@ -342,7 +344,16 @@ declare module "xray16" {
342
344
  */
343
345
  public set_callback(
344
346
  type: TXR_callbacks["hit"],
345
- cb?: ((object: game_object, damage: number, direction: vector, who: game_object, bone_id: number) => void) | null,
347
+ cb?:
348
+ | ((
349
+ this: void,
350
+ object: game_object,
351
+ damage: number,
352
+ direction: vector,
353
+ who: game_object,
354
+ bone_id: number
355
+ ) => void)
356
+ | null,
346
357
  object?: object_binder | null
347
358
  ): void;
348
359
 
@@ -385,7 +396,7 @@ declare module "xray16" {
385
396
  */
386
397
  public set_callback(
387
398
  type: TXR_callbacks["helicopter_on_point"],
388
- cb?: ((distance: number, current_position: vector, vertex_id: number) => void) | null,
399
+ cb?: ((this: void, distance: number, current_position: vector, vertex_id: number) => void) | null,
389
400
  object?: object_binder | null
390
401
  ): void;
391
402
 
@@ -394,7 +405,7 @@ declare module "xray16" {
394
405
  */
395
406
  public set_callback(
396
407
  type: TXR_callbacks["helicopter_on_hit"],
397
- cb?: ((damage: number, impulse: number, hit_type: number, who_id: number) => void) | null,
408
+ cb?: ((this: void, damage: number, impulse: number, hit_type: number, who_id: number) => void) | null,
398
409
  object?: object_binder | null
399
410
  ): void;
400
411
 
@@ -403,7 +414,7 @@ declare module "xray16" {
403
414
  */
404
415
  public set_callback(
405
416
  type: TXR_callbacks["on_item_take"],
406
- cb?: ((npc: game_object, item: game_object) => void) | null,
417
+ cb?: ((this: void, object: game_object, item: game_object) => void) | null,
407
418
  object?: object_binder | null
408
419
  ): void;
409
420
 
@@ -412,7 +423,7 @@ declare module "xray16" {
412
423
  */
413
424
  public set_callback(
414
425
  type: TXR_callbacks["on_item_drop"],
415
- cb?: ((npc: game_object, item: game_object) => void) | null,
426
+ cb?: ((this: void, object: game_object, item: game_object) => void) | null,
416
427
  object?: object_binder | null
417
428
  ): void;
418
429
 
@@ -421,7 +432,7 @@ declare module "xray16" {
421
432
  */
422
433
  public set_callback(
423
434
  type: TXR_callbacks["script_animation"],
424
- cb?: ((skip_multi_anim_check?: boolean) => void) | null,
435
+ cb?: ((this: void, skip_multi_anim_check?: boolean) => void) | null,
425
436
  object?: object | null
426
437
  ): void;
427
438
 
@@ -436,7 +447,7 @@ declare module "xray16" {
436
447
  */
437
448
  public set_callback(
438
449
  type: TXR_callbacks["take_item_from_box"],
439
- cb?: ((npc: game_object, box: game_object, item: game_object) => void) | null,
450
+ cb?: ((this: void, object: game_object, box: game_object, item: game_object) => void) | null,
440
451
  object?: object_binder | null
441
452
  ): void;
442
453
 
@@ -747,11 +758,14 @@ declare module "xray16" {
747
758
  public idle_max_time(): f32;
748
759
  public idle_max_time(time: f32): void;
749
760
  public in_current_loophole_fov(vector: vector): boolean;
750
- public inventory_for_each(cb: () => void): void;
761
+ public inventory_for_each(cb: (this: void) => void): void;
751
762
  public is_door_blocked_by_npc(): boolean;
752
763
  public is_talk_enabled(): boolean;
753
764
  public is_weapon_going_to_be_strapped(weapon: game_object | null): boolean;
754
- public iterate_inventory_box(cb: (box: game_object, item: game_object) => void, object: game_object): void;
765
+ public iterate_inventory_box(
766
+ cb: (this: void, box: game_object, item: game_object) => void,
767
+ object: game_object
768
+ ): void;
755
769
  public lookout_max_time(): f32;
756
770
  public lookout_max_time(value: f32): void;
757
771
  public max_ignore_monster_distance(): f32;
@@ -329,6 +329,8 @@ declare module "xray16" {
329
329
  export class cse_alife_item_weapon_magazined extends cse_alife_item_weapon {}
330
330
 
331
331
  /**
332
+ * Base class for magazined weapons with grenade launcher.
333
+ *
332
334
  * @source C++ class cse_alife_item_weapon_magazined_w_gl : cse_alife_item_weapon_magazined
333
335
  * @customConstructor cse_alife_item_weapon_magazined_w_gl
334
336
  * @group xr_server_object
@@ -151,7 +151,7 @@ declare module "xray16" {
151
151
 
152
152
  public OnKeyboard(key: TXR_DIK_key, event: TXR_ui_event): boolean;
153
153
  public Update(): void;
154
- public AddCallback(name: string, event: number, cb: () => void, source?: CUIWindow): void;
154
+ public AddCallback(name: string, event: number, cb: (this: void) => void, source?: CUIWindow): void;
155
155
  public Dispatch(command: number, parameter: number): boolean;
156
156
  public Register(window: CUIWindow, name: string): void;
157
157
  public Load(value: string): boolean;