Sidewall belt and screen drawing, cheaper cleat checks (t42, t43)
Far sidewall drawn behind the load with cleat ribs at their physics positions; sloped screens get a tinted mesh between rails and shake only when loaded. Powder skips cleat checks outside chunks that have cleats, and empty slopes let their chunks sleep. Record the screw conveyor and stall/carry-depth decisions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+36
-10
@@ -135,16 +135,42 @@ function screenLoaded(b) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Far sidewalls stay behind the load. The cleat raster is the simulation barrier raster.
|
||||
function slopeDetailAt(i, x, y) {
|
||||
// Filled far wall, in belt coordinates. Project onto the face so ends stop at the slope ends.
|
||||
let slopeWallOwner = -1;
|
||||
function slopeWallShape(x, y, b, code = blockP[b]) {
|
||||
const g = beltGrade(code), ox = b % BW * BS, oy = ((b / BW) | 0) * BS;
|
||||
const sy = g < 0 ? BS : 0, lx = x - ox, ly = y - oy - sy;
|
||||
const foot = (lx + g * ly) / 2, depth = (g * lx - ly) * Math.SQRT1_2;
|
||||
return Math.max(-foot * Math.SQRT2, (foot - BS) * Math.SQRT2, -depth, depth - CLEAT_HEIGHT);
|
||||
}
|
||||
function slopeWallAt(x, y, smooth = false) {
|
||||
slopeWallOwner = -1;
|
||||
let best = smooth ? 0.8 : 0;
|
||||
for (let by = Math.max(0, (y >> 2) - 1); by <= Math.min(BH - 1, (y >> 2) + 3); by++)
|
||||
for (let bx = Math.max(0, (x >> 2) - 2); bx <= Math.min(BW - 1, (x >> 2) + 2); bx++) {
|
||||
const b = by * BW + bx;
|
||||
if (!isBelt(blockP[b]) || !isSlopeBelt(blockP[b])) continue;
|
||||
const sd = slopeWallShape(x + 0.5, y + 0.5, b);
|
||||
if (sd <= best) { best = sd; slopeWallOwner = b; }
|
||||
}
|
||||
return slopeWallOwner;
|
||||
}
|
||||
// The load occludes the far wall; ribs use exactly the simulation barrier raster.
|
||||
function slopeDetailAt(i, x, y, smooth = false) {
|
||||
slopeWallOwner = -1;
|
||||
if (!slopeBeltHalo[(y >> 2) * BW + (x >> 2)] && !cleatMask[i]) return 0;
|
||||
if (occ[i] || mach[i] || (mat[i] !== EMPTY && PH[mat[i]] !== PH_GAS) || part[i]) return 0;
|
||||
if (cleatMask[i]) return 1;
|
||||
for (let by = y >> 2; by <= Math.min(BH - 1, (y + 9) >> 2); by++) {
|
||||
const b = by * BW + (x >> 2), c = blockP[b];
|
||||
if (!isSlopeBelt(c)) continue;
|
||||
const depth = beltFaceY(c, x >> 2, by, x) - y;
|
||||
if (isFilter(c) ? depth === 2 : depth >= 6 && depth <= 7 + ((x + slopePhase[b]) & 1)) return isFilter(c) ? 3 : 2;
|
||||
if (occ[i] || mach[i] || part[i]) return 0;
|
||||
if (cleatMask[i] && PH[mat[i]] !== PH_SOLID) return 1;
|
||||
if (mat[i] !== EMPTY && PH[mat[i]] !== PH_GAS) return 0;
|
||||
return slopeWallAt(x, y, smooth) >= 0 ? 2 : 0;
|
||||
}
|
||||
|
||||
function slopePreviewCleat(x, y, b, code) {
|
||||
const bx = b % BW, by = (b / BW) | 0, g = beltGrade(code);
|
||||
for (let h = 0; h <= CLEAT_REACH; h++) {
|
||||
const foot = x - g * h;
|
||||
if (foot >= bx * BS && foot < (bx + 1) * BS && foot % CLEAT_SPACING === 0 &&
|
||||
y + h + 1 === beltFaceY(code, bx, by, foot)) return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user