Sloped belts and filters, laid by a 45° drag (t40)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// A slope's band uses world coordinates, so its stripes never restart at block joints.
|
||||
function slopeBeltAt(i, x, y) {
|
||||
const b = (y >> 2) * BW + (x >> 2);
|
||||
if (isSlopeBelt(blockP[b])) return b;
|
||||
if ((y & 3) || ((x & 3) !== 0 && (x & 3) !== 3)) return -1;
|
||||
const owner = slopeSealOwner(i);
|
||||
return owner >= 0 && isSlopeBelt(blockP[owner]) ? owner : -1;
|
||||
}
|
||||
function slopeBeltColor(b, x, y, anim, br, bg, bb) {
|
||||
const c = blockP[b], grade = beltGrade(c), d = y - beltFaceY(c, b % BW, (b / BW) | 0, x);
|
||||
let r = br, g = bg, blue = bb;
|
||||
if (d >= 0) {
|
||||
const dir = isFilter(c) ? (blockV[b] & 128 ? 1 : -1) : (blockV[b] ? 1 : -1);
|
||||
const axis = (x + grade * y) * 0.5, stripe = (Math.floor((axis - dir * (anim >> 1)) / 2) & 1);
|
||||
if (d === 0) {
|
||||
r = stripe ? 92 : 56; g = stripe ? 96 : 58; blue = stripe ? 104 : 66;
|
||||
if (isFilter(c) && !stripe) {
|
||||
const f = filterCfg.get(b), m = f && f.m[0];
|
||||
if (m) { r = COLR[m] * 0.7; g = COLG[m] * 0.7; blue = COLB[m] * 0.7; }
|
||||
}
|
||||
} else if (isFilter(c)) {
|
||||
if (d === 1 && ((x + (grade < 0 ? 0 : 1)) & 1)) { r = 64; g = 68; blue = 76; }
|
||||
} else if (d === 1) {
|
||||
r = stripe ? 132 : 104; g = stripe ? 120 : 94; blue = stripe ? 108 : 84;
|
||||
} else { r = 46; g = 48; blue = 54; }
|
||||
}
|
||||
return (r | 0) | ((g | 0) << 8) | ((blue | 0) << 16);
|
||||
}
|
||||
Reference in New Issue
Block a user