The nozzle blows no further than it sucks (t34)

With the cursor outside the reach circle, blown grains aim at the circle's edge in the cursor's
direction instead of flying all the way to the cursor, and the blow preview stops there too.
New test/t_nozzle.js and a play.py preview check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 16:35:38 -04:00
co-authored by Claude Opus 5.5
parent 64ff8310f3
commit 5ce44f842e
6 changed files with 71 additions and 6 deletions
+17 -1
View File
@@ -434,7 +434,23 @@ with sync_playwright() as p:
}
})()"""))
# 3. right button blows the selection; exhausted materials stay selected
check('out-of-reach blow preview sits at the capped nozzle target', ev("""(() => {
const aim = GAME.aim, consumed = GAME.rmbConsumed, arc = R.ctx.arc;
const arcs = [];
try {
GAME.aim = { x: bot.x + bot.w / 2 + 3 * REACH, y: bot.y + bot.h / 2 };
GAME.rmb = true; GAME.rmbConsumed = false;
R.ctx.arc = function (x, y, r, ...rest) { arcs.push({ x, y, r }); return arc.call(this, x, y, r, ...rest); };
drawPreviews();
const nz = nozzle(Math.floor(GAME.aim.x) + 0.5, Math.floor(GAME.aim.y) + 0.5);
const target = worldToScreenPx(nz.ox + nz.dx * nz.dist, nz.oy + nz.dy * nz.dist);
return arcs.some(p => Math.abs(p.x - target.x) < 0.01 && Math.abs(p.y - target.y) < 0.01 && Math.abs(p.r - (GAME.brush[1] + 0.5) * R.zp) < 0.01);
} finally {
R.ctx.arc = arc; GAME.aim = aim; GAME.rmb = false; GAME.rmbConsumed = consumed;
}
})()"""))
# 3. right button blows the selection; exhausted materials are deselected
refill('bag[COAL] = 120; bag[RSTONE] = 600; bag[CUORE] = 60; bag[LCLAY] = 200; bag[LWOOD] = 120')
ok = select('2', 'GAME.blow.size === 1 && GAME.blow.has(COAL)')
check('Q/E chooses coal to blow', ok, ev('[...GAME.blow]'))