mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
33 lines
873 B
JavaScript
33 lines
873 B
JavaScript
|
// @ts-nocheck
|
||
|
const METADATA = {
|
||
|
website: "https://tobspr.io",
|
||
|
author: "tobspr",
|
||
|
name: "Mod Example: Mod Settings",
|
||
|
version: "1",
|
||
|
id: "mod-settings",
|
||
|
description: "Shows how to add settings to your mod",
|
||
|
minimumGameVersion: ">=1.5.0",
|
||
|
|
||
|
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 with 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`
|
||
|
);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|