Skip to content

Getting Started

xray16 provides TypeScript declarations, Node test helpers, and TypeScriptToLua plugins for Lua-visible X-Ray 16 APIs. Use it to compile XRF game scripts from TypeScript, including with stalker-xrf-engine.

Install

Install the SDK and its required TypeScriptToLua peer dependency:

sh
npm install xray16 typescript-to-lua

typescript-to-lua is the only required peer dependency. Install jest, ts-jest, and typescript when using xray16/testing. The fengari and ini dependencies used by xray16/mocks install automatically.

Add the base declarations to compilerOptions.types. Include only the ambient typedef packages your project uses.

jsonc
{
  "compilerOptions": {
    "types": [
      "@typescript-to-lua/language-extensions",
      "xray16",
      "xray16/typedefs/extensions",
      "xray16/typedefs/luajit",
    ],
  },
}

For an unreleased build, install xray16@experimental from npm or use the rolling nightly GitHub release:

sh
npm install https://github.com/xray-forge/stalker-xrf-xray16-sdk/releases/download/nightly/xray16-nightly.tgz

Entry points

ImportUse it for
xray16Engine globals, luabind classes, UI and GOAP classes, and script objects.
xray16/aliasReadable aliases for engine declaration names and virtual engine enums.
xray16/macrosCompile-time helpers with a Node/Jest fallback.
xray16/libShared aliases, constants, and small runtime helpers.
xray16/testingJest configuration and setup helpers.
xray16/mocksLua-like runtime helpers for Node-based tests.
xray16/typedefs/*Opt-in ambient declarations for X-Ray and bundled Lua libraries.
xray16/plugins/*TypeScriptToLua build plugins.

Next steps