This repository is designed to make it easier to write Battlefield (BF) Rule Editor scripts in TypeScript.
It provides the following features:
- When you push to GitHub, ESLint automatically checks your code syntax.
- Running
npm run buildcombines multiple .ts files into a single .ts file.- The BF Portal Rule Editor only accepts a single TypeScript file.
bfportal-vitest-mockandvitestare already installed, so you can easily use unit tests.
- Install Node.js. If you are new to JavaScript, it is recommended to download the .msi installer for the Windows x64 architecture from the following link and follow the installation steps: https://nodejs.org/en/download
- Download this repository.
- Place the PortalSDK/code folder from the official Battlefield 6 SDK into the code directory of this project.
- Run the command npm install.
- Write your program in the mods folder.
- After you finish coding, run the command npm run build.
- Upload
dist/Script.tsanddist/String.jsonto the BF Portal Rule Editor.
Add the strings you want to include in dist/String.json.
This project uses the bfportal-vitest-mock package. For how to install and use it, please refer to the section below.