xray16 1.5.2 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # [📡 XRay-16 engine typescript definitions](https://github.com/xray-forge/xray-16-types)
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/xray16)](https://www.npmjs.com/package/xray16)
3
4
  [![types](https://img.shields.io/badge/docs-types-blue.svg?style=flat)](https://xray-forge.github.io/xray-16-types/index.html)
4
5
  [![book](https://img.shields.io/badge/docs-book-blue.svg?style=flat)](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
- ### from_cast_utils
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,6 +1,6 @@
1
1
  {
2
2
  "name": "xray16",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "author": "Neloreck",
5
5
  "repository": "https://github.com/xray-forge/xray-16-types",
6
6
  "private": false,
@@ -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
  },
@@ -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
  *
@@ -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(value: unknown): 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
  *