Vacuum controls: pick-up modes and separate pick-up and blow marks in the bag (t6, t15)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 01:54:12 -04:00
co-authored by Claude Opus 5.5
parent cc6f98a932
commit 255824ec6d
19 changed files with 213 additions and 118 deletions
+7 -10
View File
@@ -11,7 +11,7 @@ function renderHotbar() {
}
function toolId() { return TOOLS[GAME.tool].id; }
// Shift does two jobs. While you are steering the bot it boosts; while you are not,
// it is the tool modifier (vacuum everything, blow a mix, fill a rectangle).
// it is the tool modifier (vacuum everything, fill a rectangle).
function steering() { return ['w', 'a', 's', 'd', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', ' '].some(k => keys.has(k)) || GAME.padRun > 0; }
function modShift() { return keys.has('Shift') && !steering(); }
// The loose material exactly under the cursor, or the nearest one touching it.
@@ -25,16 +25,13 @@ function grainAt(ax, ay) {
function selectTool(k) {
if (k === GAME.tool) return;
GAME.tool = k; GAME.drag = null; hudDirty = true; renderHotbar(); playSfx('ui');
if (toolId() === 'vacuum') ensureDropMat();
if (toolId() === 'vacuum') ensureBlow();
}
function bagMaterials() { return BAG_ORDER.filter(m => bag[m] > 0); }
// Only auto-pick a material when the player has not chosen one. A chosen
// material stays selected even after it runs out.
function mixList() { return [...GAME.collect].filter(m => bag[m] > 0 && PH[m] !== PH_ITEM); }
function ensureDropMat() {
if (GAME.blowMix && mixList().length < 1) GAME.blowMix = false;
if (bag[GAME.dropMat] > 0) return;
if (GAME.matChosen && GAME.dropMat) return;
const l = bagMaterials(); GAME.dropMat = l.length ? l[0] : 0;
function blowList() { return [...GAME.blow]; }
// Empty materials stay chosen until the player changes the marks.
function ensureBlow() {
if (GAME.blow.size) return;
const l = bagMaterials(); if (l.length) GAME.blow.add(l[0]);
}
function piece() { return PIECES[GAME.pieceIdx]; }