Saw cuts wood chunks into Planks; stone bricks are now Stone blocks (t4)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+15
-10
@@ -12,6 +12,7 @@ REFINE[SAND] = [[0.01, SNORE], [0.008, FEORE], [0.0015, AUORE]];
|
||||
REFINE[LDIRT] = [[0.08, LCLAY], [0.01, COAL], [0.008, CUORE], [0.003, ACORN]];
|
||||
const REFINE_SAND = 0.5;
|
||||
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; }
|
||||
@@ -19,7 +20,7 @@ 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: 0, busyT: -999, blocked: false });
|
||||
if (!procState.has(b)) procState.set(b, { work: 0, cut: { [RSTONE]: 0, [LWOOD]: 0 }, busyT: -999, blocked: false });
|
||||
}
|
||||
procDirty = false;
|
||||
}
|
||||
@@ -41,16 +42,20 @@ function procFeed(b, m, T) {
|
||||
else if (rnd() < REFINE_SAND) got = SAND;
|
||||
stats.refined = (stats.refined || 0) + 1; m = got;
|
||||
if (!m) return;
|
||||
} else if (blockP[b] === BP_SAW && m === RSTONE) {
|
||||
if (++s.cut < CUT_PER_BRICK) return;
|
||||
s.cut = 0; m = BARSB;
|
||||
} 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];
|
||||
}
|
||||
if (b === end) break;
|
||||
b += BW;
|
||||
}
|
||||
if (m === BARSB) {
|
||||
const e = spawnBar(BARSB, x, (((end / BW) | 0) + 1) * BS, (rnd() - 0.5) * 0.1, 0.05);
|
||||
if (e) { e.T = T; discover(BARSB, x, y, RSTONE, 'cut'); stats.bricks = (stats.bricks || 0) + 1; }
|
||||
if (m === BARSB || m === PLANK) {
|
||||
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;
|
||||
else stats.bricks = (stats.bricks || 0) + 1;
|
||||
}
|
||||
} else setCell(procSlot(end), m, T, 0);
|
||||
}
|
||||
function procBlocksTick() {
|
||||
@@ -66,9 +71,9 @@ 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 (m === RSTONE) for (let q = b; q <= end; q += BW) {
|
||||
if (blockP[q] === BP_GRIND) break;
|
||||
if (blockP[q] === BP_SAW) { brick = procState.get(q).cut + 1 >= CUT_PER_BRICK; break; }
|
||||
if (SAW_CUTS[m]) 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 (procSlot(end) < 0 || brick && !entFreeAt(x, (((end / BW) | 0) + 1) * BS)) {
|
||||
for (let q = b; q <= end; q += BW) procState.get(q).blocked = true;
|
||||
|
||||
Reference in New Issue
Block a user