Physics test pass for sand, molten metal and gases; stuck gas finishes, steam is not deleted (t21)
- New test/t_physics.js: heaps, sorting, sinking, world edges; molten copper levelling, setting, quenching, slag over copper, cavity filling; smoke, steam, fire, sealed pockets, the top row. - Gas in a sealed pocket kept its area asleep and never faded or condensed: gas() keeps its area awake while it lasts. - A rain drop or blown grain landing on steam deleted the steam's water: it goes to the clouds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -126,6 +126,8 @@ function liquid(i, x, y, m) {
|
||||
}
|
||||
}
|
||||
function gas(i, x, y, m) {
|
||||
// Even blocked gas must keep aging or condensing until it is gone.
|
||||
awake[(y >> 5) * CW + (x >> 5)] = 3;
|
||||
if (m === FIRE) {
|
||||
const l = life[i];
|
||||
if (l <= 1) { mat[i] = EMPTY; life[i] = 0; wakeXY(x, y); return; }
|
||||
|
||||
+8
-2
@@ -108,7 +108,10 @@ function depositNear(m, T, x, y, skip) {
|
||||
const xx = x + dx, yy = y + dy;
|
||||
if (xx < 0 || yy < 0 || xx >= W || yy >= H) continue;
|
||||
const j = yy * W + xx;
|
||||
if (j !== skip && flyOpen(m, j)) { setCell(j, m, T, 0); return true; }
|
||||
if (j !== skip && flyOpen(m, j)) {
|
||||
if (mat[j] === STEAM) absorbSteam(xx); // displaced steam still belongs to the world's water
|
||||
setCell(j, m, T, 0); return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -121,7 +124,10 @@ function landFlyer(f, x, y) {
|
||||
for (let k = 0; k < 8; k++) {
|
||||
const yy = y - k; if (yy < 0) break;
|
||||
const j = yy * W + x;
|
||||
if (flyOpen(f.m, j)) { setCell(j, f.m, f.T, 0); return; }
|
||||
if (flyOpen(f.m, j)) {
|
||||
if (mat[j] === STEAM) absorbSteam(x); // landing replaces the gas, so keep its water in the clouds
|
||||
setCell(j, f.m, f.T, 0); return;
|
||||
}
|
||||
}
|
||||
if (!depositNear(f.m, f.T, x, y)) { if (f.rain) absorbSteam(x); else bagAdd(f.m, 1, true); } // nowhere to go: back into the bag (rain: back into the clouds)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user