Grains riding a belt or filter cast no shadow (t37)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-2
@@ -5,6 +5,14 @@
|
||||
function builtForLight(i, x, y) {
|
||||
return (PH[mat[i]] === PH_SOLID && !(flags[i] & F_NAT)) || blockP[(y >> 2) * BW + (x >> 2)] || mach[i] || part[i];
|
||||
}
|
||||
function onBeltForLight(i) {
|
||||
for (let depth = 0; depth <= 12 && i < N; depth++, i += W) {
|
||||
const m = mat[i], ph = PH[m];
|
||||
if (m === BELTL || m === BELTR || part[i] === P_FILTER) return true;
|
||||
if (ph !== PH_POWDER && ph !== PH_LIQUID) return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function computeLight() {
|
||||
const res = SET.lighting === 'fast' ? 4 : 2;
|
||||
const M = Math.ceil(28 / res);
|
||||
@@ -32,7 +40,7 @@ function computeLight() {
|
||||
let y = roofY[x];
|
||||
for (; y < roofEnd; y++) {
|
||||
const i = y * W + x, ph = PH[mat[i]];
|
||||
if ((ph === PH_SOLID || ph === PH_POWDER || ph === PH_LIQUID) && !builtForLight(i, x, y)) break;
|
||||
if ((ph === PH_SOLID || ph === PH_POWDER || ph === PH_LIQUID) && !builtForLight(i, x, y) && !((ph === PH_POWDER || ph === PH_LIQUID) && onBeltForLight(i))) break;
|
||||
}
|
||||
lightRoof[lx] = y;
|
||||
}
|
||||
@@ -42,7 +50,7 @@ function computeLight() {
|
||||
const wx = (lx0 + lx) * res, k = ly * lw + lx;
|
||||
if (wx < 0 || wy < 0 || wx >= W || wy >= H) { la[k] = 0; lr[k] = lg[k] = lb[k] = 0; continue; }
|
||||
const i = wy * W + wx, m = mat[i], ph = PH[m];
|
||||
la[k] = builtForLight(i, wx, wy) ? aAir : ph === PH_EMPTY ? (bgm[i] ? aGas : aAir) : ph === PH_GAS ? aGas : ph === PH_LIQUID ? aLiq : m === GLASS || m === ICE ? aGas : aSol;
|
||||
la[k] = builtForLight(i, wx, wy) || ((ph === PH_POWDER || ph === PH_LIQUID) && onBeltForLight(i)) ? aAir : ph === PH_EMPTY ? (bgm[i] ? aGas : aAir) : ph === PH_GAS ? aGas : ph === PH_LIQUID ? aLiq : m === GLASS || m === ICE ? aGas : aSol;
|
||||
let r = 0, g = 0, b = 0;
|
||||
if (wy < lightRoof[lx]) { r = skyK; g = skyK * 0.98; b = skyK * 0.94; }
|
||||
else if (wy < surfY[wx] && ph !== PH_SOLID) { const v = skyK * 0.9; r = v; g = v * 0.98; b = v * 0.95; }
|
||||
|
||||
Reference in New Issue
Block a user