Corner placements of screw conveyors stay separate ends (t62 follow-up)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 12:32:23 -04:00
co-authored by Claude Opus 5.5
parent ff9fd7b1b8
commit 787721ad35
11 changed files with 115 additions and 102 deletions
+6 -16
View File
@@ -176,20 +176,6 @@ function screwIntake(i, p, dx, dy) {
}
}
// A straight mouth can feed a diagonal tail one block across the corner.
function straightScrewNext(i, p) {
const dx = SCREW_DX[p], dy = SCREW_DY[p], x = i % W, y = (i / W) | 0;
const xx = x + dx, yy = y + dy, next = i + dx + dy * W;
if (xx < 0 || yy < 0 || xx >= W || yy >= H) return -1;
if (((xx >> 2) === (x >> 2) && (yy >> 2) === (y >> 2)) || part[next] || blockP[(yy >> 2) * BW + (xx >> 2)]) return next;
for (let side = -1; side <= 1; side += 2) {
const nx = xx + (dx ? 0 : side * BS), ny = yy + (dy ? 0 : side * BS);
if (nx < 0 || ny < 0 || nx >= W || ny >= H) continue;
const j = ny * W + nx, q = part[j];
if (SCREW_DX[q] === (dx || side) && SCREW_DY[q] === (dy || side)) return j;
}
return next;
}
// Four lanes cross a block in four beats; the casing carries every lane across the corner.
// Prefer the next diagonal block, then either straight join, then the open head.
function diagonalScrewNext(i, p) {
@@ -198,11 +184,15 @@ function diagonalScrewNext(i, p) {
if (xx < 0 || xx >= W) return -1;
if ((xx >> 2) === (x >> 2)) return i + dx;
const yy = y + dy * BS;
if (yy >= 0 && yy < H && IS_SCREW[part[yy * W + xx]]) return yy * W + xx;
if (yy >= 0 && yy < H) {
const q = part[yy * W + xx];
if (q >= P_SCREW_UR && q <= P_SCREW_UL && SCREW_DX[q] === dx && SCREW_DY[q] === dy) return yy * W + xx;
}
if (IS_SCREW[part[y * W + xx]]) return y * W + xx;
if (dy > 0 && yy < H && (mat[yy * W + xx] === BELTL || mat[yy * W + xx] === BELTR)) return ((yy & ~3) - 1) * W + xx;
const hy = by + (dy > 0 ? BS : -1), hx = bx + (y & 3);
if (hy >= 0 && hy < H && IS_SCREW[part[hy * W + hx]]) return hy * W + hx;
// An open mouth discharges along the diagonal, clear of the last block.
return yy >= 0 && yy < H ? yy * W + xx : -1;
// A corner screw is a separate end, not an open discharge cell.
return yy >= 0 && yy < H && !IS_SCREW[part[yy * W + xx]] ? yy * W + xx : -1;
}