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
*/
setupEntityComponents(entity) {
entity.addComponent(new MinerComponent({}));
entity.addComponent(new MinerComponent());
entity.addComponent(
new ItemEjectorComponent({
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],

View File

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

View File

@ -77,7 +77,7 @@ export class Entity extends BasicSerializableObject {
static getSchema() {
return {
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 { ShapeDefinitionManager } from "./shape_definition_manager";
import { CanvasClickInterceptor } from "./canvas_click_interceptor";
import { PerlinNoise } from "../core/perlin_noise";
import { HubGoals } from "./hub_goals";
import { BufferMaintainer } from "../core/buffer_maintainer";
import { ProductionAnalytics } from "./production_analytics";

View File

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

View File

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

View File

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

View File

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