mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-12 02:49:20 +00:00
Prevents some smart tunnel wrong belt removals (Issue #230).
This commit is contained in:
parent
d6c1cb15f6
commit
a416e16bfd
@ -104,9 +104,13 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
|
|||||||
return;
|
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();
|
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);
|
currentPos.addInplace(offset);
|
||||||
|
|
||||||
const contents = this.root.map.getTileContent(currentPos);
|
const contents = this.root.map.getTileContent(currentPos);
|
||||||
@ -121,9 +125,11 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
|
|||||||
// It's a belt
|
// It's a belt
|
||||||
if (
|
if (
|
||||||
contentsBeltComp.direction === enumDirection.top &&
|
contentsBeltComp.direction === enumDirection.top &&
|
||||||
enumAngleToDirection[contentsStaticComp.rotation] === direction
|
enumAngleToDirection[contentsStaticComp.rotation] === direction &&
|
||||||
|
(endSameDirection || i == end)
|
||||||
) {
|
) {
|
||||||
// It's same rotation, drop it
|
// It's same rotation, drop it
|
||||||
|
endSameDirection = endSameDirection || i == end;
|
||||||
this.root.logic.tryDeleteBuilding(contents);
|
this.root.logic.tryDeleteBuilding(contents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user