xray16 1.1.3 → 1.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xray16",
3
- "version": "1.1.3",
3
+ "version": "1.2.1",
4
4
  "author": "Neloreck",
5
5
  "repository": "https://github.com/stalker-xrts/xray-16-types",
6
6
  "private": false,
@@ -16,10 +16,10 @@
16
16
  "lint": "eslint . --ext .ts,.tsx,.js"
17
17
  },
18
18
  "peerDependencies": {
19
- "typescript-to-lua": "^1.16.3"
19
+ "typescript-to-lua": "^1.28.1"
20
20
  },
21
21
  "devDependencies": {
22
- "@types/node": "20.3.1",
22
+ "@types/node": "22.10.2",
23
23
  "@typescript-eslint/eslint-plugin": "^5.54.0",
24
24
  "@typescript-eslint/parser": "^5.54.0",
25
25
  "@typescript-to-lua/language-extensions": "1.0.0",
@@ -29,9 +29,9 @@
29
29
  "eslint-plugin-jest": "^27.2.1",
30
30
  "eslint-plugin-jsdoc": "^46.8.0",
31
31
  "eslint-plugin-sort-keys-fix": "^1.1.2",
32
- "prettier": "^3.0.1",
33
- "typedoc": "^0.24.8",
34
- "typescript": "^5.1.6"
32
+ "prettier": "^3.4.2",
33
+ "typedoc": "^0.27.5",
34
+ "typescript": "^5.7.2"
35
35
  },
36
36
  "files": [
37
37
  "plugins/**/*",
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformClassLikeDeclaration = exports.transformClassAsExpression = exports.transformLuabindClassDeclaration = void 0;
3
+ exports.transformLuabindClassDeclaration = void 0;
4
+ exports.transformClassAsExpression = transformClassAsExpression;
5
+ exports.transformClassLikeDeclaration = transformClassLikeDeclaration;
4
6
  const typescript_1 = require("typescript");
5
7
  const tstl = require("typescript-to-lua");
6
8
  const typescript_to_lua_1 = require("typescript-to-lua");
@@ -37,7 +39,6 @@ function transformClassAsExpression(expression, context) {
37
39
  context.addPrecedingStatements(statements);
38
40
  return name;
39
41
  }
40
- exports.transformClassAsExpression = transformClassAsExpression;
41
42
  function transformClassLikeDeclaration(classDeclaration, context, nameOverride) {
42
43
  let className;
43
44
  if (nameOverride !== undefined) {
@@ -101,7 +102,7 @@ function transformClassLikeDeclaration(classDeclaration, context, nameOverride)
101
102
  for (const member of classDeclaration.members) {
102
103
  if (!(0, typescript_1.isAccessor)(member))
103
104
  continue;
104
- const accessors = context.resolver.getAllAccessorDeclarations(member);
105
+ const accessors = getAllAccessorDeclarations(classDeclaration);
105
106
  if (accessors.firstAccessor !== member)
106
107
  continue;
107
108
  const accessorsResult = (0, accessors_1.transformAccessorDeclarations)(context, accessors, localClassName);
@@ -144,4 +145,14 @@ function transformClassLikeDeclaration(classDeclaration, context, nameOverride)
144
145
  context.classSuperInfos.pop();
145
146
  return { statements: result, name: className };
146
147
  }
147
- exports.transformClassLikeDeclaration = transformClassLikeDeclaration;
148
+ function getAllAccessorDeclarations(classDeclaration) {
149
+ const getAccessor = classDeclaration.members.find(typescript_1.isGetAccessor);
150
+ const setAccessor = classDeclaration.members.find(typescript_1.isSetAccessor);
151
+ // Get the first of the two (that is not undefined)
152
+ const firstAccessor = getAccessor && (!setAccessor || getAccessor.pos < setAccessor.pos) ? getAccessor : setAccessor;
153
+ return {
154
+ firstAccessor,
155
+ setAccessor,
156
+ getAccessor,
157
+ };
158
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkLuabindClassDecoratorExpression = void 0;
3
+ exports.checkLuabindClassDecoratorExpression = checkLuabindClassDecoratorExpression;
4
4
  const constants_1 = require("./constants");
5
5
  const errors_1 = require("./errors");
6
6
  /**
@@ -13,4 +13,3 @@ function checkLuabindClassDecoratorExpression(context, decorator) {
13
13
  context.diagnostics.push((0, errors_1.unsupportedClassDecorator)(expression));
14
14
  }
15
15
  }
16
- exports.checkLuabindClassDecoratorExpression = checkLuabindClassDecoratorExpression;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformAccessorDeclarations = void 0;
3
+ exports.transformAccessorDeclarations = transformAccessorDeclarations;
4
4
  const typescript_to_lua_1 = require("typescript-to-lua");
5
5
  const lua = require("typescript-to-lua");
6
6
  const lua_ast_1 = require("typescript-to-lua/dist/transformation/utils/lua-ast");
@@ -36,4 +36,3 @@ function transformAccessorDeclarations(context, { firstAccessor, getAccessor, se
36
36
  const call = (0, lualib_1.transformLuaLibFunction)(context, feature, undefined, ...parameters);
37
37
  return lua.createExpressionStatement(call);
38
38
  }
39
- exports.transformAccessorDeclarations = transformAccessorDeclarations;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformConstructorDeclaration = exports.createConstructorName = void 0;
3
+ exports.createConstructorName = createConstructorName;
4
+ exports.transformConstructorDeclaration = transformConstructorDeclaration;
4
5
  const typescript_1 = require("typescript");
5
6
  const lua = require("typescript-to-lua");
6
7
  const lua_ast_1 = require("typescript-to-lua/dist/transformation/utils/lua-ast");
@@ -12,7 +13,6 @@ const fields_1 = require("./fields");
12
13
  function createConstructorName(className) {
13
14
  return lua.createTableIndexExpression(lua.cloneIdentifier(className), lua.createStringLiteral(constants_1.LUABIND_CONSTRUCTOR_METHOD));
14
15
  }
15
- exports.createConstructorName = createConstructorName;
16
16
  function transformConstructorDeclaration(context, statement, className, instanceFields, classDeclaration) {
17
17
  // Don't transform methods without body (overload declarations)
18
18
  if (!statement.body) {
@@ -58,4 +58,3 @@ function transformConstructorDeclaration(context, statement, className, instance
58
58
  context.popScope();
59
59
  return lua.createAssignmentStatement(createConstructorName(className), lua.createFunctionExpression(block, params, dotsLiteral, lua.NodeFlags.Declaration), constructorWasGenerated ? classDeclaration : statement);
60
60
  }
61
- exports.transformConstructorDeclaration = transformConstructorDeclaration;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformClassInstanceFields = exports.verifyPropertyDecoratingExpression = void 0;
3
+ exports.verifyPropertyDecoratingExpression = verifyPropertyDecoratingExpression;
4
+ exports.transformClassInstanceFields = transformClassInstanceFields;
4
5
  const typescript_1 = require("typescript");
5
6
  const tstl = require("typescript-to-lua");
6
7
  const lua_ast_1 = require("typescript-to-lua/dist/transformation/utils/lua-ast");
@@ -20,7 +21,6 @@ function verifyPropertyDecoratingExpression(context, node) {
20
21
  context.diagnostics.push((0, errors_1.unsupportedPropertyDecorator)(decorator));
21
22
  });
22
23
  }
23
- exports.verifyPropertyDecoratingExpression = verifyPropertyDecoratingExpression;
24
24
  function transformClassInstanceFields(context, instanceFields) {
25
25
  const statements = [];
26
26
  for (const f of instanceFields) {
@@ -38,4 +38,3 @@ function transformClassInstanceFields(context, instanceFields) {
38
38
  }
39
39
  return statements;
40
40
  }
41
- exports.transformClassInstanceFields = transformClassInstanceFields;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyMethodDecoratingExpression = exports.transformMethodDeclaration = exports.transformMethodName = exports.transformMemberExpressionOwnerName = void 0;
3
+ exports.transformMemberExpressionOwnerName = transformMemberExpressionOwnerName;
4
+ exports.transformMethodName = transformMethodName;
5
+ exports.transformMethodDeclaration = transformMethodDeclaration;
6
+ exports.verifyMethodDecoratingExpression = verifyMethodDecoratingExpression;
4
7
  const typescript_1 = require("typescript");
5
8
  const lua = require("typescript-to-lua");
6
9
  const function_1 = require("typescript-to-lua/dist/transformation/visitors/function");
@@ -10,7 +13,6 @@ const utils_1 = require("../utils");
10
13
  function transformMemberExpressionOwnerName(node, className) {
11
14
  return lua.cloneIdentifier(className);
12
15
  }
13
- exports.transformMemberExpressionOwnerName = transformMemberExpressionOwnerName;
14
16
  function transformMethodName(context, node) {
15
17
  const methodName = (0, literal_1.transformPropertyName)(context, node.name);
16
18
  if (lua.isStringLiteral(methodName) && methodName.value === "toString") {
@@ -18,7 +20,6 @@ function transformMethodName(context, node) {
18
20
  }
19
21
  return methodName;
20
22
  }
21
- exports.transformMethodName = transformMethodName;
22
23
  function transformMethodDeclaration(context, node, className) {
23
24
  // Don't transform methods without body (overload declarations)
24
25
  if (!node.body)
@@ -33,7 +34,6 @@ function transformMethodDeclaration(context, node, className) {
33
34
  const [functionExpression] = (0, function_1.transformFunctionToExpression)(context, node);
34
35
  return lua.createAssignmentStatement(lua.createTableIndexExpression(methodTable, methodName), functionExpression, node);
35
36
  }
36
- exports.transformMethodDeclaration = transformMethodDeclaration;
37
37
  /**
38
38
  * Verify that method statement is not using decorators for methods/parameters.
39
39
  */
@@ -53,4 +53,3 @@ function verifyMethodDecoratingExpression(context, node) {
53
53
  });
54
54
  }
55
55
  }
56
- exports.verifyMethodDecoratingExpression = verifyMethodDecoratingExpression;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformNewCallExpression = void 0;
3
+ exports.transformNewCallExpression = transformNewCallExpression;
4
4
  const tstl = require("typescript-to-lua");
5
5
  const call_1 = require("typescript-to-lua/dist/transformation/visitors/call");
6
6
  /**
@@ -9,4 +9,3 @@ const call_1 = require("typescript-to-lua/dist/transformation/visitors/call");
9
9
  function transformNewCallExpression(expression, context) {
10
10
  return tstl.createCallExpression(context.transformExpression(expression.expression), (0, call_1.transformArguments)(context, expression.arguments ?? []));
11
11
  }
12
- exports.transformNewCallExpression = transformNewCallExpression;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getReflectionClassName = exports.createClassSetup = void 0;
3
+ exports.createClassSetup = createClassSetup;
4
+ exports.getReflectionClassName = getReflectionClassName;
4
5
  const typescript_1 = require("typescript");
5
6
  const tstl = require("typescript-to-lua");
6
7
  const export_1 = require("typescript-to-lua/dist/transformation/utils/export");
@@ -41,7 +42,6 @@ function createClassSetup(context, statement, className, localClassName) {
41
42
  result.push(tstl.createAssignmentStatement(tstl.createTableIndexExpression(tstl.cloneIdentifier(localClassName), tstl.createStringLiteral(constants_1.LUABIND_NAME_FIELD)), getReflectionClassName(statement, className), statement));
42
43
  return result;
43
44
  }
44
- exports.createClassSetup = createClassSetup;
45
45
  function getReflectionClassName(declaration, className) {
46
46
  if (declaration.name) {
47
47
  return tstl.createStringLiteral(declaration.name.text);
@@ -57,7 +57,6 @@ function getReflectionClassName(declaration, className) {
57
57
  }
58
58
  return tstl.createStringLiteral("");
59
59
  }
60
- exports.getReflectionClassName = getReflectionClassName;
61
60
  /**
62
61
  * Creates class("Name")(base) expression for luabind classes.
63
62
  */
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformLuabindConstructorSuperCall = exports.isLuabindClassSuperMethodCall = exports.isLuabindClassSuperCall = exports.transformClassSuperMethodExpression = void 0;
3
+ exports.transformClassSuperMethodExpression = transformClassSuperMethodExpression;
4
+ exports.isLuabindClassSuperCall = isLuabindClassSuperCall;
5
+ exports.isLuabindClassSuperMethodCall = isLuabindClassSuperMethodCall;
6
+ exports.transformLuabindConstructorSuperCall = transformLuabindConstructorSuperCall;
4
7
  const typescript_1 = require("typescript");
5
8
  const tstl = require("typescript-to-lua");
6
9
  const export_1 = require("typescript-to-lua/dist/transformation/utils/export");
@@ -34,7 +37,6 @@ function transformClassSuperMethodExpression(expression, context) {
34
37
  }
35
38
  return baseClassName;
36
39
  }
37
- exports.transformClassSuperMethodExpression = transformClassSuperMethodExpression;
38
40
  /**
39
41
  * Check if super() call is in luabind class target.
40
42
  */
@@ -50,7 +52,6 @@ function isLuabindClassSuperCall(expression, context) {
50
52
  return superInfo?.classDeclaration ? (0, utils_1.isLuabindClassType)(superInfo.classDeclaration, context) : false;
51
53
  }
52
54
  }
53
- exports.isLuabindClassSuperCall = isLuabindClassSuperCall;
54
55
  /**
55
56
  * Check if super.method() call is in luabind class target.
56
57
  */
@@ -60,7 +61,6 @@ function isLuabindClassSuperMethodCall(expression, context) {
60
61
  // Handle super calls properly for luabind classes.
61
62
  return superInfo?.classDeclaration ? (0, utils_1.isLuabindClassType)(superInfo.classDeclaration, context) : false;
62
63
  }
63
- exports.isLuabindClassSuperMethodCall = isLuabindClassSuperMethodCall;
64
64
  /**
65
65
  * Transform super() call in luabind classes to base_class.__init(self, param).
66
66
  */
@@ -69,4 +69,3 @@ function transformLuabindConstructorSuperCall(expression, context) {
69
69
  const parameters = (0, call_1.transformArguments)(context, expression.arguments, signature, typescript_1.factory.createThis());
70
70
  return tstl.createCallExpression(tstl.createTableIndexExpression(context.transformExpression(typescript_1.factory.createSuper()), tstl.createStringLiteral(constants_1.LUABIND_CONSTRUCTOR_METHOD)), parameters, expression);
71
71
  }
72
- exports.transformLuabindConstructorSuperCall = transformLuabindConstructorSuperCall;
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLuabindClassType = exports.markTypeAsLuabind = exports.isLuabindDecoratedClass = exports.getExtendedType = exports.getExtendedNode = exports.getExtendsClause = exports.isStaticNode = void 0;
3
+ exports.isStaticNode = isStaticNode;
4
+ exports.getExtendsClause = getExtendsClause;
5
+ exports.getExtendedNode = getExtendedNode;
6
+ exports.getExtendedType = getExtendedType;
7
+ exports.isLuabindDecoratedClass = isLuabindDecoratedClass;
8
+ exports.markTypeAsLuabind = markTypeAsLuabind;
9
+ exports.isLuabindClassType = isLuabindClassType;
4
10
  const typescript_1 = require("typescript");
5
11
  const constants_1 = require("./constants");
6
12
  /**
@@ -9,14 +15,12 @@ const constants_1 = require("./constants");
9
15
  function isStaticNode(node) {
10
16
  return node.modifiers?.some((m) => m.kind === typescript_1.SyntaxKind.StaticKeyword) === true;
11
17
  }
12
- exports.isStaticNode = isStaticNode;
13
18
  /**
14
19
  * Get class extends node.
15
20
  */
16
21
  function getExtendsClause(node) {
17
22
  return node.heritageClauses?.find((clause) => clause.token === typescript_1.SyntaxKind.ExtendsKeyword);
18
23
  }
19
- exports.getExtendsClause = getExtendsClause;
20
24
  /**
21
25
  * Get class extended node.
22
26
  */
@@ -26,7 +30,6 @@ function getExtendedNode(node) {
26
30
  return;
27
31
  return extendsClause.types[0];
28
32
  }
29
- exports.getExtendedNode = getExtendedNode;
30
33
  /**
31
34
  * Get class extended node.
32
35
  */
@@ -34,7 +37,6 @@ function getExtendedType(context, node) {
34
37
  const extendedNode = getExtendedNode(node);
35
38
  return extendedNode && context.checker.getTypeAtLocation(extendedNode);
36
39
  }
37
- exports.getExtendedType = getExtendedType;
38
40
  /**
39
41
  * Check if class is decorated with provided decorator name.
40
42
  */
@@ -45,7 +47,6 @@ function isLuabindDecoratedClass(declaration) {
45
47
  }
46
48
  return decorators.some((it) => it.expression.expression?.escapedText === constants_1.LUABIND_DECORATOR);
47
49
  }
48
- exports.isLuabindDecoratedClass = isLuabindDecoratedClass;
49
50
  /**
50
51
  * Mark provided class as Luabind target.
51
52
  */
@@ -54,7 +55,6 @@ function markTypeAsLuabind(declaration, context) {
54
55
  const typeSymbol = typeAtLocation.symbol || typeAtLocation.aliasSymbol;
55
56
  typeSymbol[constants_1.LUABIND_SYMBOL] = true;
56
57
  }
57
- exports.markTypeAsLuabind = markTypeAsLuabind;
58
58
  /**
59
59
  * Check if provided class is specified as LuaBind.
60
60
  */
@@ -74,4 +74,3 @@ function isLuabindClassType(declaration, context) {
74
74
  return false;
75
75
  }
76
76
  }
77
- exports.isLuabindClassType = isLuabindClassType;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createErrorDiagnosticFactory = exports.createDiagnosticFactory = void 0;
3
+ exports.createDiagnosticFactory = createDiagnosticFactory;
4
+ exports.createErrorDiagnosticFactory = createErrorDiagnosticFactory;
4
5
  const typescript_1 = require("typescript");
5
6
  const utils_1 = require("typescript-to-lua/dist/utils");
6
7
  /**
@@ -15,8 +16,6 @@ function createDiagnosticFactory(category, message) {
15
16
  category,
16
17
  }));
17
18
  }
18
- exports.createDiagnosticFactory = createDiagnosticFactory;
19
19
  function createErrorDiagnosticFactory(message) {
20
20
  return createDiagnosticFactory(typescript_1.DiagnosticCategory.Error, message);
21
21
  }
22
- exports.createErrorDiagnosticFactory = createErrorDiagnosticFactory;
@@ -16,7 +16,7 @@ declare module "xray16" {
16
16
  vector: vector,
17
17
  level_vertex_id: u32,
18
18
  game_vertex_id: u16,
19
- pid: u16,
19
+ parent_object_id: u16,
20
20
  count: i32
21
21
  ): cse_abstract;
22
22
 
@@ -80,17 +80,31 @@ declare module "xray16" {
80
80
 
81
81
  public valid_object_id(value: u16): boolean;
82
82
 
83
- public kill_entity(monster1: cse_alife_monster_abstract, value?: u16, monster2?: cse_alife_monster_abstract): void;
83
+ public kill_entity(
84
+ monster: cse_alife_monster_abstract,
85
+ graph_id?: u16,
86
+ schedulable?: cse_alife_monster_abstract
87
+ ): void;
84
88
 
85
- public object<T extends cse_alife_object = cse_alife_object>(id: number, value2?: boolean): T | null;
89
+ public object<T extends cse_alife_object = cse_alife_object>(object_id: u16, no_assert?: boolean): T | null;
86
90
 
87
- public create<T extends cse_alife_object = cse_alife_object>(value: u32): T;
91
+ public create<T extends cse_alife_object = cse_alife_object>(object_id: u16): T;
92
+ public create<T extends cse_alife_object = cse_alife_object>(
93
+ section: string,
94
+ position: vector,
95
+ level_vertex_id: u32,
96
+ game_vertex_id: u32,
97
+ parent_object_id?: u16
98
+ ): T;
99
+ // Alundaio: Allows to call alife():register(se_obj) manually afterward,editing
100
+ // Alundaio: so that packet can be done safely when spawning object with a parent.
88
101
  public create<T extends cse_alife_object = cse_alife_object>(
89
- item_section: string,
102
+ section: string,
90
103
  position: vector,
91
104
  level_vertex_id: u32,
92
105
  game_vertex_id: u32,
93
- pid?: i32
106
+ parent_object_id: u16,
107
+ reg: boolean
94
108
  ): T;
95
109
  }
96
110
 
@@ -1,5 +1,4 @@
1
1
  declare module "xray16" {
2
-
3
2
  /**
4
3
  * Enumeration with possible game types:
5
4
  * - eGameIDNoGame = u32(0),
@@ -66,5 +66,4 @@ declare module "xray16" {
66
66
  * @returns whether renderer setting can be changed
67
67
  */
68
68
  export function renderer_allow_override(this: void): boolean;
69
-
70
69
  }
@@ -35,8 +35,6 @@ declare module "xray16" {
35
35
  export class SGameTaskObjective {
36
36
  public constructor(task: CGameTask, id: i32);
37
37
 
38
- public remove_map_locations(flag: boolean): void;
39
-
40
38
  public set_icon_name(icon_name: string): void;
41
39
 
42
40
  public get_icon_name<T extends string = string>(): T | null;
@@ -75,7 +73,21 @@ declare module "xray16" {
75
73
 
76
74
  public set_map_hint(hint: string): void;
77
75
 
78
- public change_map_location(value: string, value2: u16): void;
76
+ /**
77
+ * @returns target map location of task object
78
+ */
79
+ public get_map_location(): string;
80
+
81
+ /**
82
+ * @returns target map object ID of task object
83
+ */
84
+ public get_map_object_id(): u16;
85
+
86
+ public change_map_location(new_map_location: string, new_map_object_id: u16): void;
87
+
88
+ public remove_map_locations(notify: boolean): void;
89
+
90
+ public create_map_location(on_load: boolean): void;
79
91
 
80
92
  public set_map_object_id(id: i32): void;
81
93
  }
@@ -67,6 +67,10 @@ declare module "xray16" {
67
67
 
68
68
  public constructor();
69
69
 
70
+ public SetEnterLocked(is_enabled: boolean): void;
71
+
72
+ public SetExitLocked(is_enabled: boolean): void;
73
+
70
74
  public CanHit(): boolean;
71
75
 
72
76
  public CarExplode(): void;
@@ -81,18 +85,31 @@ declare module "xray16" {
81
85
 
82
86
  public FireDirDiff(): f32;
83
87
 
88
+ /**
89
+ * @returns amount of fuel in vehicle instance
90
+ */
84
91
  public GetfFuel(): f32;
85
92
 
93
+ /**
94
+ * @returns fuel consumption rate of vehicle instance
95
+ */
86
96
  public GetfFuelConsumption(): f32;
87
97
 
98
+ /**
99
+ * @returns fuel tank size (max possible amount of fuel at time)
100
+ */
88
101
  public GetfFuelTank(): f32;
89
102
 
103
+ /**
104
+ * @returns vehicle health value
105
+ */
90
106
  public GetfHealth(): f32;
91
107
 
108
+ /**
109
+ * @returns whether vehicle has mounted weapon
110
+ */
92
111
  public HasWeapon(): boolean;
93
112
 
94
- public IsActiveEngine(): boolean;
95
-
96
113
  public IsObjectVisible(game_object: game_object): boolean;
97
114
 
98
115
  public PlayDamageParticles(): void;
@@ -107,12 +124,45 @@ declare module "xray16" {
107
124
 
108
125
  public SetfHealth(health: f32): void;
109
126
 
110
- public StartEngine(): void;
127
+ /**
128
+ * @returns whether vehicle engine is active at the moment
129
+ */
130
+ public IsActiveEngine(): boolean;
111
131
 
112
- public StopDamageParticles(): void;
132
+ /**
133
+ * Start vehicle engine.
134
+ */
135
+ public StartEngine(): void;
113
136
 
137
+ /**
138
+ * Stop vehicle engine.
139
+ */
114
140
  public StopEngine(): void;
115
141
 
142
+ /**
143
+ * Set vehicle hand break in active state.
144
+ */
145
+ public HandBreak(): void;
146
+
147
+ /**
148
+ * Deactivate vehicle hand break.
149
+ */
150
+ public ReleaseHandBreak(): void;
151
+
152
+ /**
153
+ * @returns current vehicle RPM value (speed)
154
+ */
155
+ public GetRPM(): f32;
156
+
157
+ /**
158
+ * Set current vehicle RPM value (speed).
159
+ *
160
+ * @param rpm - RPM value to apply
161
+ */
162
+ public SetRPM(rpm: f32): void;
163
+
164
+ public StopDamageParticles(): void;
165
+
116
166
  public engaged(): boolean;
117
167
 
118
168
  public Action(value1: u16, value2: u32): void;
@@ -1,4 +1,3 @@
1
-
2
1
  declare module "xray16" {
3
2
  /**
4
3
  * @source C++ class physics_element
@@ -194,8 +193,22 @@ declare module "xray16" {
194
193
  export class holder {
195
194
  public engaged(): boolean;
196
195
 
197
- public Action(value1: u16, value2: u32): void;
196
+ public Action(id: u16, flags: u32): void;
197
+
198
+ public SetParam(id: i32, value: vector): void;
199
+
200
+ /**
201
+ * Set holder object enter state.
202
+ *
203
+ * @param is_enabled - whether holder object can be entered
204
+ */
205
+ public SetEnterLocked(is_enabled: boolean): void;
198
206
 
199
- public SetParam(value: i32, vector: vector): void;
207
+ /**
208
+ * Set holder object exist state.
209
+ *
210
+ * @param is_enabled - whether holder object can be exited
211
+ */
212
+ public SetExitLocked(is_enabled: boolean): void;
200
213
  }
201
214
  }
@@ -54,11 +54,6 @@ declare module "xray16" {
54
54
  * @group xr_script_interface
55
55
  */
56
56
  export class callback {
57
- /**
58
- * Placeholder.
59
- */
60
- public static readonly dummy: -1;
61
-
62
57
  /**
63
58
  * Default x-ray 16 callbacks.
64
59
  */
@@ -98,28 +93,31 @@ declare module "xray16" {
98
93
  public static readonly trader_sound_end: 33;
99
94
  public static readonly take_item_from_box: 34;
100
95
  public static readonly weapon_no_ammo: 35;
101
-
102
- /**
103
- * Custom callbacks from open x-ray:
104
- */
105
- public static readonly key_press: 36;
106
- public static readonly key_release: 37;
107
- public static readonly key_hold: 38;
108
- public static readonly mouse_move: 39;
109
- public static readonly mouse_wheel: 40;
110
- public static readonly controller_press: 41;
111
- public static readonly controller_release: 42;
112
- public static readonly controller_hold: 43;
113
- public static readonly item_to_belt: 44;
114
- public static readonly item_to_slot: 45;
115
- public static readonly item_to_ruck: 46;
116
- public static readonly actor_before_death: 47;
117
- public static readonly on_attach_vehicle: 48;
118
- public static readonly on_detach_vehicle: 49;
119
- public static readonly on_use_vehicle: 50;
120
- public static readonly weapon_zoom_in: 51;
121
- public static readonly weapon_zoom_out: 52;
122
- public static readonly weapon_jammed: 53;
96
+ public static readonly hud_animation_end: 36;
97
+
98
+ public static readonly key_press: 37;
99
+ public static readonly key_release: 38;
100
+ public static readonly key_hold: 39;
101
+ public static readonly mouse_move: 40;
102
+ public static readonly mouse_wheel: 41;
103
+ public static readonly controller_press: 42;
104
+ public static readonly controller_release: 43;
105
+ public static readonly controller_hold: 44;
106
+ // public static readonly controller_attitude_change: 45;
107
+
108
+ public static readonly item_to_belt: 46;
109
+ public static readonly item_to_slot: 47;
110
+ public static readonly item_to_ruck: 48;
111
+
112
+ public static readonly weapon_zoom_in: 49;
113
+ public static readonly weapon_zoom_out: 50;
114
+ public static readonly weapon_jammed: 51;
115
+ public static readonly weapon_magazine_empty: 52;
116
+
117
+ public static readonly actor_before_death: 53;
118
+ public static readonly on_attach_vehicle: 54;
119
+ public static readonly on_detach_vehicle: 55;
120
+ public static readonly on_use_vehicle: 56;
123
121
  }
124
122
 
125
123
  /**
@@ -251,13 +249,13 @@ declare module "xray16" {
251
249
  type: TXR_callbacks["hit"],
252
250
  cb?:
253
251
  | ((
254
- this: void,
255
- object: game_object,
256
- damage: number,
257
- direction: vector,
258
- who: game_object,
259
- bone_id: number
260
- ) => void)
252
+ this: void,
253
+ object: game_object,
254
+ damage: number,
255
+ direction: vector,
256
+ who: game_object,
257
+ bone_id: number
258
+ ) => void)
261
259
  | null,
262
260
  object?: Maybe<T>
263
261
  ): void;
@@ -269,13 +267,13 @@ declare module "xray16" {
269
267
  type: TXR_callbacks["sound"],
270
268
  cb?:
271
269
  | ((
272
- this: void,
273
- object: game_object,
274
- source_id: number,
275
- sound_type: TXR_snd_type,
276
- position: vector,
277
- sound_power: number
278
- ) => void)
270
+ this: void,
271
+ object: game_object,
272
+ source_id: number,
273
+ sound_type: TXR_snd_type,
274
+ position: vector,
275
+ sound_power: number
276
+ ) => void)
279
277
  | null,
280
278
  object?: Maybe<T>
281
279
  ): void;
@@ -502,6 +502,8 @@ declare module "xray16" {
502
502
 
503
503
  public set_character_rank(value: i32): void;
504
504
 
505
+ public set_character_reputation(value: i32): void;
506
+
505
507
  public set_collision_off(value: boolean): void;
506
508
 
507
509
  public set_default_panic_threshold(): void;
@@ -620,6 +622,8 @@ declare module "xray16" {
620
622
 
621
623
  public change_goodwill(delta_goodwill: i32, to_object: game_object): void;
622
624
 
625
+ public change_character_rank(value: i32): void;
626
+
623
627
  public character_reputation(): i32;
624
628
 
625
629
  public community_goodwill(from_community: string): i32;
@@ -1302,24 +1306,85 @@ declare module "xray16" {
1302
1306
  public force_set_position(position: vector, bool: boolean): void;
1303
1307
 
1304
1308
  public get_ammo_count_for_type(type: u8): i32;
1309
+
1310
+ public weapon_in_grenade_mode(): boolean;
1311
+
1312
+ public is_entity_alive(): boolean;
1313
+
1314
+ public is_inventory_item(): boolean;
1315
+
1316
+ public is_inventory_owner(): boolean;
1317
+
1318
+ public is_actor(): boolean;
1319
+
1320
+ public is_custom_monster(): boolean;
1321
+
1322
+ public is_weapon(): boolean;
1323
+
1324
+ public is_outfit(): boolean;
1325
+
1326
+ public is_scope(): boolean;
1327
+
1328
+ public is_silencer(): boolean;
1329
+
1330
+ public is_grenade_launcher(): boolean;
1331
+
1332
+ public is_weapon_magazined(): boolean;
1333
+
1334
+ public is_space_restrictor(): boolean;
1335
+
1336
+ public is_stalker(): boolean;
1337
+
1338
+ public is_anomaly(): boolean;
1339
+
1340
+ public is_monster(): boolean;
1341
+
1342
+ public is_artefact(): boolean;
1343
+
1344
+ public is_ammo(): boolean;
1345
+
1346
+ public is_trader(): boolean;
1347
+
1348
+ public is_hud_item(): boolean;
1349
+
1350
+ public is_weapon_gl(): boolean;
1351
+
1352
+ public is_inventory_box(): boolean;
1305
1353
  }
1306
1354
 
1307
1355
  /*
1308
- * vector<MemorySpace::CNotYetVisibleObject,xalloc<MemorySpace::CNotYetVisibleObject> > not_yet_visible_objects();
1309
- * vector<MemorySpace::CSoundObject,xalloc<MemorySpace::CSoundObject>> memory_sound_objects();
1310
- * enum DetailPathManager::EDetailPathType detail_path_type();
1311
- * enum ETaskState get_task_state(char const*);
1312
- * enum MonsterSpace::EBodyState body_state();
1313
- * enum MonsterSpace::EBodyState target_body_state();
1314
- * enum MonsterSpace::EMentalState mental_state();
1315
- * enum MonsterSpace::EMentalState target_mental_state();
1316
- * enum MonsterSpace::EMovementType movement_type();
1317
- * enum MovementManager::EPathType path_type();
1318
- * remove_danger();
1319
- * remove_memory_sound_object();
1320
- * remove_memory_visible_object();
1321
- * remove_memory_hit_object();
1322
- * void iterate_feel_touch(function<void>);
1323
- * }
1324
- */
1356
+ * vector<MemorySpace::CNotYetVisibleObject,xalloc<MemorySpace::CNotYetVisibleObject> > not_yet_visible_objects();
1357
+ * vector<MemorySpace::CSoundObject,xalloc<MemorySpace::CSoundObject>> memory_sound_objects();
1358
+ * enum DetailPathManager::EDetailPathType detail_path_type();
1359
+ * enum ETaskState get_task_state(char const*);
1360
+ * enum MonsterSpace::EBodyState body_state();
1361
+ * enum MonsterSpace::EBodyState target_body_state();
1362
+ * enum MonsterSpace::EMentalState mental_state();
1363
+ * enum MonsterSpace::EMentalState target_mental_state();
1364
+ * enum MonsterSpace::EMovementType movement_type();
1365
+ * enum MovementManager::EPathType path_type();
1366
+ * remove_danger();
1367
+ * remove_memory_sound_object();
1368
+ * remove_memory_visible_object();
1369
+ * remove_memory_hit_object();
1370
+ * void iterate_feel_touch(function<void>);
1371
+ * }
1372
+ *
1373
+ * //.def("is_medkit", &CScriptGameObject::IsMedkit)
1374
+ * //.def("is_eatable_item", &CScriptGameObject::IsEatableItem)
1375
+ * //.def("is_antirad", &CScriptGameObject::IsAntirad)
1376
+ * //.def("is_game_object", &CScriptGameObject::IsGameObject)
1377
+ * //.def("is_car", &CScriptGameObject::IsCar)
1378
+ * //.def("is_helicopter", &CScriptGameObject::IsHeli)
1379
+ * //.def("is_holder", &CScriptGameObject::IsHolderCustom)
1380
+ * //.def("is_explosive", &CScriptGameObject::IsExplosive)
1381
+ * //.def("is_script_zone", &CScriptGameObject::IsScriptZone)
1382
+ * //.def("is_projector", &CScriptGameObject::IsProjector)
1383
+ * //.def("is_food_item", &CScriptGameObject::IsFoodItem)
1384
+ * //.def("is_missile", &CScriptGameObject::IsMissile)
1385
+ * //.def("is_physics_shell_holder", &CScriptGameObject::IsPhysicsShellHolder)
1386
+ * //.def("is_grenade", &CScriptGameObject::IsGrenade)
1387
+ * //.def("is_bottle_item", &CScriptGameObject::IsBottleItem)
1388
+ * //.def("is_torch", &CScriptGameObject::IsTorch)
1389
+ */
1325
1390
  }
@@ -75,7 +75,11 @@ declare module "xray16" {
75
75
  * @source C++ class cse_alife_inventory_item
76
76
  * @group xr_object_server
77
77
  */
78
- export interface IXR_cse_alife_inventory_item {}
78
+ export interface IXR_cse_alife_inventory_item {
79
+ has_upgrade(section: string): boolean;
80
+
81
+ add_upgrade(section: string): boolean;
82
+ }
79
83
 
80
84
  /**
81
85
  * @source C++ class cse_alife_object_breakable : cse_alife_dynamic_object_visual
@@ -343,6 +347,10 @@ declare module "xray16" {
343
347
  */
344
348
  export class cse_alife_item extends cse_alife_dynamic_object_visual implements IXR_cse_alife_inventory_item {
345
349
  public bfUseful(): boolean;
350
+
351
+ public has_upgrade(section: string): boolean;
352
+
353
+ public add_upgrade(section: string): boolean;
346
354
  }
347
355
 
348
356
  /**
@@ -354,6 +362,12 @@ declare module "xray16" {
354
362
  */
355
363
  export class cse_alife_item_weapon extends cse_alife_item {
356
364
  public clone_addons(cse_alife_item_weapon: cse_alife_item_weapon): void;
365
+
366
+ public set_ammo_elapsed(count: u16): void;
367
+
368
+ public get_ammo_elapsed(): u16;
369
+
370
+ public get_ammo_magsize(): u16;
357
371
  }
358
372
 
359
373
  /**
@@ -432,7 +446,7 @@ declare module "xray16" {
432
446
  * @customConstructor cse_alife_monster_rat
433
447
  * @group xr_object_server
434
448
  */
435
- export class cse_alife_monster_rat extends cse_alife_monster_abstract implements IXR_cse_alife_inventory_item {}
449
+ export class cse_alife_monster_rat extends cse_alife_monster_abstract {}
436
450
 
437
451
  /**
438
452
  * @source C++ class cse_alife_monster_zombie : cse_alife_monster_abstract
@@ -11,66 +11,68 @@ declare module "xray16" {
11
11
 
12
12
  public ParseShTexInfo(path: string): void;
13
13
 
14
- public Init3tButton(selector: string, window: CUIWindow | null): CUI3tButton;
14
+ public Init3tButton(selector: string, parent: CUIWindow | null): CUI3tButton;
15
15
 
16
- public InitAnimStatic(selector: string, window: CUIWindow | null): CUIStatic;
16
+ public InitAnimStatic(selector: string, parent: CUIWindow | null): CUIStatic;
17
17
 
18
- public InitCDkey(selector: string, window: CUIWindow | null): CUIEditBox;
18
+ public InitCDkey(selector: string, parent: CUIWindow | null): CUIEditBox;
19
19
 
20
- public InitCheck(selector: string, window: CUIWindow | null): CUICheckButton;
20
+ public InitCheck(selector: string, parent: CUIWindow | null): CUICheckButton;
21
21
 
22
- public InitComboBox(selector: string, window: CUIWindow | null): CUIComboBox;
22
+ public InitComboBox(selector: string, parent: CUIWindow | null): CUIComboBox;
23
23
 
24
- public InitEditBox(selector: string, window: CUIWindow | null): CUIEditBox;
24
+ public InitEditBox(selector: string, parent: CUIWindow | null): CUIEditBox;
25
25
 
26
- public InitFrame(selector: string, window: CUIWindow | null): CUIFrameWindow;
26
+ public InitFrame(selector: string, parent: CUIWindow | null): CUIFrameWindow;
27
27
 
28
- public InitFrameLine(selector: string, window: CUIWindow | null): CUIFrameLineWnd;
28
+ public InitFrameLine(selector: string, parent: CUIWindow | null): CUIFrameLineWnd;
29
29
 
30
- public InitKeyBinding(selector: string, window: CUIWindow | null): CUIWindow;
30
+ public InitKeyBinding(selector: string, parent: CUIWindow | null): CUIWindow;
31
31
 
32
- public InitLabel(selector: string, window: CUIWindow | null): CUIStatic;
32
+ public InitLabel(selector: string, parent: CUIWindow | null): CUIStatic;
33
33
 
34
- public InitList(selector: string, window: CUIWindow | null): CUIListWnd;
34
+ public InitList(selector: string, parent: CUIWindow | null): CUIListWnd;
35
35
 
36
36
  public InitListBox<T extends CUIListBoxItem = CUIListBoxItem>(
37
37
  selector: string,
38
- window: CUIWindow | null
38
+ parent: CUIWindow | null
39
39
  ): CUIListBox<T>;
40
40
 
41
- public InitMMShniaga(selector: string, window: CUIWindow | null): CUIMMShniaga;
41
+ public InitMMShniaga(selector: string, parent: CUIWindow | null): CUIMMShniaga;
42
42
 
43
- public InitMPPlayerName(selector: string, window: CUIWindow | null): CUIEditBox;
43
+ public InitMPPlayerName(selector: string, parent: CUIWindow | null): CUIEditBox;
44
44
 
45
- public InitMapInfo(selector: string, window: CUIWindow | null): CUIMapInfo;
45
+ public InitMapInfo(selector: string, parent: CUIWindow | null): CUIMapInfo;
46
46
 
47
- public InitMapList(selector: string, window: CUIWindow | null): CUIMapList;
47
+ public InitMapList(selector: string, parent: CUIWindow | null): CUIMapList;
48
48
 
49
- public InitProgressBar(selector: string, window: CUIWindow | null): CUIProgressBar;
49
+ public InitProgressBar(selector: string, parent: CUIWindow | null): CUIProgressBar;
50
50
 
51
- public InitScrollView(selector: string, window: CUIWindow | null): CUIScrollView;
51
+ public InitScrollView(selector: string, parent: CUIWindow | null): CUIScrollView;
52
52
 
53
- public InitServerList(selector: string, window: CUIWindow | null): CServerList;
53
+ public InitServerList(selector: string, parent: CUIWindow | null): CServerList;
54
54
 
55
- public InitSleepStatic(selector: string, window: CUIWindow | null): CUISleepStatic;
55
+ public InitSleepStatic(selector: string, parent: CUIWindow | null): CUISleepStatic;
56
56
 
57
- public InitSpinFlt(selector: string, window: CUIWindow | null): CUISpinFlt;
57
+ public InitSpinFlt(selector: string, parent: CUIWindow | null): CUISpinFlt;
58
58
 
59
- public InitSpinNum(selector: string, window: CUIWindow | null): CUISpinNum;
59
+ public InitSpinNum(selector: string, parent: CUIWindow | null): CUISpinNum;
60
60
 
61
- public InitSpinText(selector: string, window: CUIWindow | null): CUISpinText;
61
+ public InitSpinText(selector: string, parent: CUIWindow | null): CUISpinText;
62
62
 
63
- public InitStatic(selector: string, window: CUIWindow | null): CUIStatic;
63
+ public InitStatic(selector: string, parent: CUIWindow | null): CUIStatic;
64
64
 
65
- public InitTab(selector: string, window: CUIWindow | null): CUITabControl;
65
+ public InitTab(selector: string, parent: CUIWindow | null): CUITabControl;
66
66
 
67
- public InitTextWnd(selector: string, window: CUIWindow | null): CUITextWnd;
67
+ public InitTextWnd(selector: string, parent: CUIWindow | null): CUITextWnd;
68
68
 
69
- public InitTrackBar(selector: string, window: CUIWindow | null): CUITrackBar;
69
+ public InitTrackBar(selector: string, parent: CUIWindow | null): CUITrackBar;
70
70
 
71
- public InitVerList(selector: string, window: CUIWindow | null): CUIVersionList;
71
+ public InitVerList(selector: string, parent: CUIWindow | null): CUIVersionList;
72
72
 
73
- public InitWindow(selector: string, index: i32, window: CUIWindow | null): void;
73
+ public InitHint(selector: string, parent: CUIWindow | null): UIHint;
74
+
75
+ public InitWindow(selector: string, index: i32, parent: CUIWindow | null): void;
74
76
  }
75
77
 
76
78
  /**
@@ -378,5 +378,4 @@ declare module "xray16" {
378
378
  * @group xr_ui_event
379
379
  */
380
380
  export function dik_to_bind(this: void, keycode: i32): i32;
381
-
382
381
  }
@@ -1,3 +1,5 @@
1
+ import { vector2 } from "xray16";
2
+
1
3
  declare module "xray16" {
2
4
  /**
3
5
  * @source C++ class CUIWindow
@@ -152,6 +154,12 @@ declare module "xray16" {
152
154
  public SetVertScroll(enabled: boolean): void;
153
155
 
154
156
  public SetCurrentID(id: i32): void;
157
+
158
+ public SetCurrentIdx(index: u32): void;
159
+
160
+ public GetCurrentIdx(): u32;
161
+
162
+ public SetCurrentValue(): void;
155
163
  }
156
164
 
157
165
  /**
@@ -449,7 +457,7 @@ declare module "xray16" {
449
457
 
450
458
  public GetRange_min(): f32;
451
459
 
452
- public SetProgressPos(value: f32): void;
460
+ public SetProgressPos(position: f32): void;
453
461
 
454
462
  public GetProgressPos(): f32;
455
463
  }
@@ -469,6 +477,10 @@ declare module "xray16" {
469
477
  public Show(show: boolean): void;
470
478
 
471
479
  public Show(int1: i32, int2: i32): void;
480
+
481
+ public GetSelectedItem(): CUIListBoxItem;
482
+
483
+ public InitPropertiesBox(position: vector2, size: vector2): void;
472
484
  }
473
485
 
474
486
  /**
@@ -551,6 +563,8 @@ declare module "xray16" {
551
563
  export class CUIStatic extends CUIWindow {
552
564
  public GetColor(): u32;
553
565
 
566
+ public SetColor(color: u32): void;
567
+
554
568
  public TextControl(): CUILines;
555
569
 
556
570
  public GetTextureRect(): Frect;
@@ -565,6 +579,10 @@ declare module "xray16" {
565
579
 
566
580
  public SetTextColor(r: i32, g: i32, b: i32, a: i32): void;
567
581
 
582
+ public SetTextureColor(color: u32): void;
583
+
584
+ public GetTextureColor(): u32;
585
+
568
586
  public SetHeading(number: f32): void;
569
587
 
570
588
  public SetTextST(string: string): void;
@@ -587,8 +605,6 @@ declare module "xray16" {
587
605
 
588
606
  public SetTextureOffset(x: f32, y: f32): void;
589
607
 
590
- public SetColor(color: u32): void;
591
-
592
608
  public SetElipsis(a: i32, b: i32): void;
593
609
 
594
610
  public GetHeading(): f32;
@@ -829,6 +845,10 @@ declare module "xray16" {
829
845
  public GetActiveSection(): string;
830
846
 
831
847
  public GetTabControl(): CUITabControl;
848
+
849
+ public SetActiveDialog(dialog: CUIWindow | null): void;
850
+
851
+ public GetActiveDialog(): CUIWindow | null;
832
852
  }
833
853
 
834
854
  /**
@@ -850,6 +870,10 @@ declare module "xray16" {
850
870
  ): void;
851
871
 
852
872
  public refresh_current_cell_item(): void;
873
+
874
+ public ToSlot(object: game_object, force_place: boolean, slot_id: u16): boolean;
875
+
876
+ public ToBelt(object: game_object, use_cursor_position: boolean): boolean;
853
877
  }
854
878
 
855
879
  /**