22 lines
908 B
JavaScript
22 lines
908 B
JavaScript
// Shared reproduction: continuously blow plain bagged sand straight above a stationary bot.
|
|
function pileBlowSetup() {
|
|
pileCutWorld();
|
|
for (let x=0;x<W;x++) { surfY[x]=480; dirtY[x]=490; }
|
|
computeAmbient();
|
|
for(let y=0;y<H;y++)for(let x=0;x<W;x++) {
|
|
const i=y*W+x;mat[i]=y>=480?STONE:EMPTY;flags[i]=y>=480?F_NAT:0;temp[i]=AMB[y];
|
|
}
|
|
bot.x=384-bot.w/2;bot.y=330-bot.h/2;bot.vx=bot.vy=0;
|
|
bag[SAND]=40000;bagTotal=40000;updateRoof();
|
|
}
|
|
function pileBlowStroke() { toolBlow(383.5,250,6,SAND); }
|
|
function pileBlowProfile() {
|
|
let cliff=0,previous=0,grains=0,height=0;
|
|
for(let x=0;x<W;x++) {
|
|
let y=0;while(y<480&&mat[y*W+x]!==SAND)y++;
|
|
const h=480-y;cliff=Math.max(cliff,Math.abs(h-previous));previous=h;height=Math.max(height,h);
|
|
for(;y<480;y++)if(mat[y*W+x]===SAND)grains++;
|
|
}
|
|
return {cliff,height,grains,flying:flyers.length,bag:bagTotal,awake:awake.filter(v=>v).length};
|
|
}
|