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

@@ -52,7 +52,7 @@ export class WiredPinsSystem extends GameSystemWithFilter {
continue;
}
if (otherEntity.components.ReplaceableMapEntity) {
if (staticComp.getMetaBuilding().getIsReplaceable()) {
// Don't mind here, even if there would be a collision we
// could replace it
continue;
@@ -105,8 +105,10 @@ export class WiredPinsSystem extends GameSystemWithFilter {
const collidingEntity = this.root.map.getLayerContentXY(worldPos.x, worldPos.y, enumLayer.wires);
// If there's an entity, and it can't get removed -> That's a collision
if (collidingEntity && !collidingEntity.components.ReplaceableMapEntity) {
return true;
if (collidingEntity) {
if (!collidingEntity.components.StaticMapEntity.getMetaBuilding().getIsReplaceable()) {
return true;
}
}
}
return false;
@@ -130,7 +132,7 @@ export class WiredPinsSystem extends GameSystemWithFilter {
const collidingEntity = this.root.map.getLayerContentXY(worldPos.x, worldPos.y, enumLayer.wires);
if (collidingEntity) {
assertAlways(
collidingEntity.components.ReplaceableMapEntity,
collidingEntity.components.StaticMapEntity.getMetaBuilding().getIsReplaceable(),
"Tried to replace non-repleaceable entity for pins"
);
if (!this.root.logic.tryDeleteBuilding(collidingEntity)) {