|
|
|
@ -59,7 +59,11 @@ export class WiredPinsSystem extends GameSystemWithFilter {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (staticComp.getMetaBuilding().getIsReplaceable()) {
|
|
|
|
|
if (
|
|
|
|
|
staticComp
|
|
|
|
|
.getMetaBuilding()
|
|
|
|
|
.getIsReplaceable(staticComp.getVariant(), staticComp.getRotationVariant())
|
|
|
|
|
) {
|
|
|
|
|
// Don't mind here, even if there would be a collision we
|
|
|
|
|
// could replace it
|
|
|
|
|
continue;
|
|
|
|
@ -113,7 +117,12 @@ export class WiredPinsSystem extends GameSystemWithFilter {
|
|
|
|
|
|
|
|
|
|
// If there's an entity, and it can't get removed -> That's a collision
|
|
|
|
|
if (collidingEntity) {
|
|
|
|
|
if (!collidingEntity.components.StaticMapEntity.getMetaBuilding().getIsReplaceable()) {
|
|
|
|
|
const staticComp = collidingEntity.components.StaticMapEntity;
|
|
|
|
|
if (
|
|
|
|
|
!staticComp
|
|
|
|
|
.getMetaBuilding()
|
|
|
|
|
.getIsReplaceable(staticComp.getVariant(), staticComp.getRotationVariant())
|
|
|
|
|
) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -138,8 +147,11 @@ export class WiredPinsSystem extends GameSystemWithFilter {
|
|
|
|
|
const worldPos = entity.components.StaticMapEntity.localTileToWorld(slot.pos);
|
|
|
|
|
const collidingEntity = this.root.map.getLayerContentXY(worldPos.x, worldPos.y, "wires");
|
|
|
|
|
if (collidingEntity) {
|
|
|
|
|
const staticComp = entity.components.StaticMapEntity;
|
|
|
|
|
assertAlways(
|
|
|
|
|
collidingEntity.components.StaticMapEntity.getMetaBuilding().getIsReplaceable(),
|
|
|
|
|
staticComp
|
|
|
|
|
.getMetaBuilding()
|
|
|
|
|
.getIsReplaceable(staticComp.getVariant(), staticComp.getRotationVariant()),
|
|
|
|
|
"Tried to replace non-repleaceable entity for pins"
|
|
|
|
|
);
|
|
|
|
|
if (!this.root.logic.tryDeleteBuilding(collidingEntity)) {
|
|
|
|
|