Wall drags at 45° lay slopes; diagonal tubes drawn as one pipe; no side arrow on drag ghosts (t35, t36)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+31
-4
@@ -2,13 +2,19 @@
|
||||
const { load, suite, flatWorld, rect, count, ticks } = require('./harness');
|
||||
const { run } = load();
|
||||
const { check, done } = suite();
|
||||
// Wall selection drives the same saved slope codes and sealed funnel geometry.
|
||||
const fs = require('fs');
|
||||
run(fs.readFileSync('src/ui/selection.js', 'utf8'));
|
||||
run(`const GAME = { pieceDir: {}, drag: null }; let hudDirty = false;
|
||||
function aimBlock() { return { bx: 23, by: 23 }; }`);
|
||||
function fresh() { flatWorld(run, 240, 192, 176); run('AMB.fill(20);temp.fill(20);'); }
|
||||
function funnel(sloped, material) {
|
||||
fresh();
|
||||
run(`for (let k=0;k<12;k++) {
|
||||
placeBlock(${sloped ? 'BP_SLOPE_BL' : 'BP_WALL'}, RSTONE, 12+k, 12+k, true);
|
||||
placeBlock(${sloped ? 'BP_SLOPE_BR' : 'BP_WALL'}, RSTONE, 36-k, 12+k, true);
|
||||
}`);
|
||||
run(`for (const [ax,ay,bx,by] of [[12,12,23,23],[36,12,25,23]]) {
|
||||
GAME.drag={bx:ax,by:ay};
|
||||
const code=${sloped ? 'pieceCode(PIECE_BY_ID.wall,{bx,by})' : 'BP_WALL'};
|
||||
for(const [x,y] of blockLine(ax,ay,bx,by,true)) placeBlock(code,RSTONE,x,y,true);
|
||||
} GAME.drag=null;`);
|
||||
rect(run, 80, 20, 119, 29, material);
|
||||
ticks(run, 1800);
|
||||
const out = count(run, material, 0, 96, 239, 175);
|
||||
@@ -87,4 +93,25 @@ run('placeBlock(BP_SLOPE_BL,RSTONE,20,20,true);placeBlock(BP_WALL,RSTONE,20,21,t
|
||||
check('removing an adjoining square wall restores the slope seal',run('mat[slopeSeal(BP_SLOPE_BL,20,20)]===STONE'));
|
||||
run('removeBlock(20,20)');
|
||||
check('removal leaves no free seal grains behind',count(run,run('STONE'),80,80,83,87)===0);
|
||||
check('old saved slope codes select Wall', run("Array.from({length:4},(_,k)=>PIECE_BY_CODE[15+k].id).every(id=>id==='wall')"));
|
||||
check('single Wall starts square', run('pieceCode(PIECE_BY_ID.wall)===BP_WALL'));
|
||||
const shapes = [];
|
||||
for (let k=0;k<5;k++) { run('turnSlope()'); shapes.push(run('pieceCode(PIECE_BY_ID.wall)')); }
|
||||
check('T cycles square then four corners then square', JSON.stringify(shapes)===JSON.stringify([15,16,17,18,1]), shapes);
|
||||
run('GAME.drag={bx:20,by:20}');
|
||||
check('diagonal Wall defaults below', run('pieceCode(PIECE_BY_ID.wall)===BP_SLOPE_BL'));
|
||||
run('turnSlope()');
|
||||
check('T flips diagonal Wall above', run('pieceCode(PIECE_BY_ID.wall)===BP_SLOPE_TR'));
|
||||
run('GAME.drag=null');
|
||||
check('drag flip preserves single square choice',run('pieceCode(PIECE_BY_ID.wall)===BP_WALL'));
|
||||
run('GAME.pieceDir.wall=3;GAME.drag={bx:20,by:23}');
|
||||
check('straight Wall drag stays square even with a corner selected',run('pieceCode(PIECE_BY_ID.wall)===BP_WALL'));
|
||||
run('GAME.drag=null;GAME.pieceDir.wall=1');
|
||||
check('single Wall slope shows its half-block price',run('pieceCostNow(PIECE_BY_ID.wall,RSTONE)[0][1]===8'));
|
||||
// Fixture saved before Wall absorbed the separate Sloped wall piece (save version 2).
|
||||
const legacy = JSON.parse(require('zlib').gunzipSync(fs.readFileSync(__dirname+'/fixtures/slopes-v2.json.gz')));
|
||||
globalThis.legacySlopeSave = legacy;
|
||||
run('deserializeWorld(legacySlopeSave.meta,legacySlopeSave.buffers)');
|
||||
check('old save loads all four slope corners unchanged',run('Array.from({length:4},(_,k)=>{const b=6*BW+2+k*3;return blockP[b]===15+k && blockV[b]===RSTONE && blockIntegrity(b)===10 && PIECE_BY_CODE[blockP[b]].id===\'wall\';}).every(Boolean)'));
|
||||
delete globalThis.legacySlopeSave;
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user