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:
+6
-2
@@ -31,7 +31,7 @@ function toolVacuum(cx, cy, r, pick) {
|
||||
});
|
||||
return { got, m: first, full, status: full ? 'Bag full; blow material out or cast a bigger tank.' : '' };
|
||||
}
|
||||
// Blow: grains leave the bot's nozzle and fly to the cursor, where they drop.
|
||||
// Blow: grains leave the bot's nozzle and arc toward the cursor, within reach.
|
||||
// Liquids need the Flask. Bars are thrown, one at a time.
|
||||
function nozzle(tx, ty) {
|
||||
const cx = bot.x + bot.w / 2, cy = bot.y + bot.h / 2;
|
||||
@@ -65,6 +65,10 @@ function toolBlow(cx, cy, r, m, mix) {
|
||||
if (!e) return { placed: 0, status: 'No room to throw a bar from here.' };
|
||||
bagTake(m, 1); return { placed: 1, status: '' };
|
||||
}
|
||||
if (!inReach(cx, cy)) {
|
||||
cx = nz.ox + nz.dx * nz.dist - 0.5;
|
||||
cy = nz.oy + nz.dy * nz.dist - 0.5;
|
||||
}
|
||||
if (flyers.length > 3000) return { placed: 0, status: '' };
|
||||
// nozzle 0 is a trickle for careful work, the widest a torrent
|
||||
const rate = 1 + r + ((r * r) >> 1);
|
||||
@@ -73,7 +77,7 @@ function toolBlow(cx, cy, r, m, mix) {
|
||||
for (let k = 0; k < n; k++) {
|
||||
const gm = pickM ? pickM() : m;
|
||||
if (!gm) break;
|
||||
// aim each grain at a spot in the brush around the cursor, on an arc that passes
|
||||
// aim each grain at a spot in the brush around the target, on an arc that passes
|
||||
// through it; past that point gravity carries it on until it hits something
|
||||
const a = rnd() * Math.PI * 2, rr = Math.sqrt(rnd()) * (r + 0.5);
|
||||
const tx = cx + 0.5 + Math.cos(a) * rr, ty = cy + 0.5 + Math.sin(a) * rr;
|
||||
|
||||
Reference in New Issue
Block a user