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

store waypoints in savegame

This commit is contained in:
tobspr
2020-05-28 20:03:35 +02:00
parent 80a1908c57
commit 3071bba633
5 changed files with 55 additions and 9 deletions

View File

@@ -39,6 +39,7 @@ export class SavegameSerializer {
entityMgr: root.entityMgr.serialize(),
hubGoals: root.hubGoals.serialize(),
pinnedShapes: root.hud.parts.pinnedShapes.serialize(),
waypoints: root.hud.parts.waypoints.serialize(),
};
data.entities = this.internal.serializeEntityArray(root.entityMgr.entities);
@@ -137,6 +138,7 @@ export class SavegameSerializer {
errorReason = errorReason || root.map.deserialize(savegame.map);
errorReason = errorReason || root.hubGoals.deserialize(savegame.hubGoals);
errorReason = errorReason || root.hud.parts.pinnedShapes.deserialize(savegame.pinnedShapes);
errorReason = errorReason || root.hud.parts.waypoints.deserialize(savegame.waypoints);
errorReason = errorReason || this.internal.deserializeEntityArray(root, savegame.entities);
// Check for errors

View File

@@ -13,6 +13,7 @@ import { Entity } from "../game/entity";
* map: any,
* hubGoals: any,
* pinnedShapes: any,
* waypoints: any,
* entities: Array<Entity>
* }} SerializedGame
*/

View File

@@ -1,5 +1,6 @@
import { SavegameInterface_V1000 } from "./1000.js";
import { createLogger } from "../../core/logging.js";
import { T } from "../../translations.js";
const schema = require("./1001.json");
@@ -27,6 +28,16 @@ export class SavegameInterface_V1001 extends SavegameInterface_V1000 {
dump.pinnedShapes = {
shapes: [],
};
dump.waypoints = {
waypoints: [
{
label: T.ingame.waypoints.hub,
center: { x: 0, y: 0 },
zoomLevel: 3,
deletable: false,
},
],
};
const entities = dump.entities;
for (let i = 0; i < entities.length; ++i) {