Skip to content

Commit 1948e15

Browse files
committed
Add network monitor window
1 parent 97d04de commit 1948e15

File tree

8 files changed

+463
-3
lines changed

8 files changed

+463
-3
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- name: Setup node.js
9+
uses: actions/setup-node@v2
10+
- name: Install modules
11+
run: |
12+
mv node_modules/@types .
13+
npm install
14+
mv @types node_modules
15+
- name: Build
16+
run: npm run build
17+
- name: Minify
18+
run: npm run minify
19+
- name: Upload artifacts
20+
uses: actions/upload-artifact@v2
21+
with:
22+
name: "OpenRCT2 DevTools"
23+
path: out/devtools.min.js

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
out/
2+
package-lock.json
3+
14
# Logs
25
logs
36
*.log

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 OpenRCT2
3+
Copyright (c) 2021 OpenRCT2 developers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
1-
# plugin-devtools
2-
Plugin for OpenRCT2 providing tools to aid development of OpenRCT2
1+
# OpenRCT2 DevTools Plugin
2+
3+
Plugin for OpenRCT2 providing tools to aid development of OpenRCT2.
4+
5+
## 🚀 Installation
6+
1. Download the latest version of the plugin from the [Releases page](https://github.com/OpenRCT2/devtools/releases).
7+
8+
2. To install it, put the downloaded `*.js` file into your `/OpenRCT2/plugin` folder.
9+
10+
* Easiest way to find the OpenRCT2-folder is by launching the OpenRCT2 game, click and hold on the red toolbox in the main menu, and select "Open custom content folder".
11+
* Otherwise this folder is commonly found in `C:\Users\<YOUR NAME>\Documents\OpenRCT2\plugin` on Windows.
12+
* If you already had this plugin installed before, you can safely overwrite the old file.
13+
* Once the file is there, it should show up ingame in the dropdown menu under the map icon.
14+
15+
3. Once the file is there, it should show up ingame in the dropdown menu under the map icon.
16+
17+
## 🔨 Building
18+
The plugin is written in TypeScript and requires compiling to JavaScript before it can be used in OpenRCT2. Ensure you have NodeJS and a package managed such as `npm` installed, then run the following:
19+
```
20+
npm install
21+
npm run build
22+
```
23+
24+
Then copy `out/devtools.js` to your OpenRCT2 plugin directory.
25+
26+
If you want to automatically update the plugin when you edit and save the TypeScript code, you can run:
27+
```
28+
npm run watch
29+
```
30+
This will watch for changes to the source code in the background and automatically compile and copy the plugin to your OpenRCT2 directory. This is currently only configured for Windows.
31+
32+
Make sure you have hot reload enabled in OpenRCT2 so that OpenRCT2 will automatically reload the plugin.
33+
34+
## ⚖️ Licence
35+
This plugin is licensed under the MIT licence.

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "openrct2-devtools",
3+
"version": "1.0.0",
4+
"description": "Plugin for OpenRCT2 providing tools to aid development of OpenRCT2",
5+
"license": "MIT",
6+
"author": "OpenRCT2",
7+
"main": "index.js",
8+
"scripts": {
9+
"build": "tsc",
10+
"minify": "uglifyjs --compress --mangle --output out/devtools.min.js -- out/devtools.js",
11+
"copy": "copy out\\devtools.js \"%HOMEDRIVE%%HOMEPATH%\\Documents\\OpenRCT2\\plugin\"",
12+
"watch": "tsc-watch --onSuccess \"npm run copy\""
13+
},
14+
"devDependencies": {
15+
"tsc-watch": "^4.2.9",
16+
"typescript": "^4.1.3",
17+
"uglify-js": "^3.12.5"
18+
}
19+
}

src/main.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const DEBUG = false;
2+
3+
const main = () => {
4+
if (typeof ui === 'undefined') {
5+
console.log("Plugin not available on headless mode.");
6+
return;
7+
}
8+
9+
NetworkMonitor.register();
10+
11+
if (DEBUG) {
12+
ui.closeAllWindows();
13+
NetworkMonitor.getOrOpen();
14+
}
15+
};
16+
17+
registerPlugin({
18+
name: 'DevTools',
19+
version: '1.0',
20+
authors: ['OpenRCT2'],
21+
type: 'local',
22+
licence: 'MIT',
23+
main: main
24+
});

0 commit comments

Comments
 (0)