openrct2-plugin-boilerplate
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).
Installation
- Click "use this template" to create a repo using this boilerplate.
- Pull or download your project onto your computer.
- Run
npm install
to install all the required packages (Download Node.js if npm is not recognized). - In the package.json and
src/index.js
, replaceMYPLUGINNAME
with the name of your plugin, and replaceOPENRCT2PATH
with the path to your OpenRCT2 directory.
Build
You can build your project using the following commands:
npm run build
Manually build the projectnpm run watch build
Automatically build everytime a source file is updated If the installation was done correctly the transpiled JS file can be found in both thebuild
directory and in theplugin
directory of OpenRCT2. With hotreloading enabled and the watch command being used you no longer have to restart the game, and move files around manually.
Development
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).
Helper Suggestions
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";