Digging orders reach into the fog: unexplored blocks are picked like walls and marked tiles glow dark yellow in the dark

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-04 08:20:17 +01:00
1 parent 2de0a1de8a
commit 776c9ad9de
3 files changed
+10 -4

No files matched your search

+6 -3
View File
@@ -108,7 +108,8 @@ impl Cam {
while t <= t1 {
let p = o + d * t;
let (x, z) = (p.x.floor() as i32, p.z.floor() as i32);
if inb(x, z) && map.t[idx(x, z)].solid() && p.y <= WALL_H {
// unexplored tiles are drawn as blocks: they are picked like walls
if inb(x, z) && (map.t[idx(x, z)].solid() || !map.shown(idx(x, z))) && p.y <= WALL_H {
return Some((x, z, p));
}
t += 0.03;
@@ -501,9 +502,11 @@ fn build_chunk(map: &Map, amb: &[f32], cx: i32, cz: i32, atlas: &Texture2D, wall
let (ua, ub) = cell_uv(tex);
let (xf, zf) = (x as f32, z as f32);
if !map.shown(idx(x, z)) {
// fog of war: a black block, with black sides towards known open ground
// fog of war: a black block, with black sides towards known open ground;
// tiles marked for digging glow dark yellow so the plan stays visible
let black = col(Vec3::splat(0.0), 1.0);
mb.quad([vec3(xf, WALL_H, zf), vec3(xf + 1.0, WALL_H, zf), vec3(xf + 1.0, WALL_H, zf + 1.0), vec3(xf, WALL_H, zf + 1.0)], [ua, ua, ua, ua], [black; 4], [Vec3::Y; 4]);
let top = if t.marked { col(vec3(0.42, 0.33, 0.06), 1.0) } else { black };
mb.quad([vec3(xf, WALL_H, zf), vec3(xf + 1.0, WALL_H, zf), vec3(xf + 1.0, WALL_H, zf + 1.0), vec3(xf, WALL_H, zf + 1.0)], [ua, ua, ua, ua], [top; 4], [Vec3::Y; 4]);
for (d, &(dx, dz)) in DIR4.iter().enumerate() {
let open = map.get(x + dx, z + dz).map_or(false, |o| !o.solid()) && map.shown(idx((x + dx).max(0), (z + dz).max(0)));
if !open {