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,668 +1,1116 @@
1
- declare module "xray16" {
2
- /**
3
- * @source C++ class stalker_ids
4
- * @customConstructor stalker_ids
5
- * @group xr_goap
6
- */
7
- export class stalker_ids {
8
- public static readonly action_accomplish_task: 7;
9
- public static readonly action_aim_enemy: 16;
10
- public static readonly action_alife_planner: 88;
11
- public static readonly action_anomaly_planner: 90;
12
- public static readonly action_combat_planner: 89;
13
- public static readonly action_communicate_with_customer: 9;
14
- public static readonly action_critically_wounded: 36;
15
- public static readonly action_danger_by_sound_planner: 73;
16
- public static readonly action_danger_grenade_look_around: 85;
17
- public static readonly action_danger_grenade_planner: 72;
18
- public static readonly action_danger_grenade_search: 86;
19
- public static readonly action_danger_grenade_take_cover: 82;
20
- public static readonly action_danger_grenade_take_cover_after_explosion: 84;
21
- public static readonly action_danger_grenade_wait_for_explosion: 83;
22
- public static readonly action_danger_in_direction_detour: 80;
23
- public static readonly action_danger_in_direction_hold_position: 79;
24
- public static readonly action_danger_in_direction_look_out: 78;
25
- public static readonly action_danger_in_direction_planner: 71;
26
- public static readonly action_danger_in_direction_search: 81;
27
- public static readonly action_danger_in_direction_take_cover: 77;
28
- public static readonly action_danger_planner: 91;
29
- public static readonly action_danger_unknown_look_around: 75;
30
- public static readonly action_danger_unknown_planner: 70;
31
- public static readonly action_danger_unknown_search: 76;
32
- public static readonly action_danger_unknown_take_cover: 74;
33
- public static readonly action_dead: 0;
34
- public static readonly action_death_planner: 87;
35
- public static readonly action_detour_enemy: 25;
36
- public static readonly action_dying: 1;
37
- public static readonly action_find_ammo: 15;
38
- public static readonly action_find_item_to_kill: 13;
39
- public static readonly action_gather_items: 2;
40
- public static readonly action_get_distance: 24;
41
- public static readonly action_get_item_to_kill: 12;
42
- public static readonly action_get_ready_to_kill: 17;
43
- public static readonly action_hold_position: 23;
44
- public static readonly action_kill_enemy: 19;
45
- public static readonly action_kill_enemy_if_not_visible: 29;
46
- public static readonly action_kill_if_enemy_critically_wounded: 37;
47
- public static readonly action_kill_if_player_on_the_path: 35;
48
- public static readonly action_kill_wounded_enemy: 33;
49
- public static readonly action_look_out: 22;
50
- public static readonly action_make_item_killing: 14;
51
- public static readonly action_no_alife: 3;
52
- public static readonly action_post_combat_wait: 34;
53
- public static readonly action_prepare_wounded_enemy: 32;
54
- public static readonly action_reach_customer_location: 8;
55
- public static readonly action_reach_task_location: 6;
56
- public static readonly action_reach_wounded_enemy: 30;
57
- public static readonly action_retreat_from_enemy: 20;
58
- public static readonly action_script: 92;
59
- public static readonly action_search_enemy: 26;
60
- public static readonly action_smart_terrain_task: 4;
61
- public static readonly action_solve_zone_puzzle: 5;
62
- public static readonly action_sudden_attack: 28;
63
- public static readonly action_take_cover: 21;
64
- public static readonly detect_anomaly: 11;
65
- public static readonly get_out_of_anomaly: 10;
66
-
67
- public static readonly property_alife: 3;
68
- /**
69
- * Whether object is alive.
70
- */
71
- public static readonly property_alive: 0;
72
- public static readonly property_already_dead: 2;
73
- public static readonly property_anomaly: 46;
74
- public static readonly property_cover_actual: 42;
75
- public static readonly property_cover_reached: 43;
76
- public static readonly property_critically_wounded: 29;
77
- public static readonly property_danger: 8;
78
- public static readonly property_danger_by_sound: 41;
79
- public static readonly property_danger_grenade: 40;
80
- public static readonly property_danger_in_direction: 39;
81
- public static readonly property_danger_unknown: 38;
82
- public static readonly property_dead: 1;
83
- /**
84
- * Whether object has any enemy.
85
- */
86
- public static readonly property_enemy: 7;
87
- public static readonly property_enemy_critically_wounded: 30;
88
- public static readonly property_enemy_detoured: 21;
89
- public static readonly property_found_ammo: 12;
90
- public static readonly property_found_item_to_kill: 10;
91
- public static readonly property_grenade_exploded: 45;
92
- public static readonly property_in_cover: 18;
93
- public static readonly property_inside_anomaly: 47;
94
- public static readonly property_item_can_kill: 11;
95
- public static readonly property_item_to_kill: 9;
96
- /**
97
- * Whether object has valuable items to be looted after death.
98
- */
99
- public static readonly property_items: 6;
100
- public static readonly property_looked_around: 44;
101
- public static readonly property_looked_out: 19;
102
- /**
103
- * Whether object should panic.
104
- */
105
- public static readonly property_panic: 17;
106
- public static readonly property_position_holded: 20;
107
- public static readonly property_pure_enemy: 23;
108
- /**
109
- * Whether object has solved zone puzzle.
110
- * Originally alife was different and it was end goal of each stalker.
111
- * To solve zone puzzle stalkers collected artefacts, did quests etc.
112
- */
113
- public static readonly property_puzzle_solved: 4;
114
- public static readonly property_ready_to_detour: 14;
115
- public static readonly property_ready_to_kill: 13;
116
- public static readonly property_script: 74;
117
- /**
118
- * Whether object see enemy.
119
- */
120
- public static readonly property_see_enemy: 15;
121
- public static readonly property_smart_terrain_task: 5;
122
- public static readonly property_use_crouch_to_look_out: 24;
123
- public static readonly property_use_suddenness: 22;
124
-
125
- public static readonly sound_alarm: 4;
126
- public static readonly sound_attack_allies_several_enemies: 7;
127
- public static readonly sound_attack_allies_single_enemy: 6;
128
- public static readonly sound_attack_no_allies: 5;
129
- public static readonly sound_backup: 8;
130
- public static readonly sound_detour: 9;
131
- public static readonly sound_die: 0;
132
- public static readonly sound_die_in_anomaly: 1;
133
- public static readonly sound_enemy_critically_wounded: 24;
134
- public static readonly sound_enemy_killed_or_wounded = -805289984;
135
- public static readonly sound_enemy_lost_no_allies: 12;
136
- public static readonly sound_enemy_lost_with_allies: 13;
137
- public static readonly sound_friendly_grenade_alarm: 20;
138
- public static readonly sound_grenade_alarm: 19;
139
- public static readonly sound_humming: 3;
140
- public static readonly sound_injuring: 2;
141
- public static readonly sound_injuring_by_friend: 14;
142
- public static readonly sound_kill_wounded: 23;
143
- public static readonly sound_need_backup: 21;
144
- public static readonly sound_panic_human: 15;
145
- public static readonly sound_panic_monster: 16;
146
- public static readonly sound_running_in_danger: 22;
147
- public static readonly sound_script: 27;
148
- public static readonly sound_search1_no_allies: 11;
149
- public static readonly sound_search1_with_allies: 10;
150
- public static readonly sound_tolls: 17;
151
- public static readonly sound_wounded: 18;
152
-
153
- public constructor();
154
- }
155
-
156
- /**
157
- * Generic container object for GOAP world properties.
158
- *
159
- * @source C++ class world_property
160
- * @customConstructor world_property
161
- * @group xr_goap
162
- */
163
- export class world_property extends EngineBinding {
164
- /**
165
- * Default constructor to describe a pair of identifier and value.
166
- *
167
- * @param id - identifier of unique world property
168
- * @param enabled - value of property state
169
- */
170
- public constructor(id: u32, enabled: boolean);
171
-
172
- /**
173
- * @returns value of current world property
174
- */
175
- public value(): boolean;
176
-
177
- /**
178
- * @returns condition identifier of current world property
179
- */
180
- public condition(): u32;
181
- }
182
-
183
- /**
184
- * World state describing whole world state in action planning.
185
- *
186
- * Overrides operators: `<`, `==`
187
- *
188
- * @source C++ class world_state
189
- * @customConstructor world_state
190
- * @group xr_goap
191
- */
192
- export class world_state extends EngineBinding {
193
- /**
194
- * Default constructor.
195
- */
196
- public constructor();
197
-
198
- /**
199
- * Copy constructor.
200
- *
201
- * @param another_state - target world state to copy
202
- */
203
- public constructor(another_state: world_state);
204
-
205
- /**
206
- * Set property for world state.
207
- *
208
- * @param property - target property to add in world state
209
- */
210
- public add_property(property: world_property): void;
211
-
212
- /**
213
- * Clear all properties in the state.
214
- */
215
- public clear(): void;
216
-
217
- /**
218
- * Check if provided state is subset of current one.
219
- *
220
- * @param state - target state to check
221
- * @returns whether current world state includes provided state
222
- */
223
- public includes(state: world_state): boolean;
224
-
225
- /**
226
- * Get world property by id.
227
- *
228
- * @param id - numeric if of the required property
229
- * @returns property id/state based on provided id
230
- */
231
- public property(id: u32): world_property;
232
-
233
- /**
234
- * Remove world property from current world state.
235
- *
236
- * @param id - identifier of the property to remove
237
- */
238
- public remove_property(id: u32): void;
239
- }
240
-
241
- /**
242
- * Storage of object evaluators cached state for handling of in-game logic.
243
- * Container for actions.
244
- *
245
- * @source C++ class property_storage
246
- * @customConstructor property_storage
247
- * @group xr_goap
248
- */
249
- export class property_storage extends EngineBinding {
250
- /**
251
- * Get property evaluator value by `id`.
252
- *
253
- * @throws if property is not declared in storage
254
- *
255
- * @param id - unique identifier of the world property
256
- * @returns current value for provided `id`
257
- */
258
- public property(id: u32): boolean;
259
-
260
- /**
261
- * Set property value in the storage.
262
- *
263
- * @param id - unique identifier of the world property
264
- * @param value - value for provided `id`
265
- */
266
- public set_property(id: u32, value: boolean): void;
267
- }
268
-
269
- /**
270
- * Class implementation of world properties evaluators.
271
- * Generic handler to calculate current state of bound world property `id`.
272
- *
273
- * @source C++ class property_evaluator
274
- * @customConstructor property_evaluator
275
- * @group xr_goap
276
- */
277
- export class property_evaluator extends EngineBinding {
278
- /**
279
- * Linked game object to work with.
280
- */
281
- public readonly object: game_object;
282
-
283
- /**
284
- * Container reference with state of action preconditions.
285
- */
286
- public readonly storage: property_storage;
287
-
288
- /**
289
- * Default constructor.
290
- */
291
- public constructor();
292
-
293
- /**
294
- * @param object - target game object to work with, `null` is OK since correct object will be injected on setup
295
- */
296
- public constructor(object: game_object | null);
297
-
298
- /**
299
- * @param object - target game object to work with, `null` is OK since correct object will be injected on setup
300
- * @param name - name of the evaluator, used for debug purposes mainly
301
- */
302
- public constructor(object: game_object | null, name: string);
303
-
304
- /**
305
- * Handle setup of the evaluator and binding to a specific object.
306
- *
307
- * @param object - target client object to work with
308
- * @param storage - action instance storage with preconditions and state
309
- */
310
- public setup(object: game_object, storage: property_storage): void;
311
-
312
- /**
313
- * Main evaluator lifecycle method.
314
- * Called every time to get world property up-to-date state.
315
- */
316
- public evaluate(): boolean;
317
- }
318
-
319
- /**
320
- * Class implementation of world properties evaluators.
321
- * Static handler to return pre-defined value for specific world property `id`.
322
- *
323
- * @source C++ class property_evaluator_const : property_evaluator
324
- * @customConstructor property_evaluator_const
325
- * @group xr_goap
326
- */
327
- export class property_evaluator_const extends property_evaluator {
328
- /**
329
- * @param value - constant value for evaluation
330
- */
331
- public constructor(value: boolean);
332
- }
333
-
334
- /**
335
- * Abstract class for implementation of GOAP planner actions.
336
- *
337
- * @source C++ class action_base
338
- * @customConstructor action_base
339
- * @group xr_goap
340
- */
341
- export abstract class action_base extends EngineBinding {
342
- /**
343
- * Game object that is handled by current action instance.
344
- */
345
- public readonly object: game_object;
346
-
347
- /**
348
- * Container reference with state of action preconditions.
349
- */
350
- public readonly storage: property_storage;
351
-
352
- /**
353
- * Default constructor.
354
- */
355
- public constructor();
356
-
357
- /**
358
- * @param object - target game object to work with, `null` is OK since correct object will be injected on setup
359
- */
360
- public constructor(object?: game_object | null);
361
-
362
- /**
363
- * @param object - target game object to work with, `null` is OK since correct object will be injected on setup
364
- * @param name - name of the action, used for debug purposes mainly
365
- */
366
- public constructor(object: game_object | null, name: string);
367
-
368
- /**
369
- * Handle setup of the action and binding to a specific object.
370
- *
371
- * @param object - target client object to work with
372
- * @param storage - action instance storage with preconditions and state
373
- */
374
- public setup(object: game_object, storage: property_storage): void;
375
-
376
- /**
377
- * Lifecycle method called once on action execution start.
378
- * Means that lifecycle of the action begun.
379
- */
380
- public initialize(): void;
381
-
382
- /**
383
- * Lifecycle method.
384
- * Execution tick of the action, called from object logics update cycle when current action is active.
385
- */
386
- public execute(): void;
387
-
388
- /**
389
- * Lifecycle method called once on action execution stop.
390
- * Means that action is finished / preconditions are not met anymore.
391
- */
392
- public finalize(): void;
393
-
394
- /**
395
- * Set weight of current action execution.
396
- *
397
- * @param weight - weight value to express how prioritized action is
398
- */
399
- public set_weight(weight: u16): void;
400
-
401
- /**
402
- * Add action effect.
403
- * Describes what target world state is expected to be if action is completed.
404
- *
405
- * @param property - world state property describing a pair of evaluator ID and value
406
- */
407
- public add_effect(property: world_property): void;
408
-
409
- /**
410
- * Remove action effect.
411
- * Action will be not considered as property changing for `id` anymore
412
- *
413
- * @param id - world state property id
414
- */
415
- public remove_effect(id: u32): void;
416
-
417
- /**
418
- * Add action execution precondition.
419
- * When building logics graph, action will be considered blocked by some preconditions.
420
- *
421
- * @param property - world state property describing a pair of evaluator ID and value
422
- */
423
- public add_precondition(property: world_property): void;
424
-
425
- /**
426
- * Remove precondition for action.
427
- * When building logics graph, action will not be considered blocked by evaluator `id` states.
428
- *
429
- * @param id - world state property id
430
- */
431
- public remove_precondition(id: u32): void;
432
-
433
- /**
434
- * Debug method.
435
- * With mixed / debug build allows investigation of evaluators and actions matches.
436
- * Helps to debug custom actions and actions pre-conditions with state printing in log files.
437
- *
438
- * Note: Available only in mixed / debug engine builds, not for direct usage from lua.
439
- *
440
- * @param prefix - string prefix to display current action state in logs
441
- */
442
- public show(prefix?: string): void;
443
- }
444
-
445
- /**
446
- * @source C++ class action_planner
447
- * @customConstructor action_planner
448
- * @group xr_goap
449
- */
450
- export class action_planner extends EngineBinding {
451
- /**
452
- * Game object that is handled by current planner instance.
453
- */
454
- public readonly object: game_object;
455
-
456
- /**
457
- * Container reference with state of planner preconditions.
458
- */
459
- public readonly storage: property_storage;
460
-
461
- /**
462
- * Default constructor.
463
- */
464
- public constructor();
465
-
466
- /**
467
- * @returns whether object action planner is already initialized
468
- */
469
- public initialized(): boolean;
470
-
471
- /**
472
- * @returns whether state of current planner is actual
473
- */
474
- public actual(): boolean;
475
-
476
- /**
477
- * Setup planner for game object.
478
- *
479
- * @param object - client game object to setup planner for
480
- */
481
- public setup(object: game_object): void;
482
-
483
- /**
484
- * Clear state of current action planner.
485
- */
486
- public clear(): void;
487
-
488
- /**
489
- * Lifecycle method to handle generic game loop updates.
490
- */
491
- public update(): void;
492
-
493
- /**
494
- * Add generic action by `id` for planner execution.
495
- *
496
- * @param id - unique identifier of new action
497
- * @param action - action implementation containing preconditions, logics, effects and other meta infos
498
- */
499
- public add_action(id: u32, action: action_base): void;
500
-
501
- /**
502
- * Remove action by unique `id`.
503
- *
504
- * @param id - unique identifier of the action to remove
505
- */
506
- public remove_action(id: u32): void;
507
-
508
- /**
509
- * Get action instance by unique `id`.
510
- *
511
- * @param id - unique identifier of the action to get
512
- */
513
- public action(id: u32): action_base;
514
-
515
- /**
516
- * Get currently active action being executed.
517
- *
518
- * @returns current action instance reference
519
- */
520
- public current_action(): action_base;
521
-
522
- /**
523
- * Get currently active action identifier.
524
- *
525
- * @returns unique identifier of current action
526
- */
527
- public current_action_id(): u32;
528
-
529
- /**
530
- * Set target world state to try to reach with all the graph logics.
531
- * All graphs will be built from current state to goal world state with the shortest possible path.
532
- *
533
- * @param state - target world state to reach with planner
534
- */
535
- public set_goal_world_state(state: world_state): void;
536
-
537
- /**
538
- * Add evaluator instance for current action planner.
539
- *
540
- * @param id - unique identifier of the evaluator
541
- * @param evaluator - instance of evaluator linked to the `id`
542
- */
543
- public add_evaluator(id: u32, evaluator: property_evaluator): void;
544
-
545
- /**
546
- * Return evaluator instance for current action planner.
547
- *
548
- * @param id - unique identifier of the evaluator for removal
549
- */
550
- public remove_evaluator(id: u32): void;
551
-
552
- /**
553
- * Get evaluator instance by `id`.
554
- *
555
- * @param id - unique identifier of the evaluator to get
556
- */
557
- public evaluator(id: u32): property_evaluator;
558
-
559
- /**
560
- * Debug method.
561
- * With mixed / debug build allows investigation of evaluators and actions matches.
562
- * Helps to debug custom actions and actions pre-conditions with state printing in log files.
563
- *
564
- * Note: Available only in mixed / debug engine builds, not for direct usage from lua.
565
- *
566
- * @param prefix - string prefix to display current action state in logs
567
- */
568
- public show(prefix: string): void;
569
- }
570
-
571
- /**
572
- * GOAP action class implementing both action base and action planner.
573
- * Captures execution as action and plans its internal logic with separate logics graph.
574
- *
575
- * Examples: combat planner, anomaly planner, items looting planner, alife planner, state planner
576
- *
577
- * @source C++ class planner_action : action_planner,action_base
578
- * @customConstructor planner_action
579
- * @group xr_goap
580
- */
581
- export class planner_action extends action_planner {
582
- /**
583
- * Default constructor.
584
- */
585
- public constructor();
586
-
587
- /**
588
- * @param object - target game object to work with, `null` is OK since correct object will be injected on setup
589
- */
590
- public constructor(object?: game_object | null);
591
-
592
- /**
593
- * @param object - target game object to work with, `null` is OK since correct object will be injected on setup
594
- * @param name - name of the action, used for debug purposes mainly
595
- */
596
- public constructor(object: game_object | null, name: string);
597
-
598
- /**
599
- * Lifecycle method called once on action execution start.
600
- * Means that lifecycle of the action begun.
601
- */
602
- public initialize(): void;
603
-
604
- /**
605
- * Lifecycle method called once on action execution stop.
606
- * Means that action is finished / preconditions are not met anymore.
607
- */
608
- public finalize(): void;
609
-
610
- /**
611
- * Lifecycle method.
612
- * Execution tick of the action, called from object logics update cycle when current action is active.
613
- */
614
- public execute(): void;
615
-
616
- /**
617
- * Add action effect.
618
- * Describes what target world state is expected to be if action is completed.
619
- *
620
- * @param property - world state property describing a pair of evaluator ID and value
621
- */
622
- public add_effect(property: world_property): unknown;
623
-
624
- /**
625
- * Remove action effect.
626
- * Action will be not considered as property changing for `id` anymore
627
- *
628
- * @param id - world state property id
629
- */
630
- public remove_effect(id: u32): void;
631
-
632
- /**
633
- * Add action execution precondition.
634
- * When building logics graph, action will be considered blocked by some preconditions.
635
- *
636
- * @param property - world state property describing a pair of evaluator ID and value
637
- */
638
- public add_precondition(property: world_property): void;
639
-
640
- /**
641
- * Remove precondition for action.
642
- * When building logics graph, action will not be considered blocked by evaluator `id` states.
643
- *
644
- * @param id - world state property id
645
- */
646
- public remove_precondition(id: u32): void;
647
-
648
- /**
649
- * Set weight of planner action switch.
650
- *
651
- * @param weight - weight value to express how prioritized action is
652
- */
653
- public set_weight(weight: u32): void;
654
-
655
- /**
656
- * Comparator to check weight of switching one state to another.
657
- *
658
- * @param first - first state
659
- * @param second - second state
660
- */
661
- public weight(first: world_state, second: world_state): u16;
662
- }
663
-
664
- /**
665
- * @group xr_global_declaration
666
- */
667
- export function cast_planner(this: void, base_action: action_base): action_planner;
668
- }
1
+ declare module "xray16" {
2
+ /**
3
+ * GOAP property and action id constants for stalker AI.
4
+ *
5
+ * @source C++ class stalker_ids
6
+ * @customConstructor stalker_ids
7
+ * @group xr_goap
8
+ */
9
+ export class stalker_ids {
10
+ /**
11
+ * Engine enum value for `stalker_ids.action_accomplish_task`.
12
+ */
13
+ public static readonly action_accomplish_task: 7;
14
+ /**
15
+ * Engine enum value for `stalker_ids.action_aim_enemy`.
16
+ */
17
+ public static readonly action_aim_enemy: 16;
18
+ /**
19
+ * Engine enum value for `stalker_ids.action_alife_planner`.
20
+ */
21
+ public static readonly action_alife_planner: 88;
22
+ /**
23
+ * Engine enum value for `stalker_ids.action_anomaly_planner`.
24
+ */
25
+ public static readonly action_anomaly_planner: 90;
26
+ /**
27
+ * Engine enum value for `stalker_ids.action_combat_planner`.
28
+ */
29
+ public static readonly action_combat_planner: 89;
30
+ /**
31
+ * Engine enum value for `stalker_ids.action_communicate_with_customer`.
32
+ */
33
+ public static readonly action_communicate_with_customer: 9;
34
+ /**
35
+ * Engine enum value for `stalker_ids.action_critically_wounded`.
36
+ */
37
+ public static readonly action_critically_wounded: 36;
38
+ /**
39
+ * Engine enum value for `stalker_ids.action_danger_by_sound_planner`.
40
+ */
41
+ public static readonly action_danger_by_sound_planner: 73;
42
+ /**
43
+ * Engine enum value for `stalker_ids.action_danger_grenade_look_around`.
44
+ */
45
+ public static readonly action_danger_grenade_look_around: 85;
46
+ /**
47
+ * Engine enum value for `stalker_ids.action_danger_grenade_planner`.
48
+ */
49
+ public static readonly action_danger_grenade_planner: 72;
50
+ /**
51
+ * Engine enum value for `stalker_ids.action_danger_grenade_search`.
52
+ */
53
+ public static readonly action_danger_grenade_search: 86;
54
+ /**
55
+ * Engine enum value for `stalker_ids.action_danger_grenade_take_cover`.
56
+ */
57
+ public static readonly action_danger_grenade_take_cover: 82;
58
+ /**
59
+ * Engine enum value for `stalker_ids.action_danger_grenade_take_cover_after_explosion`.
60
+ */
61
+ public static readonly action_danger_grenade_take_cover_after_explosion: 84;
62
+ /**
63
+ * Engine enum value for `stalker_ids.action_danger_grenade_wait_for_explosion`.
64
+ */
65
+ public static readonly action_danger_grenade_wait_for_explosion: 83;
66
+ /**
67
+ * Engine enum value for `stalker_ids.action_danger_in_direction_detour`.
68
+ */
69
+ public static readonly action_danger_in_direction_detour: 80;
70
+ /**
71
+ * Engine enum value for `stalker_ids.action_danger_in_direction_hold_position`.
72
+ */
73
+ public static readonly action_danger_in_direction_hold_position: 79;
74
+ /**
75
+ * Engine enum value for `stalker_ids.action_danger_in_direction_look_out`.
76
+ */
77
+ public static readonly action_danger_in_direction_look_out: 78;
78
+ /**
79
+ * Engine enum value for `stalker_ids.action_danger_in_direction_planner`.
80
+ */
81
+ public static readonly action_danger_in_direction_planner: 71;
82
+ /**
83
+ * Engine enum value for `stalker_ids.action_danger_in_direction_search`.
84
+ */
85
+ public static readonly action_danger_in_direction_search: 81;
86
+ /**
87
+ * Engine enum value for `stalker_ids.action_danger_in_direction_take_cover`.
88
+ */
89
+ public static readonly action_danger_in_direction_take_cover: 77;
90
+ /**
91
+ * Engine enum value for `stalker_ids.action_danger_planner`.
92
+ */
93
+ public static readonly action_danger_planner: 91;
94
+ /**
95
+ * Engine enum value for `stalker_ids.action_danger_unknown_look_around`.
96
+ */
97
+ public static readonly action_danger_unknown_look_around: 75;
98
+ /**
99
+ * Engine enum value for `stalker_ids.action_danger_unknown_planner`.
100
+ */
101
+ public static readonly action_danger_unknown_planner: 70;
102
+ /**
103
+ * Engine enum value for `stalker_ids.action_danger_unknown_search`.
104
+ */
105
+ public static readonly action_danger_unknown_search: 76;
106
+ /**
107
+ * Engine enum value for `stalker_ids.action_danger_unknown_take_cover`.
108
+ */
109
+ public static readonly action_danger_unknown_take_cover: 74;
110
+ /**
111
+ * Engine enum value for `stalker_ids.action_dead`.
112
+ */
113
+ public static readonly action_dead: 0;
114
+ /**
115
+ * Engine enum value for `stalker_ids.action_death_planner`.
116
+ */
117
+ public static readonly action_death_planner: 87;
118
+ /**
119
+ * Engine enum value for `stalker_ids.action_detour_enemy`.
120
+ */
121
+ public static readonly action_detour_enemy: 25;
122
+ /**
123
+ * Engine enum value for `stalker_ids.action_dying`.
124
+ */
125
+ public static readonly action_dying: 1;
126
+ /**
127
+ * Engine enum value for `stalker_ids.action_find_ammo`.
128
+ */
129
+ public static readonly action_find_ammo: 15;
130
+ /**
131
+ * Engine enum value for `stalker_ids.action_find_item_to_kill`.
132
+ */
133
+ public static readonly action_find_item_to_kill: 13;
134
+ /**
135
+ * Engine enum value for `stalker_ids.action_gather_items`.
136
+ */
137
+ public static readonly action_gather_items: 2;
138
+ /**
139
+ * Engine enum value for `stalker_ids.action_get_distance`.
140
+ */
141
+ public static readonly action_get_distance: 24;
142
+ /**
143
+ * Engine enum value for `stalker_ids.action_get_item_to_kill`.
144
+ */
145
+ public static readonly action_get_item_to_kill: 12;
146
+ /**
147
+ * Engine enum value for `stalker_ids.action_get_ready_to_kill`.
148
+ */
149
+ public static readonly action_get_ready_to_kill: 17;
150
+ /**
151
+ * Engine enum value for `stalker_ids.action_hold_position`.
152
+ */
153
+ public static readonly action_hold_position: 23;
154
+ /**
155
+ * Engine enum value for `stalker_ids.action_kill_enemy`.
156
+ */
157
+ public static readonly action_kill_enemy: 19;
158
+ /**
159
+ * Engine enum value for `stalker_ids.action_kill_enemy_if_not_visible`.
160
+ */
161
+ public static readonly action_kill_enemy_if_not_visible: 29;
162
+ /**
163
+ * Engine enum value for `stalker_ids.action_kill_if_enemy_critically_wounded`.
164
+ */
165
+ public static readonly action_kill_if_enemy_critically_wounded: 37;
166
+ /**
167
+ * Engine enum value for `stalker_ids.action_kill_if_player_on_the_path`.
168
+ */
169
+ public static readonly action_kill_if_player_on_the_path: 35;
170
+ /**
171
+ * Engine enum value for `stalker_ids.action_kill_wounded_enemy`.
172
+ */
173
+ public static readonly action_kill_wounded_enemy: 33;
174
+ /**
175
+ * Engine enum value for `stalker_ids.action_look_out`.
176
+ */
177
+ public static readonly action_look_out: 22;
178
+ /**
179
+ * Engine enum value for `stalker_ids.action_make_item_killing`.
180
+ */
181
+ public static readonly action_make_item_killing: 14;
182
+ /**
183
+ * Engine enum value for `stalker_ids.action_no_alife`.
184
+ */
185
+ public static readonly action_no_alife: 3;
186
+ /**
187
+ * Engine enum value for `stalker_ids.action_post_combat_wait`.
188
+ */
189
+ public static readonly action_post_combat_wait: 34;
190
+ /**
191
+ * Engine enum value for `stalker_ids.action_prepare_wounded_enemy`.
192
+ */
193
+ public static readonly action_prepare_wounded_enemy: 32;
194
+ /**
195
+ * Engine enum value for `stalker_ids.action_reach_customer_location`.
196
+ */
197
+ public static readonly action_reach_customer_location: 8;
198
+ /**
199
+ * Engine enum value for `stalker_ids.action_reach_task_location`.
200
+ */
201
+ public static readonly action_reach_task_location: 6;
202
+ /**
203
+ * Engine enum value for `stalker_ids.action_reach_wounded_enemy`.
204
+ */
205
+ public static readonly action_reach_wounded_enemy: 30;
206
+ /**
207
+ * Engine enum value for `stalker_ids.action_retreat_from_enemy`.
208
+ */
209
+ public static readonly action_retreat_from_enemy: 20;
210
+ /**
211
+ * Engine enum value for `stalker_ids.action_script`.
212
+ */
213
+ public static readonly action_script: 92;
214
+ /**
215
+ * Engine enum value for `stalker_ids.action_search_enemy`.
216
+ */
217
+ public static readonly action_search_enemy: 26;
218
+ /**
219
+ * Engine enum value for `stalker_ids.action_smart_terrain_task`.
220
+ */
221
+ public static readonly action_smart_terrain_task: 4;
222
+ /**
223
+ * Engine enum value for `stalker_ids.action_solve_zone_puzzle`.
224
+ */
225
+ public static readonly action_solve_zone_puzzle: 5;
226
+ /**
227
+ * Engine enum value for `stalker_ids.action_sudden_attack`.
228
+ */
229
+ public static readonly action_sudden_attack: 28;
230
+ /**
231
+ * Engine enum value for `stalker_ids.action_take_cover`.
232
+ */
233
+ public static readonly action_take_cover: 21;
234
+ /**
235
+ * Engine enum value for `stalker_ids.detect_anomaly`.
236
+ */
237
+ public static readonly detect_anomaly: 11;
238
+ /**
239
+ * Engine enum value for `stalker_ids.get_out_of_anomaly`.
240
+ */
241
+ public static readonly get_out_of_anomaly: 10;
242
+
243
+ /**
244
+ * Engine enum value for `stalker_ids.property_alife`.
245
+ */
246
+ public static readonly property_alife: 3;
247
+ /**
248
+ * Whether object is alive.
249
+ */
250
+ public static readonly property_alive: 0;
251
+ /**
252
+ * Engine enum value for `stalker_ids.property_already_dead`.
253
+ */
254
+ public static readonly property_already_dead: 2;
255
+ /**
256
+ * Engine enum value for `stalker_ids.property_anomaly`.
257
+ */
258
+ public static readonly property_anomaly: 46;
259
+ /**
260
+ * Engine enum value for `stalker_ids.property_cover_actual`.
261
+ */
262
+ public static readonly property_cover_actual: 42;
263
+ /**
264
+ * Engine enum value for `stalker_ids.property_cover_reached`.
265
+ */
266
+ public static readonly property_cover_reached: 43;
267
+ /**
268
+ * Engine enum value for `stalker_ids.property_critically_wounded`.
269
+ */
270
+ public static readonly property_critically_wounded: 29;
271
+ /**
272
+ * Engine enum value for `stalker_ids.property_danger`.
273
+ */
274
+ public static readonly property_danger: 8;
275
+ /**
276
+ * Engine enum value for `stalker_ids.property_danger_by_sound`.
277
+ */
278
+ public static readonly property_danger_by_sound: 41;
279
+ /**
280
+ * Engine enum value for `stalker_ids.property_danger_grenade`.
281
+ */
282
+ public static readonly property_danger_grenade: 40;
283
+ /**
284
+ * Engine enum value for `stalker_ids.property_danger_in_direction`.
285
+ */
286
+ public static readonly property_danger_in_direction: 39;
287
+ /**
288
+ * Engine enum value for `stalker_ids.property_danger_unknown`.
289
+ */
290
+ public static readonly property_danger_unknown: 38;
291
+ /**
292
+ * Engine enum value for `stalker_ids.property_dead`.
293
+ */
294
+ public static readonly property_dead: 1;
295
+ /**
296
+ * Whether object has any enemy.
297
+ */
298
+ public static readonly property_enemy: 7;
299
+ /**
300
+ * Engine enum value for `stalker_ids.property_enemy_critically_wounded`.
301
+ */
302
+ public static readonly property_enemy_critically_wounded: 30;
303
+ /**
304
+ * Engine enum value for `stalker_ids.property_enemy_detoured`.
305
+ */
306
+ public static readonly property_enemy_detoured: 21;
307
+ /**
308
+ * Engine enum value for `stalker_ids.property_found_ammo`.
309
+ */
310
+ public static readonly property_found_ammo: 12;
311
+ /**
312
+ * Engine enum value for `stalker_ids.property_found_item_to_kill`.
313
+ */
314
+ public static readonly property_found_item_to_kill: 10;
315
+ /**
316
+ * Engine enum value for `stalker_ids.property_grenade_exploded`.
317
+ */
318
+ public static readonly property_grenade_exploded: 45;
319
+ /**
320
+ * Engine enum value for `stalker_ids.property_in_cover`.
321
+ */
322
+ public static readonly property_in_cover: 18;
323
+ /**
324
+ * Engine enum value for `stalker_ids.property_inside_anomaly`.
325
+ */
326
+ public static readonly property_inside_anomaly: 47;
327
+ /**
328
+ * Engine enum value for `stalker_ids.property_item_can_kill`.
329
+ */
330
+ public static readonly property_item_can_kill: 11;
331
+ /**
332
+ * Engine enum value for `stalker_ids.property_item_to_kill`.
333
+ */
334
+ public static readonly property_item_to_kill: 9;
335
+ /**
336
+ * Whether object has valuable items to be looted after death.
337
+ */
338
+ public static readonly property_items: 6;
339
+ /**
340
+ * Engine enum value for `stalker_ids.property_looked_around`.
341
+ */
342
+ public static readonly property_looked_around: 44;
343
+ /**
344
+ * Engine enum value for `stalker_ids.property_looked_out`.
345
+ */
346
+ public static readonly property_looked_out: 19;
347
+ /**
348
+ * Whether object should panic.
349
+ */
350
+ public static readonly property_panic: 17;
351
+ /**
352
+ * Engine enum value for `stalker_ids.property_position_holded`.
353
+ */
354
+ public static readonly property_position_holded: 20;
355
+ /**
356
+ * Engine enum value for `stalker_ids.property_pure_enemy`.
357
+ */
358
+ public static readonly property_pure_enemy: 23;
359
+ /**
360
+ * Whether object has solved zone puzzle.
361
+ * Originally alife was different and it was end goal of each stalker.
362
+ * To solve zone puzzle stalkers collected artefacts, did quests etc.
363
+ */
364
+ public static readonly property_puzzle_solved: 4;
365
+ /**
366
+ * Engine enum value for `stalker_ids.property_ready_to_detour`.
367
+ */
368
+ public static readonly property_ready_to_detour: 14;
369
+ /**
370
+ * Engine enum value for `stalker_ids.property_ready_to_kill`.
371
+ */
372
+ public static readonly property_ready_to_kill: 13;
373
+ /**
374
+ * Engine enum value for `stalker_ids.property_script`.
375
+ */
376
+ public static readonly property_script: 74;
377
+ /**
378
+ * Whether object see enemy.
379
+ */
380
+ public static readonly property_see_enemy: 15;
381
+ /**
382
+ * Engine enum value for `stalker_ids.property_smart_terrain_task`.
383
+ */
384
+ public static readonly property_smart_terrain_task: 5;
385
+ /**
386
+ * Engine enum value for `stalker_ids.property_use_crouch_to_look_out`.
387
+ */
388
+ public static readonly property_use_crouch_to_look_out: 24;
389
+ /**
390
+ * Engine enum value for `stalker_ids.property_use_suddenness`.
391
+ */
392
+ public static readonly property_use_suddenness: 22;
393
+
394
+ /**
395
+ * Engine enum value for `stalker_ids.sound_alarm`.
396
+ */
397
+ public static readonly sound_alarm: 4;
398
+ /**
399
+ * Engine enum value for `stalker_ids.sound_attack_allies_several_enemies`.
400
+ */
401
+ public static readonly sound_attack_allies_several_enemies: 7;
402
+ /**
403
+ * Engine enum value for `stalker_ids.sound_attack_allies_single_enemy`.
404
+ */
405
+ public static readonly sound_attack_allies_single_enemy: 6;
406
+ /**
407
+ * Engine enum value for `stalker_ids.sound_attack_no_allies`.
408
+ */
409
+ public static readonly sound_attack_no_allies: 5;
410
+ /**
411
+ * Engine enum value for `stalker_ids.sound_backup`.
412
+ */
413
+ public static readonly sound_backup: 8;
414
+ /**
415
+ * Engine enum value for `stalker_ids.sound_detour`.
416
+ */
417
+ public static readonly sound_detour: 9;
418
+ /**
419
+ * Engine enum value for `stalker_ids.sound_die`.
420
+ */
421
+ public static readonly sound_die: 0;
422
+ /**
423
+ * Engine enum value for `stalker_ids.sound_die_in_anomaly`.
424
+ */
425
+ public static readonly sound_die_in_anomaly: 1;
426
+ /**
427
+ * Engine enum value for `stalker_ids.sound_enemy_critically_wounded`.
428
+ */
429
+ public static readonly sound_enemy_critically_wounded: 24;
430
+ /**
431
+ * Engine enum value for `stalker_ids.sound_enemy_killed_or_wounded`.
432
+ */
433
+ public static readonly sound_enemy_killed_or_wounded = -805289984;
434
+ /**
435
+ * Engine enum value for `stalker_ids.sound_enemy_lost_no_allies`.
436
+ */
437
+ public static readonly sound_enemy_lost_no_allies: 12;
438
+ /**
439
+ * Engine enum value for `stalker_ids.sound_enemy_lost_with_allies`.
440
+ */
441
+ public static readonly sound_enemy_lost_with_allies: 13;
442
+ /**
443
+ * Engine enum value for `stalker_ids.sound_friendly_grenade_alarm`.
444
+ */
445
+ public static readonly sound_friendly_grenade_alarm: 20;
446
+ /**
447
+ * Engine enum value for `stalker_ids.sound_grenade_alarm`.
448
+ */
449
+ public static readonly sound_grenade_alarm: 19;
450
+ /**
451
+ * Engine enum value for `stalker_ids.sound_humming`.
452
+ */
453
+ public static readonly sound_humming: 3;
454
+ /**
455
+ * Engine enum value for `stalker_ids.sound_injuring`.
456
+ */
457
+ public static readonly sound_injuring: 2;
458
+ /**
459
+ * Engine enum value for `stalker_ids.sound_injuring_by_friend`.
460
+ */
461
+ public static readonly sound_injuring_by_friend: 14;
462
+ /**
463
+ * Engine enum value for `stalker_ids.sound_kill_wounded`.
464
+ */
465
+ public static readonly sound_kill_wounded: 23;
466
+ /**
467
+ * Engine enum value for `stalker_ids.sound_need_backup`.
468
+ */
469
+ public static readonly sound_need_backup: 21;
470
+ /**
471
+ * Engine enum value for `stalker_ids.sound_panic_human`.
472
+ */
473
+ public static readonly sound_panic_human: 15;
474
+ /**
475
+ * Engine enum value for `stalker_ids.sound_panic_monster`.
476
+ */
477
+ public static readonly sound_panic_monster: 16;
478
+ /**
479
+ * Engine enum value for `stalker_ids.sound_running_in_danger`.
480
+ */
481
+ public static readonly sound_running_in_danger: 22;
482
+ /**
483
+ * Engine enum value for `stalker_ids.sound_script`.
484
+ */
485
+ public static readonly sound_script: 27;
486
+ /**
487
+ * Engine enum value for `stalker_ids.sound_search1_no_allies`.
488
+ */
489
+ public static readonly sound_search1_no_allies: 11;
490
+ /**
491
+ * Engine enum value for `stalker_ids.sound_search1_with_allies`.
492
+ */
493
+ public static readonly sound_search1_with_allies: 10;
494
+ /**
495
+ * Engine enum value for `stalker_ids.sound_tolls`.
496
+ */
497
+ public static readonly sound_tolls: 17;
498
+ /**
499
+ * Engine enum value for `stalker_ids.sound_wounded`.
500
+ */
501
+ public static readonly sound_wounded: 18;
502
+
503
+ /**
504
+ * Create an ids constants wrapper.
505
+ */
506
+ public constructor();
507
+ }
508
+
509
+ /**
510
+ * Generic container object for GOAP world properties.
511
+ *
512
+ * @source C++ class world_property
513
+ * @customConstructor world_property
514
+ * @group xr_goap
515
+ */
516
+ export class world_property extends EngineBinding {
517
+ /**
518
+ * Default constructor to describe a pair of identifier and value.
519
+ *
520
+ * @param id - Identifier of unique world property.
521
+ * @param enabled - Value of property state.
522
+ */
523
+ public constructor(id: u32, enabled: boolean);
524
+
525
+ /**
526
+ * @returns Value of current world property.
527
+ */
528
+ public value(): boolean;
529
+
530
+ /**
531
+ * @returns Condition identifier of current world property.
532
+ */
533
+ public condition(): u32;
534
+ }
535
+
536
+ /**
537
+ * World state describing whole world state in action planning.
538
+ *
539
+ * Overrides operators: `<`, `==`.
540
+ *
541
+ * @source C++ class world_state
542
+ * @customConstructor world_state
543
+ * @group xr_goap
544
+ */
545
+ export class world_state extends EngineBinding {
546
+ /**
547
+ * Default constructor.
548
+ */
549
+ public constructor();
550
+
551
+ /**
552
+ * Copy constructor.
553
+ *
554
+ * @param another_state - Target world state to copy.
555
+ */
556
+ public constructor(another_state: world_state);
557
+
558
+ /**
559
+ * Set property for world state.
560
+ *
561
+ * @param property - Target property to add in world state.
562
+ */
563
+ public add_property(property: world_property): void;
564
+
565
+ /**
566
+ * Clear all properties in the state.
567
+ */
568
+ public clear(): void;
569
+
570
+ /**
571
+ * Check if provided state is subset of current one.
572
+ *
573
+ * @param state - Target state to check.
574
+ * @returns Whether current world state includes provided state.
575
+ */
576
+ public includes(state: world_state): boolean;
577
+
578
+ /**
579
+ * Get world property by id.
580
+ *
581
+ * @param id - Numeric if of the required property.
582
+ * @returns Property id/state based on provided id.
583
+ */
584
+ public property(id: u32): world_property;
585
+
586
+ /**
587
+ * Remove world property from current world state.
588
+ *
589
+ * @param id - Identifier of the property to remove.
590
+ */
591
+ public remove_property(id: u32): void;
592
+ }
593
+
594
+ /**
595
+ * Storage of object evaluators cached state for handling of in-game logic.
596
+ * Container for actions.
597
+ *
598
+ * @source C++ class property_storage
599
+ * @customConstructor property_storage
600
+ * @group xr_goap
601
+ */
602
+ export class property_storage extends EngineBinding {
603
+ /**
604
+ * Get property evaluator value by `id`.
605
+ *
606
+ * @throws If property is not declared in storage.
607
+ *
608
+ * @param id - Unique identifier of the world property.
609
+ * @returns Current value for provided `id`.
610
+ */
611
+ public property(id: u32): boolean;
612
+
613
+ /**
614
+ * Set property value in the storage.
615
+ *
616
+ * @param id - Unique identifier of the world property.
617
+ * @param value - Value for provided `id`.
618
+ */
619
+ public set_property(id: u32, value: boolean): void;
620
+ }
621
+
622
+ /**
623
+ * Class implementation of world properties evaluators.
624
+ * Generic handler to calculate current state of bound world property `id`.
625
+ *
626
+ * @source C++ class property_evaluator
627
+ * @customConstructor property_evaluator
628
+ * @group xr_goap
629
+ */
630
+ export class property_evaluator extends EngineBinding {
631
+ /**
632
+ * Linked game object to work with.
633
+ */
634
+ public readonly object: game_object;
635
+
636
+ /**
637
+ * Container reference with state of action preconditions.
638
+ */
639
+ public readonly storage: property_storage;
640
+
641
+ /**
642
+ * Default constructor.
643
+ */
644
+ public constructor();
645
+
646
+ /**
647
+ * @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
648
+ */
649
+ public constructor(object: game_object | null);
650
+
651
+ /**
652
+ * @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
653
+ * @param name - Name of the evaluator, used for debug purposes mainly.
654
+ */
655
+ public constructor(object: game_object | null, name: string);
656
+
657
+ /**
658
+ * Handle setup of the evaluator and binding to a specific object.
659
+ *
660
+ * @remarks
661
+ * Called by the planner when the evaluator is registered. Call it manually only for standalone evaluator tests.
662
+ *
663
+ * @param object - Target client object to work with.
664
+ * @param storage - Action instance storage with preconditions and state.
665
+ */
666
+ public setup(object: game_object, storage: property_storage): void;
667
+
668
+ /**
669
+ * Main evaluator lifecycle method.
670
+ * Called every time to get world property up-to-date state.
671
+ *
672
+ * @returns Current evaluator value.
673
+ */
674
+ public evaluate(): boolean;
675
+ }
676
+
677
+ /**
678
+ * Class implementation of world properties evaluators.
679
+ * Static handler to return pre-defined value for specific world property `id`.
680
+ *
681
+ * @source C++ class property_evaluator_const : property_evaluator
682
+ * @customConstructor property_evaluator_const
683
+ * @group xr_goap
684
+ */
685
+ export class property_evaluator_const extends property_evaluator {
686
+ /**
687
+ * @param value - Constant value for evaluation.
688
+ */
689
+ public constructor(value: boolean);
690
+ }
691
+
692
+ /**
693
+ * Abstract class for implementation of GOAP planner actions.
694
+ *
695
+ * @source C++ class action_base
696
+ * @customConstructor action_base
697
+ * @group xr_goap
698
+ */
699
+ export abstract class action_base extends EngineBinding {
700
+ /**
701
+ * Game object that is handled by current action instance.
702
+ */
703
+ public readonly object: game_object;
704
+
705
+ /**
706
+ * Container reference with state of action preconditions.
707
+ */
708
+ public readonly storage: property_storage;
709
+
710
+ /**
711
+ * Default constructor.
712
+ */
713
+ public constructor();
714
+
715
+ /**
716
+ * @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
717
+ */
718
+ public constructor(object?: game_object | null);
719
+
720
+ /**
721
+ * @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
722
+ * @param name - Name of the action, used for debug purposes mainly.
723
+ */
724
+ public constructor(object: game_object | null, name: string);
725
+
726
+ /**
727
+ * Handle setup of the action and binding to a specific object.
728
+ *
729
+ * @remarks
730
+ * Called by the planner when the action is registered. Call it manually only for standalone action tests.
731
+ *
732
+ * @param object - Target client object to work with.
733
+ * @param storage - Action instance storage with preconditions and state.
734
+ */
735
+ public setup(object: game_object, storage: property_storage): void;
736
+
737
+ /**
738
+ * Lifecycle method called once on action execution start.
739
+ * Means that lifecycle of the action begun.
740
+ *
741
+ * @remarks
742
+ * Called by the owning planner. Direct calls are only useful when driving an action manually in tests or tools.
743
+ */
744
+ public initialize(): void;
745
+
746
+ /**
747
+ * Lifecycle method.
748
+ * Execution tick of the action, called from object logics update cycle when current action is active.
749
+ *
750
+ * @remarks
751
+ * Called by the owning planner after `initialize`. Direct calls bypass planner state.
752
+ */
753
+ public execute(): void;
754
+
755
+ /**
756
+ * Lifecycle method called once on action execution stop.
757
+ * Means that action is finished / preconditions are not met anymore.
758
+ *
759
+ * @remarks
760
+ * Called by the owning planner. Direct calls are only useful when driving an action manually in tests or tools.
761
+ */
762
+ public finalize(): void;
763
+
764
+ /**
765
+ * Set weight of current action execution.
766
+ *
767
+ * @param weight - Weight value to express how prioritized action is.
768
+ */
769
+ public set_weight(weight: u16): void;
770
+
771
+ /**
772
+ * Add action effect.
773
+ * Describes what target world state is expected to be if action is completed.
774
+ *
775
+ * @remarks
776
+ * Do not mutate effects while the owner planner is updating; the engine asserts on graph changes during solving.
777
+ *
778
+ * @param property - World state property describing a pair of evaluator ID and value.
779
+ */
780
+ public add_effect(property: world_property): void;
781
+
782
+ /**
783
+ * Remove action effect.
784
+ * Action will be not considered as property changing for `id` anymore.
785
+ *
786
+ * @remarks
787
+ * Do not mutate effects while the owner planner is updating; the engine asserts on graph changes during solving.
788
+ *
789
+ * @param id - World state property id.
790
+ */
791
+ public remove_effect(id: u32): void;
792
+
793
+ /**
794
+ * Add action execution precondition.
795
+ * When building logics graph, action will be considered blocked by some preconditions.
796
+ *
797
+ * @remarks
798
+ * Do not mutate preconditions while the owner planner is updating; the engine asserts on graph changes during
799
+ * solving.
800
+ *
801
+ * @param property - World state property describing a pair of evaluator ID and value.
802
+ */
803
+ public add_precondition(property: world_property): void;
804
+
805
+ /**
806
+ * Remove precondition for action.
807
+ * When building logics graph, action will not be considered blocked by evaluator `id` states.
808
+ *
809
+ * @remarks
810
+ * Do not mutate preconditions while the owner planner is updating; the engine asserts on graph changes during
811
+ * solving.
812
+ *
813
+ * @param id - World state property id.
814
+ */
815
+ public remove_precondition(id: u32): void;
816
+
817
+ /**
818
+ * Debug method.
819
+ * With mixed / debug build allows investigation of evaluators and actions matches.
820
+ * Helps to debug custom actions and actions pre-conditions with state printing in log files.
821
+ *
822
+ * Note: Available only in mixed / debug engine builds, not for direct usage from lua.
823
+ *
824
+ * @param prefix - String prefix to display current action state in logs.
825
+ */
826
+ public show(prefix?: string): void;
827
+ }
828
+
829
+ /**
830
+ * Script action planner binding for GOAP evaluators and actions.
831
+ *
832
+ * @source C++ class action_planner
833
+ * @customConstructor action_planner
834
+ * @group xr_goap
835
+ */
836
+ export class action_planner extends EngineBinding {
837
+ /**
838
+ * Game object that is handled by current planner instance.
839
+ */
840
+ public readonly object: game_object;
841
+
842
+ /**
843
+ * Container reference with state of planner preconditions.
844
+ */
845
+ public readonly storage: property_storage;
846
+
847
+ /**
848
+ * Default constructor.
849
+ */
850
+ public constructor();
851
+
852
+ /**
853
+ * @returns Whether object action planner is already initialized.
854
+ */
855
+ public initialized(): boolean;
856
+
857
+ /**
858
+ * @returns Whether state of current planner is actual.
859
+ */
860
+ public actual(): boolean;
861
+
862
+ /**
863
+ * Setup planner for game object.
864
+ *
865
+ * @throws If `object` is missing.
866
+ *
867
+ * @param object - Client game object to setup planner for.
868
+ */
869
+ public setup(object: game_object): void;
870
+
871
+ /**
872
+ * Clear state of current action planner.
873
+ */
874
+ public clear(): void;
875
+
876
+ /**
877
+ * Lifecycle method to handle generic game loop updates.
878
+ *
879
+ * @throws If the planner cannot build a non-empty action sequence to the target world state.
880
+ */
881
+ public update(): void;
882
+
883
+ /**
884
+ * Add generic action by `id` for planner execution.
885
+ *
886
+ * @remarks
887
+ * Do not add actions from evaluator/action callbacks running inside `update`; the engine asserts on planner graph
888
+ * changes during solving.
889
+ *
890
+ * @param id - Unique identifier of new action.
891
+ * @param action - Action implementation containing preconditions, logics, effects and other meta infos.
892
+ */
893
+ public add_action(id: u32, action: action_base): void;
894
+
895
+ /**
896
+ * Remove action by unique `id`.
897
+ *
898
+ * @remarks
899
+ * Do not remove actions from evaluator/action callbacks running inside `update`; the engine asserts on planner
900
+ * graph changes during solving.
901
+ *
902
+ * @param id - Unique identifier of the action to remove.
903
+ */
904
+ public remove_action(id: u32): void;
905
+
906
+ /**
907
+ * Get action instance by unique `id`.
908
+ *
909
+ * @param id - Unique identifier of the action to get.
910
+ * @returns Registered action instance.
911
+ */
912
+ public action(id: u32): action_base;
913
+
914
+ /**
915
+ * Get currently active action being executed.
916
+ *
917
+ * @remarks
918
+ * Requires the planner to be initialized, usually after a successful `update`.
919
+ *
920
+ * @returns Current action instance reference.
921
+ */
922
+ public current_action(): action_base;
923
+
924
+ /**
925
+ * Get currently active action identifier.
926
+ *
927
+ * @throws If the planner is not initialized yet.
928
+ *
929
+ * @returns Unique identifier of current action.
930
+ */
931
+ public current_action_id(): u32;
932
+
933
+ /**
934
+ * Set target world state to try to reach with all the graph logics.
935
+ * All graphs will be built from current state to goal world state with the shortest possible path.
936
+ *
937
+ * @param state - Target world state to reach with planner.
938
+ */
939
+ public set_goal_world_state(state: world_state): void;
940
+
941
+ /**
942
+ * Add evaluator instance for current action planner.
943
+ *
944
+ * @remarks
945
+ * Do not add evaluators from evaluator/action callbacks running inside `update`; the engine asserts on planner
946
+ * graph changes during solving.
947
+ *
948
+ * @param id - Unique identifier of the evaluator.
949
+ * @param evaluator - Instance of evaluator linked to the `id`.
950
+ */
951
+ public add_evaluator(id: u32, evaluator: property_evaluator): void;
952
+
953
+ /**
954
+ * Remove evaluator instance from current action planner.
955
+ *
956
+ * @remarks
957
+ * Do not remove evaluators from evaluator/action callbacks running inside `update`; the engine asserts on planner
958
+ * graph changes during solving.
959
+ *
960
+ * @param id - Unique identifier of the evaluator for removal.
961
+ */
962
+ public remove_evaluator(id: u32): void;
963
+
964
+ /**
965
+ * Get evaluator instance by `id`.
966
+ *
967
+ * @param id - Unique identifier of the evaluator to get.
968
+ * @returns Registered property evaluator.
969
+ */
970
+ public evaluator(id: u32): property_evaluator;
971
+
972
+ /**
973
+ * Debug method.
974
+ * With mixed / debug build allows investigation of evaluators and actions matches.
975
+ * Helps to debug custom actions and actions pre-conditions with state printing in log files.
976
+ *
977
+ * Note: Available only in mixed / debug engine builds, not for direct usage from lua.
978
+ *
979
+ * @param prefix - String prefix to display current action state in logs.
980
+ */
981
+ public show(prefix: string): void;
982
+ }
983
+
984
+ /**
985
+ * GOAP action class implementing both action base and action planner.
986
+ * Captures execution as action and plans its internal logic with separate logics graph.
987
+ *
988
+ * Examples: combat planner, anomaly planner, items looting planner, alife planner, state planner.
989
+ *
990
+ * @source C++ class planner_action : action_planner,action_base
991
+ * @customConstructor planner_action
992
+ * @group xr_goap
993
+ */
994
+ export class planner_action extends action_planner {
995
+ /**
996
+ * Default constructor.
997
+ */
998
+ public constructor();
999
+
1000
+ /**
1001
+ * @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
1002
+ */
1003
+ public constructor(object?: game_object | null);
1004
+
1005
+ /**
1006
+ * @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
1007
+ * @param name - Name of the action, used for debug purposes mainly.
1008
+ */
1009
+ public constructor(object: game_object | null, name: string);
1010
+
1011
+ /**
1012
+ * Lifecycle method called once on action execution start.
1013
+ * Means that lifecycle of the action begun.
1014
+ *
1015
+ * @remarks
1016
+ * Called by the owning outer planner. Direct calls are only useful when driving the planner action manually in
1017
+ * tests or tools.
1018
+ */
1019
+ public initialize(): void;
1020
+
1021
+ /**
1022
+ * Lifecycle method called once on action execution stop.
1023
+ * Means that action is finished / preconditions are not met anymore.
1024
+ *
1025
+ * @remarks
1026
+ * Called by the owning outer planner. Direct calls are only useful when driving the planner action manually in
1027
+ * tests or tools.
1028
+ */
1029
+ public finalize(): void;
1030
+
1031
+ /**
1032
+ * Lifecycle method.
1033
+ * Execution tick of the action, called from object logics update cycle when current action is active.
1034
+ *
1035
+ * @remarks
1036
+ * Called by the owning outer planner after `initialize`. Direct calls bypass planner state.
1037
+ */
1038
+ public execute(): void;
1039
+
1040
+ /**
1041
+ * Add action effect.
1042
+ * Describes what target world state is expected to be if action is completed.
1043
+ *
1044
+ * @remarks
1045
+ * Do not mutate effects while the owner planner is updating; the engine asserts on graph changes during solving.
1046
+ *
1047
+ * @param property - World state property describing a pair of evaluator ID and value.
1048
+ */
1049
+ public add_effect(property: world_property): void;
1050
+
1051
+ /**
1052
+ * Remove action effect.
1053
+ * Action will be not considered as property changing for `id` anymore.
1054
+ *
1055
+ * @remarks
1056
+ * Do not mutate effects while the owner planner is updating; the engine asserts on graph changes during solving.
1057
+ *
1058
+ * @param id - World state property id.
1059
+ */
1060
+ public remove_effect(id: u32): void;
1061
+
1062
+ /**
1063
+ * Add action execution precondition.
1064
+ * When building logics graph, action will be considered blocked by some preconditions.
1065
+ *
1066
+ * @remarks
1067
+ * Do not mutate preconditions while the owner planner is updating; the engine asserts on graph changes during
1068
+ * solving.
1069
+ *
1070
+ * @param property - World state property describing a pair of evaluator ID and value.
1071
+ */
1072
+ public add_precondition(property: world_property): void;
1073
+
1074
+ /**
1075
+ * Remove precondition for action.
1076
+ * When building logics graph, action will not be considered blocked by evaluator `id` states.
1077
+ *
1078
+ * @remarks
1079
+ * Do not mutate preconditions while the owner planner is updating; the engine asserts on graph changes during
1080
+ * solving.
1081
+ *
1082
+ * @param id - World state property id.
1083
+ */
1084
+ public remove_precondition(id: u32): void;
1085
+
1086
+ /**
1087
+ * Set weight of planner action switch.
1088
+ *
1089
+ * @param weight - Weight value to express how prioritized action is.
1090
+ */
1091
+ public set_weight(weight: u32): void;
1092
+
1093
+ /**
1094
+ * Comparator to check weight of switching one state to another.
1095
+ *
1096
+ * @param first - First state.
1097
+ * @param second - Second state.
1098
+ * @returns Transition weight.
1099
+ */
1100
+ public weight(first: world_state, second: world_state): u16;
1101
+ }
1102
+
1103
+ /**
1104
+ * Cast a base action to an action planner when it is implemented as a planner action.
1105
+ *
1106
+ * @group xr_global_declaration
1107
+ *
1108
+ * @remarks
1109
+ * Returns the planner interface only for actions implemented by `planner_action`; other action instances are not
1110
+ * planner-backed.
1111
+ *
1112
+ * @param base_action - Action to cast.
1113
+ * @returns Planner interface for the action, or `null` when the action is not planner-backed.
1114
+ */
1115
+ export function cast_planner(this: void, base_action: action_base): action_planner;
1116
+ }