Vacuum: one selection for pick-up and blow, full list while Ctrl is held (t20)

With anything selected a drag takes only the selection; with nothing
selected it takes what you click. Right click blows the selected materials
in the bag. Holding Ctrl lists every material found so far under "Not in
bag". Selections stay when materials run out; Clear button, clicking the
only selected row, or gamepad B clears.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 13:57:43 -04:00
co-authored by Claude Opus 5.5
parent c1a085ebb1
commit 2cf9cb843c
17 changed files with 124 additions and 59 deletions
+5 -5
View File
@@ -118,7 +118,7 @@ function primaryPress(shift) {
return;
}
if (t === 'vacuum') {
GAME.vacFilter = shift ? -1 : grainAt(ax, ay);
GAME.vacFilter = shift ? -1 : GAME.blow.size ? -2 : grainAt(ax, ay);
hudDirty = true;
} else if (t === 'build') {
const P = piece();
@@ -207,8 +207,8 @@ function toolTick() {
if (GAME.vacFilter === 0) { GAME.vacFilter = grainAt(ax, ay); if (GAME.vacFilter) hudDirty = true; }
const f = GAME.vacFilter;
if (f !== 0) {
const r = toolVacuum(ax, ay, GAME.brush[1], f < 0 ? () => true : m => m === f);
if (r.got) { if (!GAME.blow.size) { GAME.blow = new Set([f > 0 ? f : r.m]); lastBagKey = ''; } playSfx('suck'); hudDirty = true; }
const r = toolVacuum(ax, ay, GAME.brush[1], f === -2 ? m => GAME.blow.has(m) : f < 0 ? () => true : m => m === f);
if (r.got) { playSfx('suck'); hudDirty = true; }
if (r.status) setStatus(r.status);
}
} else if (t === 'ignite') {
@@ -218,10 +218,10 @@ function toolTick() {
}
if (GAME.rmb && !GAME.rmbConsumed) {
if (t === 'vacuum') {
if (!GAME.blowAll && !GAME.blow.size) { setStatus('Nothing in hand: Q/E or click something in the bag.'); return; }
if (!GAME.blowAll && !GAME.blow.size) { setStatus('Nothing selected: click or Q/E in the bag.'); return; }
const list = GAME.blowAll ? blowAllList() : blowList();
if (!GAME.blowAll && !list.length) { setStatus('None of the selected materials are in the bag.'); return; }
const r = GAME.blowAll && !list.length ? { placed: 0, status: 'Nothing loose in the bag to blow.' } : toolBlow(ax, ay, GAME.brush[1], list[0] || 0, list.length > 1 ? list : null);
for (const m of GAME.blow) if (bag[m] <= 0) { GAME.blow.delete(m); lastBagKey = ''; hudDirty = true; }
if (r.placed) { playSfx('blow'); hudDirty = true; } else if (r.status) setStatus(r.status);
} else if (t === 'build') {
const key = `${(ax / BS) | 0},${(ay / BS) | 0}`;