An ES6 boilerplate to create OpenRCT2 plugins with
OpenRCT2 plugin boilerplate
This boilerplate project (starting point to create OpenRCT2 plugins with) allows you to create a multi-file ES6 OpenRCT2 plugin and have it transpiled to a single ES5 file (Which OpenRCT2 supports).
- Clone or download the project and put it somewhere on your computer.
npm installto install all the required packages (Download Node.js if npm is not recognized).
- In the package.json and
MYPLUGINNAMEwith the name of your plugin, and replace
OPENRCT2PATHwith the path to your OpenRCT2 directory.
You can build your project using the following commands:
npm run buildManually build the project
npm run watch buildAutomatically build everytime a source file is updated If the installation was done correctly the transpiled JS file can be found in both the
builddirectory and in the
plugindirectory of OpenRCT2. With hotreloading enabled and the watch command being used you no longer have to restart the game, and move files around manually.
You can create your project in the
src directory. The
index.js file is the root of your project, from there feel free to import other modules (files).
Check out OliUI if you plan on incorporating a custom window in your plugin. OliUI takes away the hassle that comes with having to position every single UI element manually and instead lets you focus on the functionality.
OliUI is an ES6 module that is compatible with this boilerplate. Simple copy the OliUI module file into your project's
src/ folder and import the module.
import Oui from "./OliUI";