Shared drag placement; drags snap one block to join a diagonal (t67 phases 3-4)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -167,4 +167,24 @@ for(const grade of [-1,1])for(const below of [false,true]) {
|
||||
})()`);
|
||||
check(`grade ${grade} belt low end accepts sand from ${below?'below':'same row'} and carries it up`,r[0]&&r[1],r);
|
||||
}
|
||||
// Snapping (t67 phase 4): a drag moves one block up or down only to make a seamless join
|
||||
// involving a diagonal piece, and only when every block there is free.
|
||||
const snap = (setup, code, v, cells) => { flatWorld(run, 96, 96, 92); return run(`(()=>{${setup};return joinSnap(${code},${v},${JSON.stringify(cells)});})()`); };
|
||||
check('an uphill belt started beside a flat belt on the same level snaps up one to join seamlessly',
|
||||
snap('placeBlock(BP_BELT,1,10,10,true)', 'BP_BELT_UP', 1, [[11,10],[12,9],[13,8]]) === -1);
|
||||
check('the snapped uphill belt then joins the flat belt',
|
||||
run('(()=>{placeBlocks(BP_BELT_UP,1,[[11,9],[12,8],[13,7]]);return endJoin(10,10,1)===(9*BW+11)*2+0||endJoin(11,9,0)>=0;})()'));
|
||||
check('an uphill belt already one block up stays put',
|
||||
snap('placeBlock(BP_BELT,1,10,10,true)', 'BP_BELT_UP', 1, [[11,9],[12,8]]) === 0);
|
||||
check('no snap when a block above is taken; the same-row drop join stays',
|
||||
snap('placeBlock(BP_BELT,1,10,10,true);placeBlock(BP_WALL,RSTONE,12,8,true)', 'BP_BELT_UP', 1, [[11,10],[12,9]]) === 0);
|
||||
check('a flat belt beside another flat belt one row off never jumps',
|
||||
snap('placeBlock(BP_BELT,1,10,10,true)', 'BP_BELT', 1, [[11,11],[12,11],[13,11]]) === 0);
|
||||
check('a flat belt started level with a downhill belt low end snaps down one (t58)',
|
||||
snap('placeBlock(BP_BELT_DOWN,1,10,10,true);placeBlock(BP_BELT_DOWN,1,11,11,true)', 'BP_BELT', 1, [[12,11],[13,11]]) === 1);
|
||||
check('a downhill screw started one block right and one lower than a screw end snaps up to the same row',
|
||||
snap('placeBlock(BP_SCREW,1,10,10,true)', 'BP_SCREW', 5, [[11,11],[12,12]]) === -1);
|
||||
check('a screw that already joins stays put',
|
||||
snap('placeBlock(BP_SCREW,1,10,10,true)', 'BP_SCREW', 5, [[11,10],[12,11]]) === 0);
|
||||
check('pieces with no join ends never snap', snap('', 'BP_PIPE', 0, [[11,10]]) === 0);
|
||||
done();
|
||||
|
||||
@@ -219,6 +219,11 @@ for(const id of ['belt','filter'])for(const [dx,dy] of [[3,-3],[3,3],[-3,3],[-3,
|
||||
check(`${id} a single replacement keeps the selected direction`,run(`blockP[${20+dy}*BW+${20+dx}]===${c} && blockV[${20+dy}*BW+${20+dx}]===${id==='filter'?v:1-v}`));
|
||||
|
||||
}
|
||||
// The owner's drag: a flat belt, then an uphill drag started beside its end on the same level,
|
||||
// snaps up one block through the real release so the two join seamlessly.
|
||||
fresh();
|
||||
run("globalThis.piece=()=>PIECE_BY_ID.belt;placeBlock(BP_BELT,1,19,20,true);GAME.drag={bx:20,by:20};GAME.aim={x:23*4,y:17*4};bot.x=80;bot.y=80;primaryRelease(false);");
|
||||
check('uphill drag beside a flat belt end snaps up one and joins it', run('blockP[20*BW+20]===0 && blockP[19*BW+20]===BP_BELT_UP && blockP[16*BW+23]===BP_BELT_UP && endJoin(19,20,1)>=0 && !joinIsDrop(19,20,1,endJoin(19,20,1))'));
|
||||
// Middle click on the belt band you see, even where it is drawn into the empty block next door.
|
||||
fresh();
|
||||
const band=run(`(()=>{globalThis.R=globalThis.R||{smoothOn:false};
|
||||
|
||||
Reference in New Issue
Block a user