Joins follow the travel direction: the next piece goes right after the end (t67 phase 2b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 14:09:28 -04:00
co-authored by Claude Opus 5.5
parent fd35bf334f
commit 45538cc18e
16 changed files with 363 additions and 236 deletions
+15 -3
View File
@@ -7,7 +7,11 @@ function slopeBeltConnections(bx, by, code, planned = null) {
const join = endJoin(bx, by, end, planned);
if (join < 0) continue;
const nb = join >> 1, next = planned && planned.get(nb);
joins |= (isSlopeBelt(next ? next[0] : blockP[nb]) ? 4 : 1) << end;
const slope = isSlopeBelt(next ? next[0] : blockP[nb]) &&
((nb / BW) | 0) - by === beltGrade(code) * (nb % BW - bx);
joins |= (slope ? 4 : 1) << end;
if (!slope && beltGrade(code) * (end ? 1 : -1) > 0 &&
((nb / BW) | 0) === by) joins |= 128; // low-end feed drops from the same-row flat
}
return joins;
}
@@ -56,11 +60,19 @@ function slopeBeltShape(x, y, b, joins = slopeBeltJoins[b], code = blockP[b]) {
const origin = (ox + grade * oy) * Math.SQRT1_2;
slopeBeltSegment(x, y, ax, ay, bx, by, origin + (ax + grade * ay) * Math.SQRT1_2);
if (joins & 1) {
slopeBeltSegment(x, y, -2, ay, ax, ay, ox - 2);
if ((joins & 128) && grade < 0) {
slopeBeltSegment(x, y, -2, 2, 0, 2, ox - 2);
slopeBeltSegment(x, y, 0, 2, 0, ay, ox);
slopeBeltSegment(x, y, 0, ay, ax, ay, ox);
} else slopeBeltSegment(x, y, -2, ay, ax, ay, ox - 2);
slopeBeltCorner(x, y, ax, ay, ox + ax);
}
if (joins & 2) {
slopeBeltSegment(x, y, bx, by, 6, by, ox + bx);
if ((joins & 128) && grade > 0) {
slopeBeltSegment(x, y, bx, by, 4, by, ox + bx);
slopeBeltSegment(x, y, 4, by, 4, 2, ox + 4);
slopeBeltSegment(x, y, 4, 2, 6, 2, ox + 4);
} else slopeBeltSegment(x, y, bx, by, 6, by, ox + bx);
slopeBeltCorner(x, y, bx, by, ox + bx);
}
return slopeDistance;