Sloped walls with a flat 45° face, and diagonal wall lines (t36)

- New Sloped wall piece: a half-block triangle in any wall material, at half a wall's cost.
  Dragging walls or slopes at about 45° lays a diagonal line; the drag picks the slope's
  orientation and T flips or turns it.
- Each slope fills one cell past its corner, so a diagonal run is sealed against grains and water.
- New test/t_slopes.js: a slope funnel passes 400/400 sand (square steps 379/400).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 17:17:51 -04:00
co-authored by Claude Opus 5.5
parent 1a300bf744
commit 381019b7aa
21 changed files with 311 additions and 58 deletions
+13 -2
View File
@@ -82,7 +82,7 @@ function setBrush(d) {
// The block variant a piece is placed with: wall material, or direction (a filter's
// materials and mode travel separately, as GAME.filterCfg)
function pieceV(P) {
if (P.code === BP_WALL) return GAME.wallMat;
if (isWall(P.code)) return GAME.wallMat;
if (P.filter) return (GAME.pieceDir[P.id] || 0) << 7;
return GAME.pieceDir[P.id] || 0;
}
@@ -91,6 +91,17 @@ function filterBlockAt(x, y) { if (x < 0 || y < 0 || x >= W || y >= H) return -1
function chipCost(cost) { const ok = canAfford(cost, 1); return `<span class="chip ${ok ? 'ok' : 'bad'}">${esc(costText(cost, 1))}</span>`; }
function pieceCostNow(P, m = GAME.wallMat) {
if (P.kind === 'mold') return wallCost(m, MOLDS[P.mold].walls);
if (P.kind === 'block' && P.code === BP_WALL) return wallCost(m, BS * BS);
if (P.kind === 'block' && isWall(P.code)) return pieceCost(P.code, m);
return P.cost;
}
function pieceCode(P, end = aimBlock()) {
if (!isSlope(P.code)) return P.code;
const a = GAME.drag || end;
return slopeCode(end.bx - a.bx, end.by - a.by, GAME.pieceDir.slope || 0);
}
function turnSlope() {
const n = GAME.pieceDir.slope || 0;
GAME.pieceDir.slope = GAME.drag ? n ^ 2 : (n + 1) % 4;
hudDirty = true;
}