1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Add multiplace setting

This commit is contained in:
tobspr
2020-05-23 10:57:02 +02:00
parent 714332a91d
commit 1561246dc4
4 changed files with 24 additions and 9 deletions

View File

@@ -111,13 +111,11 @@ export const allApplicationSettings = [
textGetter: rate => rate + " Hz",
category: categoryGame,
restartRequired: false,
changeCb:
/**
* @param {Application} app
*/
(app, id) => {},
changeCb: (app, id) => {},
enabled: !IS_DEMO,
}),
new BoolSetting("alwaysMultiplace", categoryGame, (app, value) => {}),
];
export function getApplicationSettingById(id) {
@@ -134,6 +132,8 @@ class SettingsStorage {
this.theme = "light";
this.refreshRate = "60";
this.alwaysMultiplace = false;
/**
* @type {Object.<string, number>}
*/
@@ -291,14 +291,20 @@ export class ApplicationSettings extends ReadWriteProxy {
}
getCurrentVersion() {
return 5;
return 6;
}
migrate(data) {
// Simply reset
if (data.version < this.getCurrentVersion()) {
// Simply reset before
if (data.version < 5) {
data.settings = new SettingsStorage();
data.version = this.getCurrentVersion();
return ExplainedResult.good();
}
if (data.version < 6) {
data.alwaysMultiplace = false;
data.version = 6;
}
return ExplainedResult.good();