Hot loads: visible melt damage, rebuild-over repair, warning glow (t69)

This commit is contained in:
2026-10-29 18:30:26 -04:00
parent b655d754b9
commit 5fd8110470
14 changed files with 246 additions and 15 deletions
+29
View File
@@ -0,0 +1,29 @@
// Persistent scorch and broken casing, or a warning before the 1000°C limit, in both looks.
function drawScrewHeat() {
const ctx = R.ctx, zp = R.zp, v = viewCells(), s = BS * zp;
const x0 = Math.max(0, Math.floor(R.camX / BS)), x1 = Math.min(BW - 1, Math.floor((R.camX + v.w) / BS));
const y0 = Math.max(0, Math.floor(R.camY / BS)), y1 = Math.min(BH - 1, Math.floor((R.camY + v.h) / BS));
ctx.save();
for (let by = y0; by <= y1; by++) for (let bx = x0; bx <= x1; bx++) {
const b = by * BW + bx;
if (blockP[b] !== BP_SCREW || (SET.fog && fogSeen(bx * BS + 2, by * BS + 2) < 64)) continue;
const damage = screwDamageMask(b);
if (!damage && screwLoadHeat(b) < 900) continue;
const p = worldToScreenPx(bx * BS, by * BS);
if (damage) {
ctx.fillStyle = 'rgba(32,19,17,0.65)'; ctx.fillRect(p.x, p.y, s, s);
// Keep the actual holes visible beneath a jagged fracture, even after cooling.
ctx.strokeStyle = '#f18b68'; ctx.lineWidth = Math.max(1, zp * 0.3);
ctx.beginPath(); ctx.moveTo(p.x, p.y + s * 0.65);
ctx.lineTo(p.x + s * 0.4, p.y + s * 0.4); ctx.lineTo(p.x + s * 0.6, p.y + s * 0.65);
ctx.lineTo(p.x + s, p.y + s * 0.3); ctx.stroke();
ctx.setLineDash([zp, zp]); ctx.strokeRect(p.x, p.y, s, s); ctx.setLineDash([]);
} else {
ctx.fillStyle = 'rgba(255,126,38,0.3)'; ctx.fillRect(p.x, p.y, s, s);
ctx.strokeStyle = '#ffb54f'; ctx.lineWidth = Math.max(1, zp * 0.3); ctx.strokeRect(p.x, p.y, s, s);
ctx.fillStyle = '#ffdc85'; ctx.fillRect(p.x + s * 0.45, p.y + s * 0.15, zp * 0.4, s * 0.4);
ctx.fillRect(p.x + s * 0.45, p.y + s * 0.7, zp * 0.4, zp * 0.4);
}
}
ctx.restore();
}