xray16 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# [📡 XRay-16 engine typescript definitions](https://github.com/xray-forge/xray-16-types)
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/xray16)
|
|
3
4
|
[](https://xray-forge.github.io/xray-16-types/index.html)
|
|
4
5
|
[](https://xray-forge.github.io/stalker-xrf-book)
|
|
5
6
|
<br/>
|
|
@@ -105,7 +106,7 @@ Lua does not provide convenient API do get filename in runtime and static step i
|
|
|
105
106
|
Plugin to simplify casting from `LuaTable` to typescript array/map objects.\
|
|
106
107
|
All the calls are completely gets stripped and removed from runtime.
|
|
107
108
|
|
|
108
|
-
###
|
|
109
|
+
### inject_tracy_zones
|
|
109
110
|
|
|
110
111
|
Plugin designed to work specifically with [tracy profiler](https://github.com/wolfpld/tracy).\
|
|
111
112
|
Once it is enabled with env variable or path parameter, tracy zone marking calls are injected for every method.\
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const typescript_1 = require("typescript");
|
|
4
|
+
const lua = require("typescript-to-lua");
|
|
4
5
|
const diagnostics_1 = require("./utils/diagnostics");
|
|
5
6
|
const FROM_CAST_METHODS = ["$fromObject", "$fromArray", "$fromLuaArray", "$fromLuaTable"];
|
|
7
|
+
const NIL_CHECK_METHODS = new Map([
|
|
8
|
+
["$isNil", lua.SyntaxKind.EqualityOperator],
|
|
9
|
+
["$isNotNil", lua.SyntaxKind.InequalityOperator],
|
|
10
|
+
]);
|
|
6
11
|
/**
|
|
7
12
|
* Push generic error to notify about usage issue.
|
|
8
13
|
*/
|
|
@@ -22,6 +27,13 @@ const plugin = {
|
|
|
22
27
|
}
|
|
23
28
|
return context.transformExpression(node.arguments[0]);
|
|
24
29
|
}
|
|
30
|
+
if ((0, typescript_1.isIdentifier)(node.expression) && NIL_CHECK_METHODS.has(node.expression.text)) {
|
|
31
|
+
if (node.arguments.length !== 1) {
|
|
32
|
+
context.diagnostics.push(createInvalidFunctionCallError(node));
|
|
33
|
+
return context.superTransformExpression(node);
|
|
34
|
+
}
|
|
35
|
+
return lua.createBinaryExpression(context.transformExpression(node.arguments[0]), lua.createNilLiteral(node), NIL_CHECK_METHODS.get(node.expression.text), node);
|
|
36
|
+
}
|
|
25
37
|
return context.superTransformExpression(node);
|
|
26
38
|
},
|
|
27
39
|
},
|
package/types/xr_lib/xr_fs.d.ts
CHANGED
|
@@ -180,6 +180,68 @@ declare module "xray16" {
|
|
|
180
180
|
private constructor();
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Registered filesystem path alias descriptor.
|
|
185
|
+
*
|
|
186
|
+
* @source C++ class FS_Path
|
|
187
|
+
* @customConstructor FS_Path
|
|
188
|
+
* @group xr_fs
|
|
189
|
+
*
|
|
190
|
+
* @remarks
|
|
191
|
+
* Returned by filesystem alias lookups. The object is owned by the engine filesystem. Missing aliases assert in
|
|
192
|
+
* the single-argument `get_path` binding instead of returning `null`.
|
|
193
|
+
*/
|
|
194
|
+
export class FS_Path {
|
|
195
|
+
/**
|
|
196
|
+
* Resolved full path.
|
|
197
|
+
*/
|
|
198
|
+
public readonly m_Path: string;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Root path used by this alias.
|
|
202
|
+
*/
|
|
203
|
+
public readonly m_Root: string;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Relative path segment added to the root.
|
|
207
|
+
*/
|
|
208
|
+
public readonly m_Add: string;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Default extension used by this alias.
|
|
212
|
+
*/
|
|
213
|
+
public readonly m_DefExt: string;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* File dialog filter caption.
|
|
217
|
+
*/
|
|
218
|
+
public readonly m_FilterCaption: string;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Engine-created path descriptor.
|
|
222
|
+
*/
|
|
223
|
+
private constructor();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Opaque filesystem writer handle.
|
|
228
|
+
*
|
|
229
|
+
* @source C++ class IWriter
|
|
230
|
+
* @customConstructor IWriter
|
|
231
|
+
* @group xr_fs
|
|
232
|
+
*
|
|
233
|
+
* @remarks
|
|
234
|
+
* Returned by {@link FS.w_open}. The writer class is not registered with script-callable write methods in this
|
|
235
|
+
* binding, so scripts normally only pass it back to {@link FS.w_close}. Writer creation can return `null` when
|
|
236
|
+
* native writer setup fails.
|
|
237
|
+
*/
|
|
238
|
+
export class IWriter {
|
|
239
|
+
/**
|
|
240
|
+
* Engine-created writer handle.
|
|
241
|
+
*/
|
|
242
|
+
private constructor();
|
|
243
|
+
}
|
|
244
|
+
|
|
183
245
|
/**
|
|
184
246
|
* Engine filesystem facade.
|
|
185
247
|
*
|
|
@@ -410,18 +472,22 @@ declare module "xray16" {
|
|
|
410
472
|
* @param fs_type - Filesystem source to search.
|
|
411
473
|
* @returns File status.
|
|
412
474
|
*/
|
|
413
|
-
public exist(path: string, fs_type: TXR_fs_type): FileStatus;
|
|
475
|
+
public exist(path: string, fs_type: TXR_fs_type): FileStatus | null;
|
|
414
476
|
|
|
415
477
|
/**
|
|
416
478
|
* Add a path alias.
|
|
417
479
|
*
|
|
480
|
+
* @remarks
|
|
481
|
+
* Native code asserts if `root` is invalid or `alias` is already registered. On success it returns a path
|
|
482
|
+
* descriptor.
|
|
483
|
+
*
|
|
418
484
|
* @param alias - Alias name.
|
|
419
485
|
* @param root - Root path.
|
|
420
486
|
* @param path - Relative path.
|
|
421
487
|
* @param recursive - Whether subfolders should be scanned.
|
|
422
488
|
* @returns Native filesystem path descriptor.
|
|
423
489
|
*/
|
|
424
|
-
public append_path(alias: string, root: string, path: string, recursive: boolean):
|
|
490
|
+
public append_path(alias: string, root: string, path: string, recursive: boolean): FS_Path;
|
|
425
491
|
|
|
426
492
|
/**
|
|
427
493
|
* Check whether a path alias exists.
|
|
@@ -458,10 +524,14 @@ declare module "xray16" {
|
|
|
458
524
|
/**
|
|
459
525
|
* Get native path descriptor for an alias.
|
|
460
526
|
*
|
|
527
|
+
* @remarks
|
|
528
|
+
* Native code asserts when the alias is missing. Use {@link FS.path_exist} before calling when the alias is
|
|
529
|
+
* optional.
|
|
530
|
+
*
|
|
461
531
|
* @param alias - Filesystem path alias.
|
|
462
532
|
* @returns Native filesystem path descriptor.
|
|
463
533
|
*/
|
|
464
|
-
public get_path(alias: string):
|
|
534
|
+
public get_path(alias: string): FS_Path;
|
|
465
535
|
|
|
466
536
|
/**
|
|
467
537
|
* Close a binary reader.
|
|
@@ -492,24 +562,30 @@ declare module "xray16" {
|
|
|
492
562
|
*
|
|
493
563
|
* @param writer - Writer returned by `w_open`.
|
|
494
564
|
*/
|
|
495
|
-
public w_close(writer:
|
|
565
|
+
public w_close(writer: IWriter | null): void;
|
|
496
566
|
|
|
497
567
|
/**
|
|
498
568
|
* Open a binary writer below a path alias.
|
|
499
569
|
*
|
|
570
|
+
* @remarks
|
|
571
|
+
* Can return `null` when native writer setup fails.
|
|
572
|
+
*
|
|
500
573
|
* @param path - Filesystem path alias.
|
|
501
574
|
* @param filename - Relative file path.
|
|
502
|
-
* @returns Binary writer
|
|
575
|
+
* @returns Binary writer, or `null`.
|
|
503
576
|
*/
|
|
504
|
-
public w_open(path: string, filename: string):
|
|
577
|
+
public w_open(path: string, filename: string): IWriter | null;
|
|
505
578
|
|
|
506
579
|
/**
|
|
507
580
|
* Open a binary writer.
|
|
508
581
|
*
|
|
582
|
+
* @remarks
|
|
583
|
+
* Can return `null` when native writer setup fails.
|
|
584
|
+
*
|
|
509
585
|
* @param path - File path.
|
|
510
|
-
* @returns Binary writer
|
|
586
|
+
* @returns Binary writer, or `null`.
|
|
511
587
|
*/
|
|
512
|
-
public w_open(path: string):
|
|
588
|
+
public w_open(path: string): IWriter | null;
|
|
513
589
|
}
|
|
514
590
|
|
|
515
591
|
/**
|
|
@@ -1649,15 +1649,6 @@ declare module "xray16" {
|
|
|
1649
1649
|
*/
|
|
1650
1650
|
public get_current_point_index(): u32;
|
|
1651
1651
|
|
|
1652
|
-
/**
|
|
1653
|
-
* @remarks
|
|
1654
|
-
* Requires this object to be a base monster. Other object types log a script error and return a
|
|
1655
|
-
* default value or do nothing.
|
|
1656
|
-
*
|
|
1657
|
-
* @returns Whether monster anti-aim is forced.
|
|
1658
|
-
*/
|
|
1659
|
-
public get_force_anti_aim(): boolean;
|
|
1660
|
-
|
|
1661
1652
|
/**
|
|
1662
1653
|
* Cast this object to a hanging lamp.
|
|
1663
1654
|
*
|
package/types/xrf_plugin.d.ts
CHANGED
|
@@ -13,6 +13,26 @@ declare global {
|
|
|
13
13
|
*/
|
|
14
14
|
const $dirname: string;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Check whether a value is nil-compatible in Lua and Jest runtimes.
|
|
18
|
+
*
|
|
19
|
+
* @group xrf_plugin
|
|
20
|
+
*
|
|
21
|
+
* @param value - Value to check.
|
|
22
|
+
* @returns Whether value is `null` or `undefined`.
|
|
23
|
+
*/
|
|
24
|
+
function $isNil<T>(value: T): value is null | undefined;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Check whether a value is not nil-compatible in Lua and Jest runtimes.
|
|
28
|
+
*
|
|
29
|
+
* @group xrf_plugin
|
|
30
|
+
*
|
|
31
|
+
* @param value - Value to check.
|
|
32
|
+
* @returns Whether value is neither `null` nor `undefined`.
|
|
33
|
+
*/
|
|
34
|
+
function $isNotNil<T>(value: T): value is NonNullable<T>;
|
|
35
|
+
|
|
16
36
|
/**
|
|
17
37
|
* Treat a TypeScript array as a Lua array.
|
|
18
38
|
*
|