1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 18:21:51 +00:00
tobspr_shapez.io/mod_examples/mod_settings.js

32 lines
834 B
JavaScript
Raw Normal View History

2022-01-17 11:15:57 +00:00
// @ts-nocheck
const METADATA = {
website: "https://tobspr.io",
author: "tobspr",
name: "Mod Example: Mod Settings",
version: "1",
id: "base",
description: "Shows how to add settings to your mod",
settings: {
timesLaunched: 0,
},
};
class Mod extends shapez.Mod {
init() {
// Increment the setting every time we launch the mod
this.settings.timesLaunched++;
this.saveSettings();
// Show a dialog in the main menu wit the settings
this.signals.stateEntered.add(state => {
if (state instanceof shapez.MainMenuState) {
this.dialogs.showInfo(
"Welcome back",
"You have launched this mod " + this.settings.timesLaunched + " times"
);
}
});
}
}