1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Prevents some smart tunnel wrong belt removals (Issue #230).

This commit is contained in:
Magnus Grimstvedt Saltnes 2020-06-20 09:39:15 +02:00
parent d6c1cb15f6
commit a416e16bfd

View File

@ -104,9 +104,13 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
return;
}
// Remove any belts between entrance and exit which have the same direction
// Remove any belts between entrance and exit
// - which have the same direction
// - if the last belt is pointed into the exit
let endSameDirection = false;
currentPos = tile.copy();
for (let i = 0; i < matchingEntrance.range; ++i) {
const end = matchingEntrance.range - 1;
for (let i = end; i >= 0; i--) {
currentPos.addInplace(offset);
const contents = this.root.map.getTileContent(currentPos);
@ -121,9 +125,11 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
// It's a belt
if (
contentsBeltComp.direction === enumDirection.top &&
enumAngleToDirection[contentsStaticComp.rotation] === direction
enumAngleToDirection[contentsStaticComp.rotation] === direction &&
(endSameDirection || i == end)
) {
// It's same rotation, drop it
endSameDirection = endSameDirection || i == end;
this.root.logic.tryDeleteBuilding(contents);
}
}