You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tobspr_shapez.io/src/js/savegame/schemas/1002.js

40 lines
1.1 KiB

import { createLogger } from "../../core/logging.js";
import { T } from "../../translations.js";
import { SavegameInterface_V1001 } from "./1001.js";
const schema = require("./1002.json");
const logger = createLogger("savegame_interface/1002");
export class SavegameInterface_V1002 extends SavegameInterface_V1001 {
getVersion() {
return 1002;
}
getSchemaUncached() {
return schema;
}
/**
* @param {import("../savegame_typedefs.js").SavegameData} data
*/
static migrate1001to1002(data) {
logger.log("Migrating 1001 to 1002");
const dump = data.dump;
if (!dump) {
return true;
}
const entities = dump.entities;
for (let i = 0; i < entities.length; ++i) {
const entity = entities[i];
const beltComp = entity.components.Belt;
const ejectorComp = entity.components.ItemEjector;
if (beltComp && ejectorComp) {
// @ts-ignore
ejectorComp.instantEject = true;
}
}
}
}