Belts carry 4 grains deep; stalled belts warn and stop animating (t45)

This commit is contained in:
2026-10-29 23:21:27 -04:00
parent 99aae0aae0
commit ac5f5a06d1
27 changed files with 335 additions and 51 deletions
+16
View File
@@ -0,0 +1,16 @@
// t45: sustained normal (one layer) and heavy (16 layers) flat-belt feeds, open sink.
const {load,flatWorld}=require('../../test/harness');
const {run}=load();
for(const depth of [1,16]) {
flatWorld(run,256,224,208);
run(`RS=7;AMB.fill(20);temp.fill(20);hot.fill(0);weather.next=1e15;
for(let bx=10;bx<32;bx++)placeBlock(BP_BELT,1,bx,24,true);`);
const start=performance.now();
const rate=run(`(()=>{let out=0;for(let k=0;k<1420;k++){
for(let l=1;l<=${depth};l++){const i=(96-l)*W+44;if(mat[i]===EMPTY)setCell(i,SAND,20,0);}
simTick();
for(let y=0;y<H;y++)for(let x=128;x<W;x++){const i=y*W+x;if(mat[i]===SAND){if(k>=220)out++;setCell(i,EMPTY,20,0);}}
for(let j=flyers.length-1;j>=0;j--)if(flyers[j].m===SAND&&flyers[j].x>=128){if(k>=220)out++;flyers.splice(j,1);}
}return out/20;})()`);
console.log(`${depth===1?'normal':'heavy'}: ${rate.toFixed(1)} grains/s; ${((performance.now()-start)/1420).toFixed(3)} ms/tick including feed/sink`);
}