1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-09 16:21:51 +00:00

Remove savegame stats (achievements data)

No longer used as achievements are gone.

Also, avoid copying the old savegame dump object. This is possible
thanks to this change.
This commit is contained in:
Даниїл Григор'єв 2025-04-08 16:59:40 +03:00
parent 7ca3bf9664
commit 519128a70a
No known key found for this signature in database
GPG Key ID: B890DF16341D8C1D
3 changed files with 2 additions and 31 deletions

View File

@ -24,7 +24,6 @@ const logger = createLogger("savegame");
* @typedef {import("../game/root").GameRoot} GameRoot
* @typedef {import("./savegame_typedefs").SavegameData} SavegameData
* @typedef {import("./savegame_typedefs").SavegameMetadata} SavegameMetadata
* @typedef {import("./savegame_typedefs").SavegameStats} SavegameStats
* @typedef {import("./savegame_typedefs").SerializedGame} SerializedGame
*/
@ -99,11 +98,6 @@ export class Savegame extends ReadWriteProxy {
return {
version: this.getCurrentVersion(),
dump: null,
stats: {
failedMam: false,
trashedCount: 0,
usedInverseRotator: false,
},
lastUpdate: Date.now(),
mods: MODS.getModsListForSavegame(),
};
@ -196,13 +190,6 @@ export class Savegame extends ReadWriteProxy {
isSaveable() {
return true;
}
/**
* Returns the statistics of the savegame
* @returns {SavegameStats}
*/
getStatistics() {
return this.currentData.stats;
}
/**
* Returns the *real* last update of the savegame, not the one of the metadata
@ -273,7 +260,7 @@ export class Savegame extends ReadWriteProxy {
return false;
}
const shadowData = Object.assign({}, this.currentData);
const shadowData = {};
shadowData.dump = dump;
shadowData.lastUpdate = new Date().getTime();
shadowData.version = this.getCurrentVersion();

View File

@ -10,12 +10,6 @@
* }[]} SavegameStoredMods
*
* @typedef {{
* failedMam: boolean,
* trashedCount: number,
* usedInverseRotator: boolean
* }} SavegameStats
*
* @typedef {{
* camera: any,
* time: any,
* entityMgr: any,
@ -32,7 +26,6 @@
* @typedef {{
* version: number,
* dump: SerializedGame,
* stats: SavegameStats,
* lastUpdate: number,
* mods: SavegameStoredMods
* }} SavegameData

View File

@ -17,16 +17,7 @@ export class SavegameInterface_V1008 extends SavegameInterface_V1007 {
* @param {import("../savegame_typedefs.js").SavegameData} data
*/
static migrate1007to1008(data) {
// Note: no-op since achievement removal
logger.log("Migrating 1007 to 1008");
const dump = data.dump;
if (!dump) {
return true;
}
Object.assign(data.stats, {
failedMam: true,
trashedCount: 0,
usedInverseRotator: true,
});
}
}