Loose walls slump to a natural slope instead of eroding layer by layer (t93)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+19
-2
@@ -100,12 +100,29 @@ function powder(i, x, y, m, barriers = cleatChunks[(y >> 5) * CW + (x >> 5)]) {
|
||||
}
|
||||
// stickiness is grain against grain: on anything built (a wall, a slope, a belt) every material
|
||||
// slides freely, so a chute carries clay as well as sand while clay heaps stay steep
|
||||
if (rnd() < STICK[m] || (PH[t] === PH_SOLID && !(flags[b] & F_NAT))) {
|
||||
const d = (RS & 2) ? 1 : -1;
|
||||
const slide = rnd() < STICK[m] || (PH[t] === PH_SOLID && !(flags[b] & F_NAT));
|
||||
const d = (RS & 2) ? 1 : -1;
|
||||
if (slide) {
|
||||
let nx = x + d;
|
||||
if (nx >= 0 && nx < W && (!CORNER_SEAL || (PH[mat[b]] !== PH_SOLID && (!barriers || !cleatMask[b])) || (PH[mat[i + d]] !== PH_SOLID && (!barriers || !cleatMask[i + d]))) && (!barriers || (!cleatMask[i] && !cleatMask[b + d])) && enterFree(m, PH_POWDER, b + d, d, 1)) { move(i, b + d, x, y, nx, y + 1); return; }
|
||||
nx = x - d;
|
||||
if (nx >= 0 && nx < W && (!CORNER_SEAL || (PH[mat[b]] !== PH_SOLID && (!barriers || !cleatMask[b])) || (PH[mat[i - d]] !== PH_SOLID && (!barriers || !cleatMask[i - d]))) && (!barriers || (!cleatMask[i] && !cleatMask[b - d])) && enterFree(m, PH_POWDER, b - d, -d, 1)) { move(i, b - d, x, y, nx, y + 1); return; }
|
||||
return;
|
||||
}
|
||||
if ((flags[i] | flags[b]) & F_BURN) return; // keep the tuned settling of furnace beds
|
||||
for (let side = 0; side < 2; side++) {
|
||||
const dx = side ? -d : d, nx = x + dx, j = b + dx;
|
||||
if (nx < 0 || nx >= W || (mat[j] !== EMPTY && PH[mat[j]] !== PH_GAS)) continue;
|
||||
if (CORNER_SEAL && (PH[t] === PH_SOLID || (barriers && cleatMask[b])) &&
|
||||
(PH[mat[i + dx]] === PH_SOLID || (barriers && cleatMask[i + dx]))) continue;
|
||||
if (barriers && (cleatMask[i] || cleatMask[j])) continue;
|
||||
if (!passable(m, PH_POWDER, j, dx, 1)) continue;
|
||||
// Cohesion delays shallow slides, not a face with two open grains below the step.
|
||||
if (y + 2 < H && mat[j + W] === EMPTY) {
|
||||
move(i, j, x, y, nx, y + 1); return;
|
||||
}
|
||||
// A missed sticky step must get another chance before its chunk sleeps.
|
||||
chunkWake((y >> 5) * CW + (x >> 5));
|
||||
}
|
||||
}
|
||||
function passable(m, ph, j, dx, dy) {
|
||||
|
||||
Reference in New Issue
Block a user