Nozzle and rain count only their own grains in flight; factory launches uncapped (t95)

This commit is contained in:
2026-10-29 18:12:47 -04:00
parent 3b427aeecc
commit d936f65553
5 changed files with 62 additions and 3 deletions
+33
View File
@@ -29,4 +29,37 @@ for (const distance of [run('3 * REACH'), run('5 * REACH')]) {
const nearby = blowSand(30, 0);
check('aiming inside reach still lands sand around the cursor', nearby.cursorDistance <= BRUSH_AND_SETTLING_MARGIN, nearby.cursorDistance.toFixed(2));
// Factory launches must not consume the nozzle or weather allowances.
flatWorld(run, 640, 512, 480);
run(`bag[SAND] = 30000; bagTotal = 30000;
placeBlock(BP_BELT, 1, 20, 20, true);
for (let k = 0; k < 10000; k++) {
const i = 79 * W + 83; setCell(i, SAND, 20, 0);
tickStamp++; carryColumn(i, 1, null);
}`);
check('a belt chute launches ten thousand grains without a shared cap', run('flyers.length === 10000 && mat[79*W+83] === EMPTY'));
check('busy chutes do not pause the nozzle', run('toolBlow(330, 400, 6, SAND).placed === 25'));
check('busy chutes and nozzle do not pause rain', run('spawnRain(0, W, 10) === 10'));
run(`flyers.length = 0; for (let k = 0; k < 3001; k++) toolBlow(330, 400, 0, SAND);`);
check('a long hold continues past the old shared limit', run('toolBlow(330, 400, 0, SAND).placed === 1'));
run(`flyers.length = 0; for (let k = 0; k < 3999; k++) toolBlow(330, 400, 0, SAND);`);
check('wide nozzle stops exactly at its own raised allowance', run('toolBlow(330, 400, 6, SAND).placed === 1 && flyers.length === 4000'));
check('nozzle limit explains the pause and keeps the bag intact', run(`(() => {
const before = bag[SAND], r = toolBlow(330, 400, 6, SAND);
return r.placed === 0 && r.status === 'Too much in the air.' && bag[SAND] === before;
})()`));
check('nozzle allowance does not stop rain', run('spawnRain(0, W, 2501) === 2500'));
check('rain stops at its own allowance', run('spawnRain(0, W, 1) === 0'));
run('flyers.splice(0, 1)');
check('nozzle resumes as soon as one own grain leaves flight', run('toolBlow(330, 400, 6, SAND).placed === 1'));
run('setCell(100*W+100, SAND, 20, 0); launchGrain(100*W+100, 100, 40, 0, 0)');
check('production continues with both allowances full', run('flyers.length === 6501 && !flyers[6500].bag && !flyers[6500].rain'));
run(`flyers.length=0; spawnRain(0, W, 2500);`);
check('full rain allowance does not block the nozzle', run('toolBlow(330, 400, 6, SAND).placed === 25'));
run('flyers.length=0; spawnRain(0,W,2500); for(const f of flyers) f.age=900; flyTick();');
check('rain can resume after its grains land', run('spawnRain(0,W,1) === 1'));
run('flyers.length=0; bag[SAND]=10000; bagTotal=10000;');
run(`for(let k=0;k<3999;k++) toolBlow(330,400,0,SAND); toolVacuum(330,450,100,()=>true);`);
check('vacuum removal also frees nozzle allowance', run('toolBlow(330,400,6,SAND).placed > 1'));
done();