Thanks W84Soft for that.
Click Save and Exit and wait until you will be back to the main menu.
- Restore c2runtime.js and data.js to original source code
- Add mods support without changing original files
- Mod selection from list
- Add server response simulator as mod
- Add working in-game map mod
- Creating helpers for better game control and easier creation of mods
Reload the page
- Open the game
- If you want to preserve your save
2.1. Enable theSave exporter & importer
mod
2.2. Export your save - Open site information (top left corner near the url)
- Go to Site settings
- Click Delete data
- Reload the game and import your save
If you want to create your own mod, add javascript file to mods/ folder. Now you must to add install function which must be exported.
Below is an example mod for listening to buttons that open links
export function install(){
const original_open=window.open;
window.open=function(url, target, windowFeatures){
console.log(url,target,windowFeatures);
original_open(url,target,windowFeatures);
}
}
Now you need to modify mods.json, add your new mod to list:
{
"mods":[
// Other mods:
{...},
// Your mod:
{
"name":"Example mod",
"description":"Example description",
"script":"example-script",
"version":"1.0.0"
}
]
}
Now you can start the server, e.g. via NodeJS http-server and run the game: