From 868cd7baf5c996f28170a108f13daddcb86bf400 Mon Sep 17 00:00:00 2001 From: asquared31415 <34665709+asquared31415@users.noreply.github.com> Date: Mon, 10 Aug 2020 01:38:05 -0400 Subject: [PATCH] Mock V1000 StaticMapEntity (#550) --- src/js/savegame/schemas/1001.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/js/savegame/schemas/1001.js b/src/js/savegame/schemas/1001.js index e07c25cc..af86b09d 100644 --- a/src/js/savegame/schemas/1001.js +++ b/src/js/savegame/schemas/1001.js @@ -1,6 +1,7 @@ import { SavegameInterface_V1000 } from "./1000.js"; import { createLogger } from "../../core/logging.js"; import { T } from "../../translations.js"; +import { TypeVector, TypeNumber, TypeString, TypeNullable } from "../serialization_data_types.js"; const schema = require("./1001.json"); @@ -43,9 +44,25 @@ export class SavegameInterface_V1001 extends SavegameInterface_V1000 { for (let i = 0; i < entities.length; ++i) { const entity = entities[i]; - // FIXME - https://github.com/tobspr/shapez.io/issues/514 - // Broken in https://github.com/tobspr/shapez.io/commit/bf2eee908fedb84dbbabd359a200c446020a340e - /** @type any **/ + /** + * @typedef {{ + * origin: TypeVector, + * tileSize: TypeVector, + * rotation: TypeNumber, + * originalRotation: TypeNumber, + * spriteKey?: string, + * blueprintSpriteKey: string, + * silhouetteColor: string + * }} OldStaticMapEntity + */ + + // Here we mock the old type of the StaticMapEntity before the change to using + // a building ID based system (see building_codes.js) to stop the linter from + // complaining that the type doesn't have the properties. + // The ignored error is the error that the types do not overlap. In the case + // of a v1000 save though, the data will match the mocked type above. + /** @type OldStaticMapEntity **/ + // @ts-ignore const staticComp = entity.components.StaticMapEntity; const beltComp = entity.components.Belt; if (staticComp) {