Resonance ping: right click with the drill lights up nearby veins through fog (t50)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -159,3 +159,19 @@ function pulseTick() {
|
||||
}
|
||||
drillPulses = drillPulses.filter(p => p.r < p.range + 3);
|
||||
}
|
||||
// Resonance ping (t50): an echo from the bot that finds ore veins in the rock around it, under
|
||||
// fog too. Reach grows with the bit. Only reads the world; the UI draws the echo.
|
||||
const PING_VEINS = new Uint8Array(NMAT); for (const m of [COALV, CUV, FEV, SNV, ZNV, AGV, AUV]) PING_VEINS[m] = 1;
|
||||
function pingRadius() { return BIT_TIERS[player.bitTier].reach * 3; }
|
||||
// Natural vein cells within r of (cx, cy), and the materials found.
|
||||
function resonancePing(cx, cy, r = pingRadius()) {
|
||||
const cells = [], found = new Set(), r2 = r * r;
|
||||
const x0 = Math.max(0, Math.floor(cx - r)), x1 = Math.min(W - 1, Math.ceil(cx + r));
|
||||
const y0 = Math.max(0, Math.floor(cy - r)), y1 = Math.min(H - 1, Math.ceil(cy + r));
|
||||
for (let y = y0; y <= y1; y++) for (let x = x0; x <= x1; x++) {
|
||||
const dx = x - cx, dy = y - cy, i = y * W + x, m = mat[i];
|
||||
if (dx * dx + dy * dy > r2 || !PING_VEINS[m] || !(flags[i] & F_NAT)) continue;
|
||||
cells.push(i); found.add(m);
|
||||
}
|
||||
return { cells, found: [...found], r, x: cx, y: cy };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user