Replace is held G instead of Ctrl (Ctrl+W/Ctrl+D were hit while flying)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+5
-5
@@ -137,15 +137,15 @@ function primaryPress(shift) {
|
||||
let err = '';
|
||||
undoRecord(rec => piecesIn(rec, 'block-') + piecesIn(rec, 'mach-') + piecesIn(rec, 'mold-') ? `replacing with a ${P.name.toLowerCase()}` : `placing a ${P.name.toLowerCase()}`, () => {
|
||||
err = check() || '';
|
||||
// Ctrl: take down what you built in the way (refunded) and put this in its place
|
||||
if (err && GAME.ctrl && /already/.test(err)) {
|
||||
// G: take down what you built in the way (refunded) and put this in its place
|
||||
if (err && GAME.replace && /already/.test(err)) {
|
||||
err = footprintBlocker(bx, by, bw, bh);
|
||||
if (!err && !canAfford(pieceCostNow(P), 1)) err = needText(pieceCostNow(P), 1);
|
||||
if (!err) err = clearFootprint(bx, by, bw, bh);
|
||||
}
|
||||
if (!err) err = place();
|
||||
});
|
||||
if (err) { setStatus(err + (/already/.test(err) ? `${/[.!]$/.test(err) ? '' : '.'} Hold Ctrl to replace it.` : '')); playSfx('error'); } else { playSfx('place'); hudDirty = true; }
|
||||
if (err) { setStatus(err + (/already/.test(err) ? `${/[.!]$/.test(err) ? '' : '.'} Hold G to replace it.` : '')); playSfx('error'); } else { playSfx('place'); hudDirty = true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ function primaryRelease(shift) {
|
||||
const near = list.filter(([bx, by]) => blockInReach(bx, by)), far = list.filter(([bx, by]) => !blockInReach(bx, by));
|
||||
let ghosts = 0;
|
||||
const r = undoRecord(rec => blockLabel(P, rec) + (piecesIn(rec, 'paste') ? ' (and its ghosts)' : ''), () => {
|
||||
const res = placeBlocks(P.code, v, near, ex, GAME.ctrl);
|
||||
const res = placeBlocks(P.code, v, near, ex, GAME.replace);
|
||||
const g = { t: 'paste', blocks: [], machines: [], molds: [] };
|
||||
for (const [bx, by] of far) {
|
||||
const b = by * BW + bx;
|
||||
@@ -185,7 +185,7 @@ function primaryRelease(shift) {
|
||||
if (ghosts) undoNote(g);
|
||||
return res;
|
||||
});
|
||||
const hint = /already built/.test(r.status) ? `${/[.!]$/.test(r.status) ? '' : '.'} Hold Ctrl to replace it.` : '';
|
||||
const hint = /already built/.test(r.status) ? `${/[.!]$/.test(r.status) ? '' : '.'} Hold G to replace it.` : '';
|
||||
const gtxt = ghosts ? `${r.n ? `Placed ${plural(r.n, P.name.toLowerCase())}; ` : ''}${plural(ghosts, 'more')} out of reach ${ghosts === 1 ? 'is a ghost' : 'are ghosts'} your bot builds when it gets close.` : '';
|
||||
if (r.n || ghosts) { playSfx('place'); setStatus(gtxt || (r.status ? r.status + hint : ''), 'info'); } else { setStatus((r.status || 'Nothing placed.') + hint); playSfx('error'); }
|
||||
GAME.drag = null; GAME.dragDir = -1; hudDirty = true;
|
||||
|
||||
Reference in New Issue
Block a user