diff --git a/src/render/cell.js b/src/render/cell.js index 86a66cb..34dfc6c 100644 --- a/src/render/cell.js +++ b/src/render/cell.js @@ -173,7 +173,7 @@ function cellPixel(x, y) { } else if (ly === 3) { // the belt's return run carries on under it, so belts and filters read as one belt const st = ((x - dir * (anim >> 1)) >> 1) & 1; if (m === EMPTY || st) { r = (st ? 92 : 56) * 0.72; g = (st ? 96 : 58) * 0.72; b = (st ? 104 : 66) * 0.72; } - } else if ((lx === 0 && !beltLike(fb, 0)) || (lx === 3 && !beltLike(fb, 1))) { if (m === EMPTY || ((x + y) & 1)) { r = 64; g = 66; b = 74; } } // frame only where the line ends + } else if ((lx === 0 && endJoin(fb % BW, (fb / BW) | 0, 0) < 0) || (lx === 3 && endJoin(fb % BW, (fb / BW) | 0, 1) < 0)) { if (m === EMPTY || ((x + y) & 1)) { r = 64; g = 66; b = 74; } } // frame only where the line ends else if (m === EMPTY) { // mesh holes, tinted with what falls through them if ((x + y) & 1) { r = 40; g = 42; b = 48; } else if (inv) { r = 58; g = 74; b = 72; } // carry mode: everything else drops diff --git a/src/render/setup.js b/src/render/setup.js index 9d25abc..3615d46 100644 --- a/src/render/setup.js +++ b/src/render/setup.js @@ -116,8 +116,6 @@ function thinPipeColor(x, y, anim) { } PC[0] = r; PC[1] = g; PC[2] = bl; } -// A filter frame opens only where this end has a geometric partner. -function beltLike(b, end) { return endJoin(b % BW, (b / BW) | 0, end) >= 0; } // standing trees: the trunk shows its dark bark, so it reads apart from the pale cut wood it drops const TREE_R = new Uint8Array(NMAT), TREE_G = new Uint8Array(NMAT), TREE_B = new Uint8Array(NMAT); for (let m = 0; m < NMAT; m++) { TREE_R[m] = COLR[m]; TREE_G[m] = COLG[m]; TREE_B[m] = COLB[m]; } diff --git a/test/t_joins.js b/test/t_joins.js index a4d7137..c41b7bb 100644 --- a/test/t_joins.js +++ b/test/t_joins.js @@ -102,14 +102,12 @@ check('equal-shape inlet ties use top to bottom then left to right',run(`(()=>{ })()`)); const fs=require('fs'); run(fs.readFileSync('src/render/slope-belts.js','utf8')); -const setup=fs.readFileSync('src/render/setup.js','utf8'); -run(setup.slice(setup.indexOf('function beltLike('),setup.indexOf('\n',setup.indexOf('function beltLike(')))); check('filter frames open at an uphill low-end feed and compatible screws',run(`(()=>{ blockP.fill(0);blockV.fill(0);const b=10*BW+10; blockP[b]=BP_FILTER;blockV[b]=255;blockP[b+1]=BP_BELT_UP;blockV[b+1]=1; - if(!beltLike(b,1))return false; - blockP[b+1]=BP_SCREW;blockV[b+1]=1;if(!beltLike(b,1))return false; - blockV[b+1]=3;return !beltLike(b,1); + if(endJoin(b%BW,(b/BW)|0,1)<0)return false; + blockP[b+1]=BP_SCREW;blockV[b+1]=1;if(endJoin(b%BW,(b/BW)|0,1)<0)return false; + blockV[b+1]=3;return endJoin(b%BW,(b/BW)|0,1)<0; })()`)); check('planned flat caps and slope continuations use the shared ends',run(`(()=>{ blockP.fill(0);blockV.fill(0);const b=10*BW+10;