From 15c5f2f9698cfe44077e7418bce19556ef8ec2bb Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Fri, 28 Jan 2022 16:45:58 +0000 Subject: [PATCH] Better paths in snow --- world/src/site2/mod.rs | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/world/src/site2/mod.rs b/world/src/site2/mod.rs index d7e8bbfa4e..acd3d5dde2 100644 --- a/world/src/site2/mod.rs +++ b/world/src/site2/mod.rs @@ -715,8 +715,11 @@ impl Site { let mut underground = true; for z in -8..6 { canvas.map(Vec3::new(wpos2d.x, wpos2d.y, alt + z), |b| { - if b.is_filled() { - if underground && b.is_terrain() { + if b.kind() == BlockKind::Snow { + underground = false; + b.into_vacant() + } else if b.is_filled() { + if b.is_terrain() { Block::new(BlockKind::Earth, Rgb::new(0x6A, 0x47, 0x24)) } else { b @@ -783,20 +786,25 @@ impl Site { for z in -6..4 { canvas.map( Vec3::new(wpos2d.x, wpos2d.y, alt + z), - |b| if b.is_filled() { - if underground && b.is_terrain() { - Block::new(BlockKind::Earth, Rgb::new(0x6A, 0x47, 0x24)) - } else { - b - } - } else { + |b| { let sprite = if underground && self.tile_wpos(tpos) == wpos2d && (tpos + tpos.yx() / 2) % 2 == Vec2::zero() { SpriteKind::StreetLamp } else { SpriteKind::Empty }; - underground = false; - b.with_sprite(sprite) + if b.kind() == BlockKind::Snow { + underground = false; + b.into_vacant().with_sprite(sprite) + } else if b.is_filled() { + if b.is_terrain() { + Block::new(BlockKind::Earth, Rgb::new(0x6A, 0x47, 0x24)) + } else { + b + } + } else { + underground = false; + b.into_vacant().with_sprite(sprite) + } }, ); }