1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2024-10-27 20:34:29 +00:00

Fix hub being removable after restoring a game, fix tslint errors

This commit is contained in:
tobspr 2020-05-14 22:46:31 +02:00
parent a1fd83c03c
commit b64bbc8132
8 changed files with 10 additions and 17 deletions

View File

@ -26,7 +26,7 @@ export class MetaMinerBuilding extends MetaBuilding {
* @param {Entity} entity * @param {Entity} entity
*/ */
setupEntityComponents(entity) { setupEntityComponents(entity) {
entity.addComponent(new MinerComponent({})); entity.addComponent(new MinerComponent());
entity.addComponent( entity.addComponent(
new ItemEjectorComponent({ new ItemEjectorComponent({
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }], slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],

View File

@ -4,4 +4,8 @@ export class UnremovableComponent extends Component {
static getId() { static getId() {
return "Unremovable"; return "Unremovable";
} }
static getSchema() {
return {};
}
} }

View File

@ -77,7 +77,7 @@ export class Entity extends BasicSerializableObject {
static getSchema() { static getSchema() {
return { return {
uid: types.uint, uid: types.uint,
components: types.keyValueMap(types.objData(gComponentRegistry), false), components: types.keyValueMap(types.objData(gComponentRegistry)),
}; };
} }

View File

@ -20,7 +20,6 @@ import { Savegame } from "../savegame/savegame";
import { GameLogic } from "./logic"; import { GameLogic } from "./logic";
import { ShapeDefinitionManager } from "./shape_definition_manager"; import { ShapeDefinitionManager } from "./shape_definition_manager";
import { CanvasClickInterceptor } from "./canvas_click_interceptor"; import { CanvasClickInterceptor } from "./canvas_click_interceptor";
import { PerlinNoise } from "../core/perlin_noise";
import { HubGoals } from "./hub_goals"; import { HubGoals } from "./hub_goals";
import { BufferMaintainer } from "../core/buffer_maintainer"; import { BufferMaintainer } from "../core/buffer_maintainer";
import { ProductionAnalytics } from "./production_analytics"; import { ProductionAnalytics } from "./production_analytics";

View File

@ -128,7 +128,6 @@ export class SavegameSerializer {
if (!verifyResult.result) { if (!verifyResult.result) {
return ExplainedResult.bad(verifyResult.reason); return ExplainedResult.bad(verifyResult.reason);
} }
console.log("SAVEGAME:", savegame);
let errorReason = null; let errorReason = null;
errorReason = errorReason || root.entityMgr.deserialize(savegame.entityMgr); errorReason = errorReason || root.entityMgr.deserialize(savegame.entityMgr);

View File

@ -18,10 +18,9 @@
* camera: any, * camera: any,
* time: any, * time: any,
* entityMgr: any, * entityMgr: any,
* entities: { * map: any,
* resources: Array<SerializedMapResource>, * hubGoals: any,
* buildings: Array<any> * entities: Array<any>
* }
* }} SerializedGame * }} SerializedGame
*/ */

View File

@ -33,12 +33,8 @@ export class SerializerInternal {
*/ */
deserializeEntityArray(root, array) { deserializeEntityArray(root, array) {
for (let i = 0; i < array.length; ++i) { for (let i = 0; i < array.length; ++i) {
const errorState = this.deserializeEntity(root, array[i]); this.deserializeEntity(root, array[i]);
if (errorState) {
return errorState;
}
} }
return null;
} }
/** /**

View File

@ -67,10 +67,6 @@ export class InGameState extends GameState {
this.savegame; this.savegame;
this.boundInputFilter = this.filterInput.bind(this); this.boundInputFilter = this.filterInput.bind(this);
if (G_IS_DEV) {
window.performSave = this.doSave.bind(this);
}
} }
/** /**