xray16 1.5.3 → 1.6.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.
- package/README.md +6 -0
- package/package.json +1 -1
- package/plugins/optimize_return_ternary.d.ts +6 -0
- package/plugins/optimize_return_ternary.js +65 -0
- package/types/internal.d.ts +6 -0
- package/types/xr_ai/xr_action.d.ts +2 -1
- package/types/xr_ai/xr_alife.d.ts +6 -4
- package/types/xr_ai/xr_goap.d.ts +8 -6
- package/types/xr_ai/xr_memory.d.ts +4 -2
- package/types/xr_lib/xr_debug.d.ts +4 -2
- package/types/xr_lib/xr_fs.d.ts +9 -7
- package/types/xr_lib/xr_game.d.ts +4 -4
- package/types/xr_lib/xr_hit.d.ts +3 -1
- package/types/xr_lib/xr_ini.d.ts +4 -2
- package/types/xr_lib/xr_level.d.ts +5 -3
- package/types/xr_lib/xr_map.d.ts +3 -1
- package/types/xr_lib/xr_multiplayer.d.ts +5 -3
- package/types/xr_lib/xr_properties.d.ts +3 -1
- package/types/xr_lib/xr_save.d.ts +3 -1
- package/types/xr_lib/xr_sound.d.ts +9 -7
- package/types/xr_lib/xr_stats.ts +3 -1
- package/types/xr_lib/xr_task.d.ts +3 -1
- package/types/xr_lib/xr_type.d.ts +0 -5
- package/types/xr_object/client/xr_level.d.ts +3 -1
- package/types/xr_object/script/xr_script_interface.d.ts +518 -195
- package/types/xr_object/script/xr_script_object.d.ts +46 -63
- package/types/xr_object/server/xr_server_object.d.ts +5 -3
- package/types/xr_ui/xr_ui_core.d.ts +33 -31
- package/types/xr_ui/xr_ui_interface.d.ts +18 -16
- package/types/xr_ui/xr_ui_menu.d.ts +20 -4
- package/types/xrf_plugin.d.ts +3 -1
package/README.md
CHANGED
|
@@ -61,6 +61,7 @@ Plugins can be included in [tstl tsconfig](https://typescripttolua.github.io/doc
|
|
|
61
61
|
{ "name": "xray16/plugins/strip_lua_logger" },
|
|
62
62
|
{ "name": "xray16/plugins/inject_filename" },
|
|
63
63
|
{ "name": "xray16/plugins/from_cast_utils" },
|
|
64
|
+
{ "name": "xray16/plugins/optimize_return_ternary" },
|
|
64
65
|
{ "name": "xray16/plugins/inject_tracy_zones" }
|
|
65
66
|
]
|
|
66
67
|
}
|
|
@@ -106,6 +107,11 @@ Lua does not provide convenient API do get filename in runtime and static step i
|
|
|
106
107
|
Plugin to simplify casting from `LuaTable` to typescript array/map objects.\
|
|
107
108
|
All the calls are completely gets stripped and removed from runtime.
|
|
108
109
|
|
|
110
|
+
### optimize_return_ternary
|
|
111
|
+
|
|
112
|
+
Plugin rewrites returned ternary expressions into direct `if` / `else` branch returns when it is safe.\
|
|
113
|
+
This avoids temporary result locals for patterns like `return condition ? first : second` while preserving general ternary semantics.
|
|
114
|
+
|
|
109
115
|
### inject_tracy_zones
|
|
110
116
|
|
|
111
117
|
Plugin designed to work specifically with [tracy profiler](https://github.com/wolfpld/tracy).\
|
package/package.json
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ts = require("typescript");
|
|
4
|
+
const lua = require("typescript-to-lua");
|
|
5
|
+
const assignment_validation_1 = require("typescript-to-lua/dist/transformation/utils/assignment-validation");
|
|
6
|
+
const preceding_statements_1 = require("typescript-to-lua/dist/transformation/utils/preceding-statements");
|
|
7
|
+
const conditional_1 = require("typescript-to-lua/dist/transformation/visitors/conditional");
|
|
8
|
+
const multi_1 = require("typescript-to-lua/dist/transformation/visitors/language-extensions/multi");
|
|
9
|
+
const return_1 = require("typescript-to-lua/dist/transformation/visitors/return");
|
|
10
|
+
function getConditionalExpression(expression) {
|
|
11
|
+
let current = expression;
|
|
12
|
+
while (ts.isParenthesizedExpression(current) ||
|
|
13
|
+
ts.isAsExpression(current) ||
|
|
14
|
+
ts.isTypeAssertionExpression(current) ||
|
|
15
|
+
ts.isNonNullExpression(current) ||
|
|
16
|
+
ts.isSatisfiesExpression(current)) {
|
|
17
|
+
current = current.expression;
|
|
18
|
+
}
|
|
19
|
+
return ts.isConditionalExpression(current) ? current : null;
|
|
20
|
+
}
|
|
21
|
+
function hasMultiReturnBranch(context, expression) {
|
|
22
|
+
return ((0, multi_1.isMultiReturnType)(context.checker.getTypeAtLocation(expression.whenTrue)) ||
|
|
23
|
+
(0, multi_1.isMultiReturnType)(context.checker.getTypeAtLocation(expression.whenFalse)));
|
|
24
|
+
}
|
|
25
|
+
function transformExpressionToReturnStatements(context, statement, expression) {
|
|
26
|
+
const conditionalExpression = getConditionalExpression(expression);
|
|
27
|
+
if (conditionalExpression !== null && !hasMultiReturnBranch(context, conditionalExpression)) {
|
|
28
|
+
return transformConditionalReturnStatement(context, statement, conditionalExpression);
|
|
29
|
+
}
|
|
30
|
+
const value = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(expression));
|
|
31
|
+
return [...value.precedingStatements, (0, return_1.createReturnStatement)(context, [value.result], statement)];
|
|
32
|
+
}
|
|
33
|
+
function transformConditionalReturnStatement(context, statement, expression) {
|
|
34
|
+
(0, conditional_1.checkOnlyTruthyCondition)(expression.condition, context);
|
|
35
|
+
const condition = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(expression.condition));
|
|
36
|
+
const whenTrue = transformExpressionToReturnStatements(context, statement, expression.whenTrue);
|
|
37
|
+
const whenFalse = transformExpressionToReturnStatements(context, statement, expression.whenFalse);
|
|
38
|
+
return [
|
|
39
|
+
...condition.precedingStatements,
|
|
40
|
+
lua.createIfStatement(condition.result, lua.createBlock(whenTrue), lua.createBlock(whenFalse), expression),
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Plugin that rewrites returned ternary expressions as direct branch returns.
|
|
45
|
+
*/
|
|
46
|
+
const plugin = {
|
|
47
|
+
visitors: {
|
|
48
|
+
[ts.SyntaxKind.ReturnStatement]: (statement, context) => {
|
|
49
|
+
if (statement.expression === undefined) {
|
|
50
|
+
return context.superTransformStatements(statement);
|
|
51
|
+
}
|
|
52
|
+
const expression = getConditionalExpression(statement.expression);
|
|
53
|
+
if (expression === null || hasMultiReturnBranch(context, expression)) {
|
|
54
|
+
return context.superTransformStatements(statement);
|
|
55
|
+
}
|
|
56
|
+
const expressionType = context.checker.getTypeAtLocation(statement.expression);
|
|
57
|
+
const returnType = context.checker.getContextualType(statement.expression);
|
|
58
|
+
if (returnType !== undefined) {
|
|
59
|
+
(0, assignment_validation_1.validateAssignment)(context, statement, expressionType, returnType);
|
|
60
|
+
}
|
|
61
|
+
return transformConditionalReturnStatement(context, statement, expression);
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
exports.default = plugin;
|
|
@@ -818,9 +818,10 @@ declare module "xray16" {
|
|
|
818
818
|
export class patrol extends EngineBinding {
|
|
819
819
|
/**
|
|
820
820
|
* Engine enum value for `patrol.stop`.
|
|
821
|
+
*
|
|
822
|
+
* @source `src/xrAICore/Navigation/PatrolPath/patrol_path_params_script.cpp`, route stop enum.
|
|
821
823
|
*/
|
|
822
824
|
public static readonly stop: 0;
|
|
823
|
-
// Public static readonly stop: 1;
|
|
824
825
|
|
|
825
826
|
/**
|
|
826
827
|
* Engine enum value for `patrol.start`.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable, Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Access point for ALife simulation objects and registries.
|
|
@@ -123,7 +125,7 @@ declare module "xray16" {
|
|
|
123
125
|
* @param object - Object to remove.
|
|
124
126
|
* @param flag - Compatibility flag accepted by the engine binding.
|
|
125
127
|
*/
|
|
126
|
-
public release(object: cse_alife_object
|
|
128
|
+
public release(object: Nillable<cse_alife_object>, flag: boolean): void;
|
|
127
129
|
|
|
128
130
|
/**
|
|
129
131
|
* Remove all restrictions of one type from an object.
|
|
@@ -212,7 +214,7 @@ declare module "xray16" {
|
|
|
212
214
|
* @param storyId - Story id.
|
|
213
215
|
* @returns Matching server object, or `null` when it is not registered.
|
|
214
216
|
*/
|
|
215
|
-
public story_object(storyId: u32): cse_alife_object
|
|
217
|
+
public story_object(storyId: u32): Nullable<cse_alife_object>;
|
|
216
218
|
|
|
217
219
|
/**
|
|
218
220
|
* @returns Alife server-client switch distance.
|
|
@@ -287,7 +289,7 @@ declare module "xray16" {
|
|
|
287
289
|
* @param no_assert - Return `null` instead of asserting when the object is missing.
|
|
288
290
|
* @returns Matching server object, or `null`.
|
|
289
291
|
*/
|
|
290
|
-
public object<T extends cse_alife_object = cse_alife_object>(object_id: u16, no_assert?: boolean): T
|
|
292
|
+
public object<T extends cse_alife_object = cse_alife_object>(object_id: u16, no_assert?: boolean): Nullable<T>;
|
|
291
293
|
|
|
292
294
|
/**
|
|
293
295
|
* Get a server object by its engine replacement name.
|
|
@@ -295,7 +297,7 @@ declare module "xray16" {
|
|
|
295
297
|
* @param name - Server object replacement name.
|
|
296
298
|
* @returns Matching server object, or `null`.
|
|
297
299
|
*/
|
|
298
|
-
public object<T extends cse_alife_object = cse_alife_object>(name: string): T
|
|
300
|
+
public object<T extends cse_alife_object = cse_alife_object>(name: string): Nullable<T>;
|
|
299
301
|
|
|
300
302
|
/**
|
|
301
303
|
* Create an object from a spawn graph id.
|
package/types/xr_ai/xr_goap.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* GOAP property and action id constants for stalker AI.
|
|
@@ -646,13 +648,13 @@ declare module "xray16" {
|
|
|
646
648
|
/**
|
|
647
649
|
* @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
|
|
648
650
|
*/
|
|
649
|
-
public constructor(object: game_object
|
|
651
|
+
public constructor(object: Nillable<game_object>);
|
|
650
652
|
|
|
651
653
|
/**
|
|
652
654
|
* @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
|
|
653
655
|
* @param name - Name of the evaluator, used for debug purposes mainly.
|
|
654
656
|
*/
|
|
655
|
-
public constructor(object: game_object
|
|
657
|
+
public constructor(object: Nillable<game_object>, name: string);
|
|
656
658
|
|
|
657
659
|
/**
|
|
658
660
|
* Handle setup of the evaluator and binding to a specific object.
|
|
@@ -715,13 +717,13 @@ declare module "xray16" {
|
|
|
715
717
|
/**
|
|
716
718
|
* @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
|
|
717
719
|
*/
|
|
718
|
-
public constructor(object?: game_object
|
|
720
|
+
public constructor(object?: Nillable<game_object>);
|
|
719
721
|
|
|
720
722
|
/**
|
|
721
723
|
* @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
|
|
722
724
|
* @param name - Name of the action, used for debug purposes mainly.
|
|
723
725
|
*/
|
|
724
|
-
public constructor(object: game_object
|
|
726
|
+
public constructor(object: Nillable<game_object>, name: string);
|
|
725
727
|
|
|
726
728
|
/**
|
|
727
729
|
* Handle setup of the action and binding to a specific object.
|
|
@@ -1000,13 +1002,13 @@ declare module "xray16" {
|
|
|
1000
1002
|
/**
|
|
1001
1003
|
* @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
|
|
1002
1004
|
*/
|
|
1003
|
-
public constructor(object?: game_object
|
|
1005
|
+
public constructor(object?: Nillable<game_object>);
|
|
1004
1006
|
|
|
1005
1007
|
/**
|
|
1006
1008
|
* @param object - Target game object to work with, `null` is OK since correct object will be injected on setup.
|
|
1007
1009
|
* @param name - Name of the action, used for debug purposes mainly.
|
|
1008
1010
|
*/
|
|
1009
|
-
public constructor(object: game_object
|
|
1011
|
+
public constructor(object: Nillable<game_object>, name: string);
|
|
1010
1012
|
|
|
1011
1013
|
/**
|
|
1012
1014
|
* Lifecycle method called once on action execution start.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Base memory record with timing information.
|
|
@@ -352,7 +354,7 @@ declare module "xray16" {
|
|
|
352
354
|
*
|
|
353
355
|
* @returns Source object, or `null` when the source is not a game object.
|
|
354
356
|
*/
|
|
355
|
-
public object(): game_object
|
|
357
|
+
public object(): Nullable<game_object>;
|
|
356
358
|
|
|
357
359
|
/**
|
|
358
360
|
* @returns How the danger was perceived.
|
|
@@ -367,7 +369,7 @@ declare module "xray16" {
|
|
|
367
369
|
*
|
|
368
370
|
* @returns Dependent object, or `null` when there is none.
|
|
369
371
|
*/
|
|
370
|
-
public dependent_object(): game_object
|
|
372
|
+
public dependent_object(): Nullable<game_object>;
|
|
371
373
|
}
|
|
372
374
|
|
|
373
375
|
/**
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Engine console interface.
|
|
@@ -97,7 +99,7 @@ declare module "xray16" {
|
|
|
97
99
|
* @param key - Console variable name.
|
|
98
100
|
* @returns String value.
|
|
99
101
|
*/
|
|
100
|
-
public get_string(key: string): string
|
|
102
|
+
public get_string(key: string): Nullable<string>;
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
105
|
* Read console variable token text.
|
|
@@ -108,7 +110,7 @@ declare module "xray16" {
|
|
|
108
110
|
* @param key - Console variable name.
|
|
109
111
|
* @returns Token text.
|
|
110
112
|
*/
|
|
111
|
-
public get_token(key: string): string
|
|
113
|
+
public get_token(key: string): Nullable<string>;
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
/**
|
package/types/xr_lib/xr_fs.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable, Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* File list returned by the engine filesystem.
|
|
@@ -437,7 +439,7 @@ declare module "xray16" {
|
|
|
437
439
|
* @param fs_type - Filesystem source to search.
|
|
438
440
|
* @returns File status.
|
|
439
441
|
*/
|
|
440
|
-
public exist(alias: string, filename: string, fs_type: TXR_fs_type): FileStatus
|
|
442
|
+
public exist(alias: string, filename: string, fs_type: TXR_fs_type): Nullable<FileStatus>;
|
|
441
443
|
|
|
442
444
|
/**
|
|
443
445
|
* Check whether a file exists below a path alias.
|
|
@@ -449,7 +451,7 @@ declare module "xray16" {
|
|
|
449
451
|
* @param filename - File name.
|
|
450
452
|
* @returns File descriptor pointer or `null`.
|
|
451
453
|
*/
|
|
452
|
-
public exist(alias: string, filename: string): i32
|
|
454
|
+
public exist(alias: string, filename: string): Nullable<i32>;
|
|
453
455
|
|
|
454
456
|
/**
|
|
455
457
|
* Check whether a file exists.
|
|
@@ -460,7 +462,7 @@ declare module "xray16" {
|
|
|
460
462
|
* @param path - File path.
|
|
461
463
|
* @returns File descriptor pointer or `null`.
|
|
462
464
|
*/
|
|
463
|
-
public exist(path: string): i32
|
|
465
|
+
public exist(path: string): Nullable<i32>;
|
|
464
466
|
|
|
465
467
|
/**
|
|
466
468
|
* Check whether a file exists.
|
|
@@ -472,7 +474,7 @@ declare module "xray16" {
|
|
|
472
474
|
* @param fs_type - Filesystem source to search.
|
|
473
475
|
* @returns File status.
|
|
474
476
|
*/
|
|
475
|
-
public exist(path: string, fs_type: TXR_fs_type): FileStatus
|
|
477
|
+
public exist(path: string, fs_type: TXR_fs_type): Nullable<FileStatus>;
|
|
476
478
|
|
|
477
479
|
/**
|
|
478
480
|
* Add a path alias.
|
|
@@ -562,7 +564,7 @@ declare module "xray16" {
|
|
|
562
564
|
*
|
|
563
565
|
* @param writer - Writer returned by `w_open`.
|
|
564
566
|
*/
|
|
565
|
-
public w_close(writer: IWriter
|
|
567
|
+
public w_close(writer: Nillable<IWriter>): void;
|
|
566
568
|
|
|
567
569
|
/**
|
|
568
570
|
* Open a binary writer below a path alias.
|
|
@@ -574,7 +576,7 @@ declare module "xray16" {
|
|
|
574
576
|
* @param filename - Relative file path.
|
|
575
577
|
* @returns Binary writer, or `null`.
|
|
576
578
|
*/
|
|
577
|
-
public w_open(path: string, filename: string): IWriter
|
|
579
|
+
public w_open(path: string, filename: string): Nullable<IWriter>;
|
|
578
580
|
|
|
579
581
|
/**
|
|
580
582
|
* Open a binary writer.
|
|
@@ -585,7 +587,7 @@ declare module "xray16" {
|
|
|
585
587
|
* @param path - File path.
|
|
586
588
|
* @returns Binary writer, or `null`.
|
|
587
589
|
*/
|
|
588
|
-
public w_open(path: string): IWriter
|
|
590
|
+
public w_open(path: string): Nullable<IWriter>;
|
|
589
591
|
}
|
|
590
592
|
|
|
591
593
|
/**
|
|
@@ -59,26 +59,26 @@ declare module "xray16" {
|
|
|
59
59
|
*/
|
|
60
60
|
public static readonly GAME_DEATHMATCH: 2;
|
|
61
61
|
|
|
62
|
-
// GAME_CTF = 3,
|
|
63
|
-
// GAME_ASSAULT = 4, // Team1 - assaulting, Team0 - Defending
|
|
64
|
-
|
|
65
62
|
/**
|
|
66
63
|
* Engine enum value for `GAME_TYPE.GAME_CS`.
|
|
67
64
|
*/
|
|
68
65
|
public static readonly GAME_CS: 5;
|
|
66
|
+
|
|
69
67
|
/**
|
|
70
68
|
* Engine enum value for `GAME_TYPE.GAME_TEAMDEATHMATCH`.
|
|
71
69
|
*/
|
|
72
70
|
public static readonly GAME_TEAMDEATHMATCH: 6;
|
|
71
|
+
|
|
73
72
|
/**
|
|
74
73
|
* Engine enum value for `GAME_TYPE.GAME_ARTEFACTHUNT`.
|
|
75
74
|
*/
|
|
76
75
|
public static readonly GAME_ARTEFACTHUNT: 7;
|
|
76
|
+
|
|
77
77
|
/**
|
|
78
78
|
* Engine enum value for `GAME_TYPE.GAME_CAPTURETHEARTEFACT`.
|
|
79
79
|
*/
|
|
80
80
|
public static readonly GAME_CAPTURETHEARTEFACT: 8;
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
/**
|
|
83
83
|
* Engine enum value for `GAME_TYPE.GAME_DUMMY`.
|
|
84
84
|
*/
|
package/types/xr_lib/xr_hit.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Hit packet that can be sent to game objects.
|
|
@@ -70,7 +72,7 @@ declare module "xray16" {
|
|
|
70
72
|
* @remarks
|
|
71
73
|
* Leave `null` for world or scripted damage that should not be attributed to a game object.
|
|
72
74
|
*/
|
|
73
|
-
public draftsman: game_object
|
|
75
|
+
public draftsman: Nullable<game_object>;
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
78
|
* Physics impulse applied with the hit.
|
package/types/xr_lib/xr_ini.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* LTX/INI file reader and writer.
|
|
@@ -74,7 +76,7 @@ declare module "xray16" {
|
|
|
74
76
|
* @param section - Section name.
|
|
75
77
|
* @returns Whether the section exists.
|
|
76
78
|
*/
|
|
77
|
-
public section_exist(section: string
|
|
79
|
+
public section_exist(section: Nillable<string>): boolean;
|
|
78
80
|
|
|
79
81
|
/**
|
|
80
82
|
* Read a floating-point value.
|
|
@@ -198,7 +200,7 @@ declare module "xray16" {
|
|
|
198
200
|
* @param field - Section field to check.
|
|
199
201
|
* @returns Whether line exists.
|
|
200
202
|
*/
|
|
201
|
-
public line_exist(section: string
|
|
203
|
+
public line_exist(section: Nillable<string>, field: string): boolean;
|
|
202
204
|
|
|
203
205
|
/**
|
|
204
206
|
* Write a 2D vector value.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable, Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Global helpers for the currently loaded level.
|
|
@@ -243,7 +245,7 @@ declare module "xray16" {
|
|
|
243
245
|
*
|
|
244
246
|
* @returns Target object, or `null` when nothing is targeted.
|
|
245
247
|
*/
|
|
246
|
-
get_target_obj(this: void): game_object
|
|
248
|
+
get_target_obj(this: void): Nullable<game_object>;
|
|
247
249
|
|
|
248
250
|
/**
|
|
249
251
|
* Get current game day count.
|
|
@@ -437,7 +439,7 @@ declare module "xray16" {
|
|
|
437
439
|
* @param object_id - Game object id.
|
|
438
440
|
* @returns Matching object, or `null` when it is not online.
|
|
439
441
|
*/
|
|
440
|
-
object_by_id(this: void, object_id: u16): game_object
|
|
442
|
+
object_by_id(this: void, object_id: u16): Nullable<game_object>;
|
|
441
443
|
|
|
442
444
|
/**
|
|
443
445
|
* Check whether a patrol path exists on this level.
|
|
@@ -782,7 +784,7 @@ declare module "xray16" {
|
|
|
782
784
|
range: f32,
|
|
783
785
|
target: unknown,
|
|
784
786
|
result: unknown,
|
|
785
|
-
ignore_object: game_object
|
|
787
|
+
ignore_object: Nillable<game_object>
|
|
786
788
|
): boolean;
|
|
787
789
|
}
|
|
788
790
|
|
package/types/xr_lib/xr_map.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Manages active PDA/minimap locations.
|
|
@@ -95,7 +97,7 @@ declare module "xray16" {
|
|
|
95
97
|
*
|
|
96
98
|
* @returns Hint text shown for the spot.
|
|
97
99
|
*/
|
|
98
|
-
public GetHint(): string
|
|
100
|
+
public GetHint(): Nullable<string>;
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
* @remarks
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable, Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Metadata stored inside a recorded multiplayer demo.
|
|
@@ -356,7 +358,7 @@ declare module "xray16" {
|
|
|
356
358
|
*
|
|
357
359
|
* @returns Current logged-in profile, or null when offline.
|
|
358
360
|
*/
|
|
359
|
-
public get_current_profile(): profile
|
|
361
|
+
public get_current_profile(): Nullable<profile>;
|
|
360
362
|
|
|
361
363
|
/**
|
|
362
364
|
* @returns Saved email from registry.
|
|
@@ -548,7 +550,7 @@ declare module "xray16" {
|
|
|
548
550
|
* @param object - Lua object used as callback `this`.
|
|
549
551
|
* @param cb - Called with login profile and status description.
|
|
550
552
|
*/
|
|
551
|
-
public constructor(object: object, cb: (this: object, profile: profile
|
|
553
|
+
public constructor(object: object, cb: (this: object, profile: Nillable<profile>, description: string) => void);
|
|
552
554
|
|
|
553
555
|
/**
|
|
554
556
|
* Replace the bound callback.
|
|
@@ -556,7 +558,7 @@ declare module "xray16" {
|
|
|
556
558
|
* @param object - Lua object used as callback `this`.
|
|
557
559
|
* @param cb - Called with login profile and status description.
|
|
558
560
|
*/
|
|
559
|
-
public bind(object: object, cb: (this: object, profile: profile
|
|
561
|
+
public bind(object: object, cb: (this: object, profile: Nillable<profile>, description: string) => void): void;
|
|
560
562
|
|
|
561
563
|
/**
|
|
562
564
|
* Clear the bound callback.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Named integer token used by editor property lists.
|
|
@@ -55,7 +57,7 @@ declare module "xray16" {
|
|
|
55
57
|
* @param index - Token index.
|
|
56
58
|
* @returns Token text, or `null` from native code when index is out of range.
|
|
57
59
|
*/
|
|
58
|
-
public get(index: u32): string
|
|
60
|
+
public get(index: u32): Nullable<string>;
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
63
|
* Get number of tokens in the list.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Network client identifier.
|
|
@@ -507,7 +509,7 @@ declare module "xray16" {
|
|
|
507
509
|
*
|
|
508
510
|
* @param value - String value.
|
|
509
511
|
*/
|
|
510
|
-
public w_stringZ(value: string
|
|
512
|
+
public w_stringZ(value: Nillable<string>): void;
|
|
511
513
|
|
|
512
514
|
/**
|
|
513
515
|
* Get current write cursor offset.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Current playback parameters for a launched sound.
|
|
@@ -164,7 +166,7 @@ declare module "xray16" {
|
|
|
164
166
|
*
|
|
165
167
|
* @param object - Object used as sound owner.
|
|
166
168
|
*/
|
|
167
|
-
public play(object: game_object
|
|
169
|
+
public play(object: Nillable<game_object>): void;
|
|
168
170
|
|
|
169
171
|
/**
|
|
170
172
|
* Play the sound after a delay.
|
|
@@ -174,7 +176,7 @@ declare module "xray16" {
|
|
|
174
176
|
* @param object - Object used as sound owner.
|
|
175
177
|
* @param delay - Delay in seconds.
|
|
176
178
|
*/
|
|
177
|
-
public play(object: game_object
|
|
179
|
+
public play(object: Nillable<game_object>, delay: f32): void;
|
|
178
180
|
|
|
179
181
|
/**
|
|
180
182
|
* Play the sound with engine sound flags.
|
|
@@ -185,7 +187,7 @@ declare module "xray16" {
|
|
|
185
187
|
* @param delay - Delay in seconds.
|
|
186
188
|
* @param flags - Playback flags such as `sound_object.looped` or `sound_object.s2d`.
|
|
187
189
|
*/
|
|
188
|
-
public play(object: game_object
|
|
190
|
+
public play(object: Nillable<game_object>, delay: f32, flags: i32): void;
|
|
189
191
|
|
|
190
192
|
/**
|
|
191
193
|
* Play the sound at a fixed world position.
|
|
@@ -195,7 +197,7 @@ declare module "xray16" {
|
|
|
195
197
|
* @param object - Optional object used as sound owner.
|
|
196
198
|
* @param position - World position for playback.
|
|
197
199
|
*/
|
|
198
|
-
public play_at_pos(object: game_object
|
|
200
|
+
public play_at_pos(object: Nillable<game_object>, position: vector): void;
|
|
199
201
|
|
|
200
202
|
/**
|
|
201
203
|
* Play the sound at a fixed world position after a delay.
|
|
@@ -206,7 +208,7 @@ declare module "xray16" {
|
|
|
206
208
|
* @param position - World position for playback.
|
|
207
209
|
* @param delay - Delay in seconds.
|
|
208
210
|
*/
|
|
209
|
-
public play_at_pos(object: game_object
|
|
211
|
+
public play_at_pos(object: Nillable<game_object>, position: vector, delay: f32): void;
|
|
210
212
|
|
|
211
213
|
/**
|
|
212
214
|
* Play the sound at a fixed world position with engine sound flags.
|
|
@@ -218,7 +220,7 @@ declare module "xray16" {
|
|
|
218
220
|
* @param delay - Delay in seconds.
|
|
219
221
|
* @param flags - Playback flags such as `sound_object.looped` or `sound_object.s2d`.
|
|
220
222
|
*/
|
|
221
|
-
public play_at_pos(object: game_object
|
|
223
|
+
public play_at_pos(object: Nillable<game_object>, position: vector, delay: f32, flags: i32): void;
|
|
222
224
|
|
|
223
225
|
/**
|
|
224
226
|
* Play without tracking feedback.
|
|
@@ -235,7 +237,7 @@ declare module "xray16" {
|
|
|
235
237
|
* @param position - Optional playback position.
|
|
236
238
|
* @param volume - Optional playback volume.
|
|
237
239
|
*/
|
|
238
|
-
public play_no_feedback(object: game_object
|
|
240
|
+
public play_no_feedback(object: Nillable<game_object>, flags: i32, delay: f32, position: vector, volume: f32): void;
|
|
239
241
|
|
|
240
242
|
/**
|
|
241
243
|
* Stop playback immediately.
|
package/types/xr_lib/xr_stats.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Actor statistics helpers exposed through the `actor_stats` namespace.
|
|
@@ -37,7 +39,7 @@ declare module "xray16" {
|
|
|
37
39
|
*
|
|
38
40
|
* @param object_id - Object id to remove.
|
|
39
41
|
*/
|
|
40
|
-
remove_from_ranking(this: void, object_id: number): void
|
|
42
|
+
remove_from_ranking(this: void, object_id: number): Nullable<void>;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nullable } from "../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Task state and task type constants.
|
|
@@ -102,7 +104,7 @@ declare module "xray16" {
|
|
|
102
104
|
/**
|
|
103
105
|
* @returns Objective icon name, or null when none is set.
|
|
104
106
|
*/
|
|
105
|
-
public get_icon_name<T extends string = string>(): T
|
|
107
|
+
public get_icon_name<T extends string = string>(): Nullable<T>;
|
|
106
108
|
|
|
107
109
|
/**
|
|
108
110
|
* Set objective description text.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Nillable } from "../../internal";
|
|
2
|
+
|
|
1
3
|
declare module "xray16" {
|
|
2
4
|
/**
|
|
3
5
|
* Campfire anomaly object.
|
|
@@ -642,7 +644,7 @@ declare module "xray16" {
|
|
|
642
644
|
*
|
|
643
645
|
* @param game_object - Enemy object, or null to clear.
|
|
644
646
|
*/
|
|
645
|
-
public SetEnemy(game_object: game_object
|
|
647
|
+
public SetEnemy(game_object: Nillable<game_object>): void;
|
|
646
648
|
|
|
647
649
|
/**
|
|
648
650
|
* Track an enemy point.
|