Brick press: clay lumps into green bricks that fire into Bricks (t28)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 16:55:54 -04:00
co-authored by Claude Opus 5.5
parent b76f4516b7
commit c7256557bb
19 changed files with 102 additions and 40 deletions
+12 -7
View File
@@ -15,12 +15,12 @@ const CUT_PER_BRICK = 8;
const SAW_CUTS = []; SAW_CUTS[RSTONE] = BARSB; SAW_CUTS[LWOOD] = PLANK;
// Block hoppers share an outlet down a vertical stack; only its top spends work.
let procState = new Map(), procBlocks = [], procDirty = true;
function isProcCode(c) { return c === BP_GRIND || c === BP_SAW; }
function isProcCode(c) { return c === BP_GRIND || c === BP_SAW || c === BP_PRESS; }
function rebuildProcessors() {
procBlocks = [];
for (let b = 0; b < NB; b++) if (isProcCode(blockP[b])) {
procBlocks.push(b);
if (!procState.has(b)) procState.set(b, { work: 0, cut: { [RSTONE]: 0, [LWOOD]: 0 }, busyT: -999, blocked: false });
if (!procState.has(b)) procState.set(b, { work: 0, press: 0, cut: { [RSTONE]: 0, [LWOOD]: 0 }, busyT: -999, blocked: false });
}
procDirty = false;
}
@@ -45,15 +45,19 @@ function procFeed(b, m, T) {
} else if (blockP[b] === BP_SAW && SAW_CUTS[m]) {
if (++s.cut[m] < CUT_PER_BRICK) return;
s.cut[m] = 0; m = SAW_CUTS[m];
} else if (blockP[b] === BP_PRESS && m === LCLAY) {
if (++s.press < CUT_PER_BRICK) return;
s.press = 0; m = GREENB;
}
if (b === end) break;
b += BW;
}
if (m === BARSB || m === PLANK) {
if (m === BARSB || m === PLANK || m === GREENB) {
const e = spawnBar(m, x, (((end / BW) | 0) + 1) * BS, (rnd() - 0.5) * 0.1, 0.05);
if (e) {
e.T = T; discover(m, x, y, m === PLANK ? LWOOD : RSTONE, 'cut');
if (m === PLANK) stats.planks = (stats.planks || 0) + 1;
e.T = T; discover(m, x, y, m === GREENB ? LCLAY : m === PLANK ? LWOOD : RSTONE, m === GREENB ? 'press' : 'cut');
if (m === GREENB) stats.pressed = (stats.pressed || 0) + 1;
else if (m === PLANK) stats.planks = (stats.planks || 0) + 1;
else stats.bricks = (stats.bricks || 0) + 1;
}
} else setCell(procSlot(end), m, T, 0);
@@ -71,9 +75,10 @@ function procBlocksTick() {
const i = y * W + x + ((k + tick) & 3), m = mat[i];
if (m === EMPTY || PH[m] === PH_GAS || PH[m] === PH_SOLID || stamp[i] === tickStamp) continue;
let brick = false;
if (SAW_CUTS[m]) for (let q = b; q <= end; q += BW) {
if (SAW_CUTS[m] || m === LCLAY) for (let q = b; q <= end; q += BW) {
if (blockP[q] === BP_GRIND && REFINE[m]) break;
if (blockP[q] === BP_SAW) { brick = procState.get(q).cut[m] + 1 >= CUT_PER_BRICK; break; }
if (blockP[q] === BP_PRESS && m === LCLAY) { brick = procState.get(q).press + 1 >= CUT_PER_BRICK; break; }
if (blockP[q] === BP_SAW && SAW_CUTS[m]) { brick = procState.get(q).cut[m] + 1 >= CUT_PER_BRICK; break; }
}
if (procSlot(end) < 0 || brick && !entFreeAt(x, (((end / BW) | 0) + 1) * BS)) {
for (let q = b; q <= end; q += BW) procState.get(q).blocked = true;