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

Only store changed properties for all components

This commit is contained in:
tobspr
2020-08-10 22:53:02 +02:00
parent bb431b8490
commit 9701a143ec
22 changed files with 100 additions and 152 deletions

View File

@@ -3,12 +3,9 @@ import { enumAngleToDirection, enumDirection, Vector } from "../../core/vector";
import { SOUNDS } from "../../platform/sound";
import { T } from "../../translations";
import { BeltComponent } from "../components/belt";
import { ItemAcceptorComponent } from "../components/item_acceptor";
import { ItemEjectorComponent } from "../components/item_ejector";
import { ReplaceableMapEntityComponent } from "../components/replaceable_map_entity";
import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
import { GameRoot, enumLayer } from "../root";
import { GameRoot } from "../root";
export const arrayBeltVariantToRotation = [enumDirection.top, enumDirection.left, enumDirection.right];
@@ -43,6 +40,10 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
return null;
}
getIsReplaceable() {
return true;
}
/**
* Creates the entity at the given location
* @param {Entity} entity
@@ -53,8 +54,6 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
direction: enumDirection.top, // updated later
})
);
// Make this entity replaceable
entity.addComponent(new ReplaceableMapEntityComponent());
}
/**

View File

@@ -3,7 +3,6 @@ import { enumItemType } from "../base_item";
import { HubComponent } from "../components/hub";
import { ItemAcceptorComponent } from "../components/item_acceptor";
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
import { UnremovableComponent } from "../components/unremovable";
import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
@@ -34,6 +33,10 @@ export class MetaHubBuilding extends MetaBuilding {
return null;
}
getIsRemovable() {
return false;
}
/**
* Creates the entity at the given location
* @param {Entity} entity
@@ -47,8 +50,6 @@ export class MetaHubBuilding extends MetaBuilding {
})
);
entity.addComponent(new UnremovableComponent());
entity.addComponent(
new WiredPinsComponent({
slots: [