diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 8fdcb53..f9d51e1 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -43,7 +43,7 @@ decides something new, add it under "Decisions" with the date. ## The core loop 1. Dig with the resonance drill. Rock shatters into loose grains: rubble, ore, coal, clay, sand. -2. Vacuum up what you want (mark materials in the vacuum menu, F, to take only those), and blow it out where you need it. +2. Vacuum up what you want (a drag takes only the material it starts on), and blow out what's in hand where you need it. 3. Build a furnace from wall blocks, with a grate floor over a mold. Charge it with ore and coal, light it, and let the molten metal run into the mold. 4. Bars drop out of the bottom of the mold; collect them and sell them at the trade dock, or fill buyers' orders, which pay more. @@ -128,7 +128,8 @@ above, including: - **Fans melt like copper (1085°C).** Put the fan outside the furnace, blowing in through a grate. The game warns when a fan gets close to melting. - **The vacuum takes only marked materials** once any are marked, even if the drag starts on - something else. The t6 controls below replace the shared ticks; t16 replaces t6's modes. + something else. The t6 controls below replace the shared ticks; t16 replaces t6's modes; t20 + replaces the marks with pick-what-you-click. - **The Refiner** grinds stone, granite and basalt rubble, gravel, sand and dirt for trace ore, roughly halving the waste. Ore and anything else it cannot grind drop straight through. - **Pipes, pumps and outlets** move liquids up to 500°C, one liquid per line. A line is stored as @@ -234,6 +235,15 @@ above, including: the bag; Ctrl+click a bag name adds it to the blow mix and Ctrl+right-click to pick-up; the menu is one line per material because the first version was too large. +- **Pick up what you click, blow out what's in hand (t20, 2026-10-24).** Replaces t16's pick-up + marks and the vacuum menu; the owner wanted something simpler and more intuitive. A left drag + takes only the material it starts on (or the first loose grain it reaches); Shift takes + everything. The hand is the blow selection: click a bag name or Q/E for one material, Ctrl+click + for a mix, Shift + right click for everything loose. When something in hand runs out it leaves + the hand (this settles the old t18 question), and an empty hand blows nothing and says so. + Picking something up fills an empty hand, never a chosen one. One tool, no menu; R and F do + nothing special with the Vacuum. The owner mostly uses it to collect ore and fuel and feed furnaces. + - **Fog of war also reveals the ground around the bot (t17, 2026-10-24).** About 20 grains in every direction, through rock, fully clear with a soft edge. Line of sight alone hid everything inside the ground, so the owner couldn't see what was around them or where to dig. diff --git a/docs/PROJECT_MAP.md b/docs/PROJECT_MAP.md index 7d72e7a..c0deec9 100644 --- a/docs/PROJECT_MAP.md +++ b/docs/PROJECT_MAP.md @@ -288,7 +288,7 @@ Trees (background layer), acorns, saplings, and waking freezing water. - functions: cutTree, treeHeld, findTreeBases, treeSupportTick, woodRoom, treeFall, coldTick, plantTick, setTreeCell, saplingTick, igniteTree - variables: treeBases, saplings, treeDraw -### src/sim/vacuum.js (165 lines) +### src/sim/vacuum.js (166 lines) The vacuum, blowing grains out, grains in flight (flyers), and the flame tool. Material the vacuum would start on at the cursor: a bar, else the nearest loose grain. - functions: vacuumTargetAt, toolVacuum, nozzle, toolBlow, flyOpen, depositNear, bagTemp, landFlyer, flyTick, toolIgnite - variables: blowRR, FLY_G, FLY_Q @@ -366,9 +366,9 @@ Audio: chiptune effects and generative music that changes with depth. Everything - functions: auInit, auVolumes, rateOk, tone, noiseBurst, sfxPlace, playSfx, auAmbient, mtof, zoneForDepth, scaleNote, musicScheduler - variables: AU, SFX, SFX_NEAR, SFX_FAR, ZONES -### src/ui/state.js (67 lines) +### src/ui/state.js (66 lines) Game shell (src/ui/): browser only. This file: settings, the GAME state object, DOM helpers, toasts and the status line. -- functions: loadSettings, saveSettings, loadCollect, el, esc, rgbOf, fmtT, toast, setStatus +- functions: loadSettings, saveSettings, el, esc, rgbOf, fmtT, toast, setStatus - variables: SET_DEFAULT, SET, TOOLS, ICONS, BAG_ORDER, GAME, keys, hudDirty, $ ### src/ui/title.js (46 lines) @@ -395,18 +395,18 @@ The notebook (N): milestones, market, wallet, blueprints, controls. - functions: openNotebook, renderNotebook, fmtClock, orderName, orderLeft, renderMarketTab, fmtPrice, itemsText, renderWallet, renderBlueprintTab, copyCode, controlsHtml - variables: nbTab, MARKET_GROUPS -### src/ui/hud.js (40 lines) +### src/ui/hud.js (34 lines) The tool hotbar and what is selected. -- functions: renderHotbar, toolId, steering, modShift, grainAt, selectTool, bagMaterials, blowList, blowAllList, blowingAll, ensureBlow, piece +- functions: renderHotbar, toolId, steering, modShift, grainAt, selectTool, bagMaterials, blowList, blowAllList, blowingAll, piece ### src/ui/build-menu.js (102 lines) The build menu along the bottom: categories, piece tiles and their icons. - functions: pieceIcon, catOf, selectBuildCat, cycleBuildCat, buildVariantChips, renderBuildBar, setupBuildBar - variables: BUILD_CATS, BUILD_ORDER, PIECE_ICONS, lastBuildKey, lastBuildMenu -### src/ui/selection.js (276 lines) +### src/ui/selection.js (230 lines) The selected tool and piece: R / Q / E, drill width, filter picker, the selection card, the bag panel. -- functions: pieceUsesWall, setDrillWidth, tuneUnderCursor, cycleItem, cycleWall, rotate, toggleCollect, toggleBlow, pickFilterUnderCursor, toggleFilterMat, toggleCollectUnderCursor, setBrush, pieceV, pieceExtra, filterChoices, matList, filterParts, filterSentence, applyFilterRun, openFilterPicker, openVacuumMenu, openWallPicker, filterBlockAt, chipCost, pieceCostNow, renderSelCard, renderBag +- functions: pieceUsesWall, setDrillWidth, tuneUnderCursor, cycleItem, cycleWall, rotate, toggleBlow, pickFilterUnderCursor, toggleFilterMat, setBrush, pieceV, pieceExtra, filterChoices, matList, filterParts, filterSentence, applyFilterRun, openFilterPicker, openWallPicker, filterBlockAt, chipCost, pieceCostNow, renderSelCard, renderBag - variables: lastBagKey ### src/ui/info.js (171 lines) @@ -418,7 +418,7 @@ Keyboard and mouse listeners. - functions: isTyping - variables: canvas -### src/ui/actions.js (233 lines) +### src/ui/actions.js (237 lines) What input does: overlays, F, pick, copy / cut / paste, undo, building and tool use each frame. Which overlays are on, shown as a coloured frame round the screen and a named badge - functions: updateOverlayUI, toggleLens, doInteract, pickUnderCursor, aimBlock, stampOrigin, selModeHeld, startPaste, stopSelectAndPaste, plural, piecesIn, doUndo, endRmbRecord, dragDirFor, blockLabel, primaryPress, primaryRelease, secondaryPress, toolTick - variables: ovShown diff --git a/docs/agent-log.md b/docs/agent-log.md index 8260b45..e9a2af5 100644 --- a/docs/agent-log.md +++ b/docs/agent-log.md @@ -4,6 +4,18 @@ What agents have done, newest first. Add an entry for every piece of work: the d note or request it was for, what changed, the files touched, the tests run, and anything left open or not verified. Keep each entry short; the git history has the details. +## 2026-10-24: t20: pick up what you click, blow out what's in hand (Claude Code, Codex) + +- After discussing options with the owner: one Vacuum, a drag locks onto the material it starts on + (Shift: everything), and `GAME.blow` is "the hand" (click/Q/E, Ctrl+click mix). Empty materials + leave the hand; an empty hand blows nothing; a pickup fills an empty hand. Removed `GAME.collect`, + R marks, Ctrl+right-click, `openVacuumMenu`, `ensureBlow` and the `.vpick` styles. +- Files: `src/ui/{actions,selection,hud,state,previews,build-menu,info,notebook,session}.js`, + `src/sim/{vacuum,progress}.js` (`toolVacuum` returns the first material picked up), + `src/styles/style.css`, `test/play.py`, `test/t_basics.js`. +- Tests: `run_all.py --browser` all passed (play.py 214 checks). Screenshots `shots/t20-*.png` + (empty hand, one item, mix, 900px). + ## 2026-10-24: t17 follow-up: no jagged rim, unexplored is black (Claude Code) - The owner still saw a jagged grey edge. Causes found by sampling pixels: the fade went to 0 diff --git a/src/sim/progress.js b/src/sim/progress.js index 9ef324b..2148082 100644 --- a/src/sim/progress.js +++ b/src/sim/progress.js @@ -22,12 +22,12 @@ const STARTER_DESIGNS = [ // ---------- Milestones ---------- const MILESTONES = [ - { id: 'dig', title: 'Break ground', msg: 'Broken material falls loose. The Vacuum (2) picks up everything, or only what you mark in its menu (F).', hint: 'Hold the left mouse button with the Drill (1): it sends pulses at the cursor that shake rock until it shatters. It falls as rubble, ore and coal.' }, + { id: 'dig', title: 'Break ground', msg: 'Broken material falls loose. The Vacuum (2) picks up what you click. Click or Q/E in the bag chooses the hand; Ctrl+click mixes, Shift takes or blows everything.', hint: 'Hold the left mouse button with the Drill (1): it sends pulses at the cursor that shake rock until it shatters. It falls as rubble, ore and coal.' }, { id: 'fire', title: 'First fire', hint: 'Vacuum up coal or wood chunks, blow a pile out with right click, then hold the Igniter (4) on it. Fuel only burns where it touches open air.', reward: 'Thermal lens unlocked. Press H to see heat.' }, { id: 'brick', title: 'Fired brick', hint: 'Clay turns into brick after a while above about 900°C, hotter than an open wood fire gets. Blow clay lumps into a coal fire, best walled in like a furnace, and vacuum up the brick rubble. Brick rubble builds brick blocks.', reward: 'Brick insulates far better than stone and survives 1750°C.' }, { id: 'charcoal', title: 'Charcoal', hint: 'Wood that gets hot without air turns into charcoal instead of burning. Bury a burning pile of wood chunks under dirt, or heat a sealed box of wood chunks from outside.', reward: 'A fuel you can grow: nearly as hot as coal.' }, { id: 'grow', title: 'Plant a tree', msg: 'Wood is renewable. Plant rows of acorns on dirt to farm it.', hint: 'Cutting down a tree drops acorns. Leave one on dirt or grass under open sky and it sprouts, then grows into a tree in about a minute and a half.' }, - { id: 'copper', title: 'Molten copper', msg: 'Molten copper sinks to the bottom of the charge. Get it into a mold before it sets.', hint: 'Copper ore melts at 1085°C. An open fire loses too much heat, so wall coal and ore in with blocks and leave a small vent at the top for smoke. Mix ore and coal about half and half: in the vacuum menu (F), mark coal and copper ore with ⬆. Right click blows an even mix.' }, + { id: 'copper', title: 'Molten copper', msg: 'Molten copper sinks to the bottom of the charge. Get it into a mold before it sets.', hint: 'Copper ore melts at 1085°C. An open fire loses too much heat, so wall coal and ore in with blocks and leave a small vent at the top for smoke. Mix ore and coal about half and half: Ctrl+click coal and copper ore in the bag to blow a mix. Right click blows an even mix.' }, { id: 'bars', title: 'Copper bars', msg: 'Bars sell for far more than the ore in them, and make metal wall blocks.', hint: 'Build an Ingot mold (Build, 3) right under the furnace with a floor of clay Grates between them: molten copper drips through, while the charge and the thick slag stay up. When the bars set, they drop out of the bottom of the mold onto whatever is under it; a belt carries them off. Leave space below, or vacuum up the bars. Ingot molds empty themselves: bars, junk and scrap drop below, slag is thrown away and the grate above is raked. Removing any mold returns its set metal to your bag: whole bars as bars, the rest as scrap. Copper that sets in the furnace melts again next firing.' }, { id: 'bit1', title: 'Copper drill bit', hint: 'Cast copper in a Bit mold. Building the furnace right on top works. A Grate over the funnel keeps the charge out. Let it set, then press F.', reward: 'Copper bit. You can now dig iron ore.' }, { id: 'auto', title: 'Moving parts', msg: 'Machines can now haul for you. Feed furnaces automatically, and lift ore out of your mines.', hint: 'Belts carry grains and bars resting on them. Screw tubes push loose material along (never liquids); stacked pointing up they lift it out of a mine. A Filter lets one material fall through and carries the rest along, so you can sort ore from rubble. Move 300 grains with machines.' }, diff --git a/src/sim/vacuum.js b/src/sim/vacuum.js index 8aa4e5f..104e0e5 100644 --- a/src/sim/vacuum.js +++ b/src/sim/vacuum.js @@ -11,11 +11,11 @@ function vacuumTargetAt(cx, cy, r) { } // Vacuum: picks up loose grains, liquids (with the Flask) and bars for which pick(m) is true. function toolVacuum(cx, cy, r, pick) { - let got = 0, full = false, budget = 48; + let got = 0, first = 0, full = false, budget = 48; for (const e of entsInCircle(cx, cy, r)) { if (!pick(e.m) || !inReach(e.ix + 2, e.iy + 1)) continue; if (bagTotal >= bagCap()) { full = true; break; } - bagAdd(e.m, 1); removeEnt(e); got++; + bagAdd(e.m, 1); removeEnt(e); got++; if (!first) first = e.m; emit({ t: 'suck', x: e.ix + 2, y: e.iy + 1, m: e.m }); } if (!full) forBrush(cx, cy, r, (x, y, i) => { @@ -24,11 +24,12 @@ function toolVacuum(cx, cy, r, pick) { if (!pick(m)) return; if (part[i] >= P_TU && part[i] <= P_TR) return; if (bagTotal >= bagCap()) { full = true; return false; } + if (!first) first = m; bagAdd(m, 1); setCell(i, EMPTY, AMB[y], 0); got++; if (got & 1) emit({ t: 'suck', x, y, m }); if (--budget <= 0) return false; }); - return { got, full, status: full ? 'Bag full; blow material out or cast a bigger tank.' : '' }; + 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. // Liquids need the Flask. Bars are thrown, one at a time. @@ -45,11 +46,11 @@ function toolBlow(cx, cy, r, m, mix) { let pickM = null; if (mix && mix.length) { const avail = mix.filter(k => bag[k] > 0 && PH[k] !== PH_ITEM && (PH[k] !== PH_LIQUID || player.flask)); - if (!avail.length) return { placed: 0, status: 'No marked materials left to blow.' }; + if (!avail.length) return { placed: 0, status: 'Nothing in hand: Q/E or click something in the bag.' }; pickM = () => { for (let k = 0; k < avail.length; k++) { const c = avail[(blowRR++) % avail.length]; if (bag[c] > 0) return c; } return 0; }; m = avail[0]; } - if (!m) return { placed: 0, status: 'Pick what to blow out: Q/E, or click it in your bag.' }; + if (!m) return { placed: 0, status: 'Nothing in hand: Q/E or click something in the bag.' }; if (bag[m] <= 0) return { placed: 0, status: `No ${MD[m].name.toLowerCase()} left.` }; const ph = PH[m]; if (ph === PH_LIQUID && !player.flask) return { placed: 0, status: 'You need the Flask to carry liquids.' }; diff --git a/src/styles/style.css b/src/styles/style.css index 8cee95c..5128596 100644 --- a/src/styles/style.css +++ b/src/styles/style.css @@ -362,14 +362,4 @@ input.text { background: var(--soot-0); border: 1px solid var(--soot-4); border- #m-dialog { z-index: 21; } #continue-meta { max-width: 72%; overflow-wrap: anywhere; text-align: right; } -.vpick { display: grid; gap: 1px; max-height: min(56vh, 460px); overflow-y: auto; padding: 2px; } -.vrow { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 52px 52px; align-items: center; gap: 8px; padding: 2px 6px; border-radius: 4px; font-size: 12px; } -.vrow:not(.vhead):hover { background: var(--soot-2); } -.vrow .sw { width: 12px; height: 12px; border-radius: 2px; } -.vrow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.vrow .num { color: var(--ash); } -.vrow.vhead { color: var(--ash-dim); white-space: nowrap; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; } -.vrow.vhead span:nth-child(n+4) { text-align: center; } -.vrow button { padding: 1px 0; min-height: 0; font-size: 12px; justify-content: center; } -.vrow button.on { border-color: #e59a52; background: #533820; color: var(--bone); } .vacchoice { display: flex; align-items: center; gap: 4px; text-align: left; min-width: 0; background: transparent; border: 0; padding: 0; cursor: pointer; } diff --git a/src/ui/actions.js b/src/ui/actions.js index 8fd76cc..b8d76aa 100644 --- a/src/ui/actions.js +++ b/src/ui/actions.js @@ -44,7 +44,6 @@ function doInteract() { if (msg) break outer; } if (msg) { setStatus(msg, 'info'); if (!/^New (drill bit|bag)/.test(msg)) toast(msg); } - else if (toolId() === 'vacuum') openVacuumMenu(); else if ((moldAt(ax, ay) || {}).kind !== 'ingot') setStatus('Nothing to use there.', 'info'); // an ingot mold needs no F: say nothing } // Pick (middle mouse): the piece under the cursor becomes the one you build, with its @@ -119,7 +118,7 @@ function primaryPress(shift) { return; } if (t === 'vacuum') { - GAME.vacFilter = shift || !GAME.collect.size ? -1 : 0; + GAME.vacFilter = shift ? -1 : grainAt(ax, ay); hudDirty = true; } else if (t === 'build') { const P = piece(); @@ -205,9 +204,13 @@ function toolTick() { const r = toolPulse(ax, ay, GAME.drillW, GAME.drillTune); if (r.fired) { playSfx('pulse', GAME.drillW); if (r.status) setStatus(r.status); } } else if (t === 'vacuum') { - const r = toolVacuum(ax, ay, GAME.brush[1], GAME.vacFilter < 0 || !GAME.collect.size ? () => true : m => GAME.collect.has(m)); - if (r.got) { playSfx('suck'); hudDirty = true; } - if (r.status) setStatus(r.status); + 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; } + if (r.status) setStatus(r.status); + } } else if (t === 'ignite') { if (inReach(ax, ay)) { const r = toolIgnite(ax, ay); playSfx('spark'); if (Math.random() < 0.6) spawnSpark(ax + 0.5, ay + 0.5); if (!r.fuel) setStatus('Aim at coal or wood touching air to light it.'); } else setStatus('Out of reach.'); @@ -215,9 +218,10 @@ function toolTick() { } if (GAME.rmb && !GAME.rmbConsumed) { if (t === 'vacuum') { - ensureBlow(); + if (!GAME.blowAll && !GAME.blow.size) { setStatus('Nothing in hand: Q/E or click something in the bag.'); return; } const list = GAME.blowAll ? blowAllList() : blowList(); 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}`; diff --git a/src/ui/build-menu.js b/src/ui/build-menu.js index 9a61c7a..71912d2 100644 --- a/src/ui/build-menu.js +++ b/src/ui/build-menu.js @@ -86,7 +86,7 @@ function renderBuildBar() { pop.style.left = `${Math.max(8, Math.min(innerWidth - w - 8, r.left + r.width / 2 - w / 2)) - br.left}px`; } function setupBuildBar() { - $('selcard').addEventListener('click', e => { if (e.target.closest('[data-wall-picker]')) openWallPicker(); else if (e.target.closest('[data-vac-menu]')) openVacuumMenu(); }); + $('selcard').addEventListener('click', e => { if (e.target.closest('[data-wall-picker]')) openWallPicker(); }); const bar = $('buildbar'); if (!bar) return; bar.addEventListener('click', e => { const t = e.target.closest('[data-cat],[data-piece]'); if (!t) return; diff --git a/src/ui/hud.js b/src/ui/hud.js index 7e6e9e6..46b0788 100644 --- a/src/ui/hud.js +++ b/src/ui/hud.js @@ -25,16 +25,10 @@ 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') ensureBlow(); } function bagMaterials() { return BAG_ORDER.filter(m => bag[m] > 0); } function blowList() { return [...GAME.blow]; } // Shift + right click: an even mix of everything loose in the bag (bars never mix) function blowAllList() { return bagMaterials().filter(m => PH[m] !== PH_ITEM && (PH[m] !== PH_LIQUID || player.flask)); } function blowingAll() { return toolId() === 'vacuum' && (GAME.rmb ? !GAME.rmbConsumed && GAME.blowAll : modShift()); } -// 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]; } diff --git a/src/ui/info.js b/src/ui/info.js index 9cd168e..deebbd7 100644 --- a/src/ui/info.js +++ b/src/ui/info.js @@ -118,7 +118,7 @@ function hoverInfo(ax, ay) { t2.push(HARD[m] > 6 ? 'cannot be drilled' : ok ? `drillable (hardness ${HARD[m]})` : `too hard (${HARD[m]})`); if (!ok && toolId() === 'drill') warn = HARD[m] > 6 ? 'cannot be drilled' : 'too hard'; } - if (!bar && PH[m] === PH_POWDER) t2.push(GAME.collect.has(m) ? 'loose · marked to pick up' : 'loose'); + if (!bar && PH[m] === PH_POWDER) t2.push('loose'); if (!bar && m === EMPTY && bgm[i]) { t1 = bgm[i] === WOOD ? 'Tree trunk' : 'Leaves'; t2.unshift(bgm[i] === WOOD ? 'drill it for wood chunks' : 'water and sand pass through'); } if (flags[i] & F_BURN) t2.push('burning'); const mo = moldAt(ax, ay); diff --git a/src/ui/notebook.js b/src/ui/notebook.js index fc19c72..df0bdeb 100644 --- a/src/ui/notebook.js +++ b/src/ui/notebook.js @@ -169,19 +169,19 @@ function copyCode(code) { function controlsHtml() { const kb = [ ['Fly', 'W A S D'], ['Boost while flying', 'Shift'], ['Tool modifier (while not flying)', 'Shift'], ['Use tool', 'Left mouse'], ['Second action', 'Right mouse'], - ['Tools', '1 – 4'], ['Cycle what you blow · piece', 'Q / E'], ['Switch build tab', 'Shift + Q / E'], ['Variant: material · direction · flip', 'R'], ['Wall or mold material menu (Build)', 'F'], - ['Mark/unmark what is under the cursor (Vacuum)', 'R'], ['Vacuum menu: what to pick up and blow', 'F (with the Vacuum, away from anything to use)'], ['Add to blow · to pick up (Vacuum)', 'Ctrl+click · Ctrl+right-click a bag name'], ['Blow everything loose in the bag', 'Shift + right click'], ['Nozzle or brush size', '[ ] or Shift + wheel'], + ['Tools', '1 – 4'], ['Cycle what is in hand · piece', 'Q / E'], ['Switch build tab', 'Shift + Q / E'], ['Variant: material · direction · flip', 'R'], ['Wall or mold material menu (Build)', 'F'], + ['Pick up what you click (Vacuum)', 'Left drag · Shift: everything'], ['Put in hand (Vacuum)', 'Click a bag name · Q/E'], ['Add to the mix (Vacuum)', 'Ctrl+click a bag name'], ['Blow everything loose in the bag', 'Shift + right click'], ['Nozzle or brush size', '[ ] or Shift + wheel'], ['Replace what is built (Build)', 'Hold G'], ['Copy a box of what you built', 'Hold C, drag'], ['Cut a box (refunded, paste it back)', 'Hold X, drag'], ['Paste again', 'V'], ['Undo building', 'Ctrl + Z'], ['Blueprint library', 'B'], ['Zoom', 'Mouse wheel'], ['Interact (gates, molds, fans, filters)', 'F'], ['Thermal lens', 'H'], ['Info overlay: filters, belt and tube directions', 'I'], ['Bot lamp', 'L'], ['Pick the piece under the cursor (with its direction and settings)', 'Middle mouse'], ['Notebook', 'N'], ['Clear all blueprint ghosts', 'Delete'], ['Save', 'Ctrl + S'], ['Pause · menu', 'Esc'], ['Mute', 'M'], ]; const pad = [ ['Fly', 'Left stick'], ['Boost', 'Left stick pushed all the way'], ['Aim', 'Right stick'], ['Use tool · suck', 'RT'], ['Second action · blow', 'LT'], ['Tools', 'LB / RB'], - ['Cycle what you blow · piece', 'D-pad ← →'], ['Brush size', 'D-pad ↑ ↓'], ['Interact', 'A'], ['Variant · mark material', 'X'], ['Thermal lens', 'Y'], + ['Cycle what is in hand · piece', 'D-pad ← →'], ['Brush size', 'D-pad ↑ ↓'], ['Interact', 'A'], ['Variant · tune drill', 'X'], ['Thermal lens', 'Y'], ['Cancel', 'B'], ['Zoom', 'R3'], ['Lamp', 'L3'], ['Notebook', 'View / Back'], ['Menu', 'Menu / Start'], ]; const tools = [ ['1 Resonance drill', 'Hold left click to send pulses from the bot toward the cursor: rock they shake hard enough shatters and falls as rubble, ore, coal or scrap, and trees come apart into wood chunks and acorns. Q and E set the pulse width: narrow bores a tunnel fast, wide clears a big cone slowly, medium is in between. R over a material tunes the drill to it, so only that shatters (great for pulling a vein out of the rock); R again untunes. Built blocks are never harmed. Better bits dig harder rock, faster and further.'], - ['2 Vacuum', 'Left click picks up everything, or only marked materials once you mark some. F opens the vacuum menu to mark what to pick up (⬇) and blow (⬆). R over a grain marks it. Hold Shift while not flying to take everything. Right click blows the ⬆ materials as an even mix, bars one at a time; Shift + right click blows an even mix of everything loose in the bag. Click a bag name or use Q/E to blow only one; it stays chosen when empty. Ctrl+click a bag name adds it to what you blow; Ctrl+right-click adds it to what you pick up.'], + ['2 Vacuum', "Left drag picks up what you click, locking onto the first loose material it reaches. Right click blows what is in hand. Click a bag name or use Q/E to choose one; Ctrl+click adds or removes it from the mix. Bars blow alone. Empty materials leave the hand. Picking up fills an empty hand. Shift while not flying takes everything; Shift + right click blows everything loose in the bag."], ['3 Build', 'Places pieces on a grid of 4×4 blocks: wall blocks, belts, tubes, filters, grates, gates, pipes, pumps and outlets, machines (fans, the Refiner) and molds. Drag for a line, hold Shift while dragging for a filled rectangle. Right click takes a piece back. Your bot flies through anything you build.'], ['4 Igniter', 'Heats a small spot to 640°C, and its flame reaches a few grains into a pile. Enough to light coal and wood that touch air.'], ['Copy, cut and paste', 'Hold C (copy) or X (cut) and drag a box over what you built; let go and it is picked up, ready to paste. Cut takes it down and refunds it to your bag. Click to place ghosts: your bot builds them from your bag when it is close. R flips, V pastes again, right click or Esc stops. Ctrl+Z undoes building. The notebook (B) keeps saved blueprints and a few starter designs.'], @@ -191,9 +191,9 @@ function controlsHtml() {
Keyboard and mouse
${tbl(kb)}Gamepad
${tbl(pad)}First steps
1. Drill down a little. Stone falls as rubble; coal (dark seams), copper ore (green speckles) and clay (reddish) come loose too.
- 2. With the Vacuum, left click to pick up loose materials. To take only coal, copper ore, rubble or clay, mark what you want in the vacuum menu (F).
+ 2. With the Vacuum, left drag to pick up the loose material you click. Shift takes everything.
3. Build (3) a chamber of stone wall blocks with a one-block vent in the roof, a floor of clay Grates, and an Ingot mold right under the grates. The notebook's Blueprints tab has this as a starter design.
- 4. In the vacuum menu (F), mark coal and copper ore with ⬆ to blow both. Fly inside (the bot passes through what you build) and right click to blow an even mix onto the grates: about 50 of each. (Ore first and coal on top works too; coal buried under ore will not light.) Light a coal grain on top with the Igniter.
+ 4. Ctrl+click coal and copper ore in the bag to blow a mix. Fly inside (the bot passes through what you build) and right click to blow an even mix onto the grates: about 50 of each. (Ore first and coal on top works too; coal buried under ore will not light.) Light a coal grain on top with the Igniter.
5. When the ingot sets, bars drop out of the bottom of the mold onto whatever is under it. Leave one open block under it: a belt below that carries them off, or vacuum them up. Leftover metal stays for the next firing. Ingot molds empty themselves: bars, junk and scrap drop below, slag is thrown away and the grate above is raked. Removing any mold returns its set metal to your bag: whole bars as bars, the rest as scrap.
Screw tubes carry grains and whole bars: feed bars in from a belt, turn corners and unload at the mouth.
6. Blow the bars into the trade dock: they sell the moment they drop through its grate, and bars pay far more than ore. Watch the Market page for orders that pay double. Money buys belts, screw tubes and fans; pay down the claim there too.
diff --git a/src/ui/previews.js b/src/ui/previews.js
index e5a2793..d7cdad2 100644
--- a/src/ui/previews.js
+++ b/src/ui/previews.js
@@ -153,7 +153,7 @@ function drawPreviews() {
if (t === 'vacuum') {
// what the right button would blow, next to the cursor; what the left is sucking, while it sucks
const sz = Math.max(6, zp * 1.6), qx = p.x + (r + 1.2) * zp, qy = p.y - (r + 1.2) * zp;
- const swatches = GAME.lmb ? GAME.vacFilter >= 0 && GAME.collect.size ? [...GAME.collect] : [] : blowingAll() ? blowAllList() : blowList();
+ const swatches = GAME.lmb ? GAME.vacFilter > 0 ? [GAME.vacFilter] : [] : blowingAll() ? blowAllList() : blowList();
swatches.slice(0, 4).forEach((m, k) => { ctx.fillStyle = rgbOf(m); ctx.fillRect(qx + k * (sz + 2), qy, sz, sz); });
if (blowing || GAME.lmb) {
// faint line from the nozzle: the path the grains take
diff --git a/src/ui/selection.js b/src/ui/selection.js
index 89074e4..f93a87d 100644
--- a/src/ui/selection.js
+++ b/src/ui/selection.js
@@ -23,7 +23,7 @@ function cycleItem(d) {
if (t === 'vacuum') {
const l = bagMaterials();
if (!l.length) return;
- const k = l.indexOf(blowList()[0]);
+ const k = GAME.blow.size ? l.indexOf(blowList()[0]) : d > 0 ? -1 : 0;
GAME.blow = new Set([l[(k + d + l.length) % l.length]]);
} else if (t === 'build') {
let k = BUILD_ORDER.indexOf(piece().id); k = (k + d + BUILD_ORDER.length) % BUILD_ORDER.length;
@@ -48,18 +48,10 @@ function rotate() {
if (pieceUsesWall(P)) cycleWall(1);
else if (P.dirs) GAME.pieceDir[P.id] = ((GAME.pieceDir[P.id] || 0) + 1) % P.dirs.length;
else return;
- } else if (t === 'vacuum') { toggleCollectUnderCursor(); return; }
- else if (t === 'drill') { tuneUnderCursor(); return; }
+ } else if (t === 'drill') { tuneUnderCursor(); return; }
else return;
playSfx('ui'); hudDirty = true;
}
-function toggleCollect(m) {
- if (!m) return;
- const add = !GAME.collect.has(m);
- if (add) GAME.collect.add(m); else GAME.collect.delete(m);
- try { localStorage.setItem('deepgrain.collect', JSON.stringify([...GAME.collect])); } catch (e) { /* storage unavailable */ }
- lastBagKey = ''; hudDirty = true; playSfx('ui');
-}
function toggleBlow(m) {
if (GAME.blow.has(m)) GAME.blow.delete(m);
else if (PH[m] === PH_ITEM) GAME.blow = new Set([m]);
@@ -80,11 +72,6 @@ function toggleFilterMat(m) {
hudDirty = true; lastBagKey = ''; playSfx('ui');
setStatus(`New filter selection updated.`, 'info');
}
-function toggleCollectUnderCursor() {
- const m = grainAt(Math.floor(GAME.aim.x), Math.floor(GAME.aim.y));
- if (!m) { setStatus('Aim at something loose to mark it.', 'info'); return; }
- toggleCollect(m);
-}
function setBrush(d) {
const t = toolId();
if (t === 'drill') { setDrillWidth(GAME.drillW + d); return; }
@@ -141,37 +128,6 @@ function openFilterPicker(cur, onDone, title) {
box.querySelectorAll('[data-m]').forEach(b => b.onclick = () => { const m = +b.dataset.m; if (sel.has(m)) sel.delete(m); else sel.add(m); playSfx('ui'); sync(); });
sync();
}
-function openVacuumMenu() {
- ensureBlow();
- dialog('Vacuum', '', [
- { label: 'Pick up everything', cls: 'ghost', fn: () => {
- GAME.collect.clear();
- try { localStorage.setItem('deepgrain.collect', '[]'); } catch (e) { /* storage unavailable */ }
- lastBagKey = ''; hudDirty = true; playSfx('ui'); sync(); return true;
- } },
- { label: 'Blow one at a time', cls: 'ghost', fn: () => {
- GAME.blow = new Set(blowList().slice(0, 1));
- lastBagKey = ''; hudDirty = true; playSfx('ui'); sync(); return true;
- } },
- { label: 'Done', cls: 'primary' },
- ]);
- const box = $('dlg-body');
- function sync() {
- const list = BAG_ORDER.filter(m => bag[m] > 0)
- .concat(BAG_ORDER.filter(m => !bag[m] && (GAME.collect.has(m) || GAME.blow.has(m))))
- .concat(BAG_ORDER.filter(m => !bag[m] && !GAME.collect.has(m) && !GAME.blow.has(m) && seen[m] && filterable(m)));
- const blow = blowList();
- box.innerHTML = `
${esc(GAME.collect.size ? 'Picking up only ' + matList([...GAME.collect]) + '.' : 'Picking up everything.')} Blowing out ${blow.length > 1 ? `an even mix of ${blow.length}` : blow.length ? esc(MD[blow[0]].name.toLowerCase()) : 'nothing'}.
` - + (!GAME.collect.size ? 'Mark materials to pick up only those.
' : '') - + (list.length ? `Find something loose first.
'); - box.querySelectorAll('[data-vm-pick]').forEach(b => b.onclick = () => { toggleCollect(+b.dataset.vmPick); sync(); }); - box.querySelectorAll('[data-vm-blow]').forEach(b => b.onclick = () => { toggleBlow(+b.dataset.vmBlow); sync(); }); - } - sync(); -} function openWallPicker() { const P = piece(), title = P.kind === 'mold' ? `${P.name} material` : 'Wall material'; const list = WALL_LIST.filter(m => bag[m] > 0).concat(WALL_LIST.filter(m => !bag[m])); @@ -228,13 +184,12 @@ function renderSelCard() { + '