From 7fefaaaf7b6fa85cf9b27210fd5b273615b8ed73 Mon Sep 17 00:00:00 2001 From: Treeco <5021038-Treeco@users.noreply.gitlab.com> Date: Tue, 5 Oct 2021 18:26:27 +0100 Subject: [PATCH] Added mottled bark to birch --- common/src/terrain/structure.rs | 1 + world/src/block/mod.rs | 13 +++++++++++++ world/src/layer/tree.rs | 24 +++++++++++------------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/common/src/terrain/structure.rs b/common/src/terrain/structure.rs index d0dfefbfdb..48edef66dc 100644 --- a/common/src/terrain/structure.rs +++ b/common/src/terrain/structure.rs @@ -36,6 +36,7 @@ make_case_elim!( Sprite(kind: SpriteKind) = 18, Chestnut = 19, Baobab = 20, + BirchWood = 21, } ); diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index ad9219d54b..8c3c684c25 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -323,5 +323,18 @@ pub fn block_from_structure( ) }) }, + StructureBlock::BirchWood => { + let wpos = pos + structure_pos; + if field.chance( + (wpos + Vec3::new(wpos.z, wpos.z, 0) / 2) + / Vec3::new(1 + wpos.z % 2, 1 + (wpos.z + 1) % 2, 1), + 0.25, + ) && wpos.z % 2 == 0 + { + Some(Block::new(BlockKind::Wood, Rgb::new(70, 35, 25))) + } else { + Some(Block::new(BlockKind::Wood, Rgb::new(220, 170, 160))) + } + }, } } diff --git a/world/src/layer/tree.rs b/world/src/layer/tree.rs index 1e5e609f93..c1f13b4c96 100644 --- a/world/src/layer/tree.rs +++ b/world/src/layer/tree.rs @@ -234,9 +234,7 @@ pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) { StructureBlock::Filled(BlockKind::Wood, Rgb::new(150, 98, 41)) }, (_, _, _, true) => StructureBlock::None, - (true, _, _, _) => { - StructureBlock::Filled(BlockKind::Wood, t.config.wood_color) - }, + (true, _, _, _) => t.config.trunk_block, (_, true, _, _) => *leaf_block, _ => StructureBlock::None, }, @@ -338,7 +336,7 @@ pub struct TreeConfig { pub inhabited: bool, pub hanging_sprites: &'static [(f32, SpriteKind)], /// The colour of branches and the trunk. - pub wood_color: Rgb, + pub trunk_block: StructureBlock, } impl TreeConfig { @@ -363,7 +361,7 @@ impl TreeConfig { proportionality: 0.0, inhabited: false, hanging_sprites: &[(0.0002, SpriteKind::Apple), (0.00007, SpriteKind::Beehive)], - wood_color: Rgb::new(90, 45, 15), + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(90, 45, 15)), } } @@ -388,7 +386,7 @@ impl TreeConfig { proportionality: 0.8, inhabited: false, hanging_sprites: &[(0.00007, SpriteKind::Beehive), (0.015, SpriteKind::Liana)], - wood_color: Rgb::new(118, 67, 42), + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(118, 67, 42)), } } @@ -413,7 +411,7 @@ impl TreeConfig { proportionality: 1.0, inhabited: false, hanging_sprites: &[(0.00007, SpriteKind::Beehive)], - wood_color: Rgb::new(125, 60, 6), + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(125, 60, 6)), } } @@ -438,7 +436,7 @@ impl TreeConfig { proportionality: 0.0, inhabited: false, hanging_sprites: &[(0.00007, SpriteKind::Beehive)], - wood_color: Rgb::new(110, 68, 65), + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(110, 68, 65)), } } @@ -463,7 +461,7 @@ impl TreeConfig { proportionality: 0.0, inhabited: false, hanging_sprites: &[(0.00007, SpriteKind::Beehive)], - wood_color: Rgb::new(220, 170, 160), + trunk_block: StructureBlock::BirchWood, } } @@ -488,7 +486,7 @@ impl TreeConfig { proportionality: 1.0, inhabited: false, hanging_sprites: &[(0.00005, SpriteKind::Beehive)], - wood_color: Rgb::new(150, 95, 65), + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(150, 95, 65)), } } @@ -513,7 +511,7 @@ impl TreeConfig { proportionality: 0.5, inhabited: false, hanging_sprites: &[(0.00007, SpriteKind::Beehive)], - wood_color: Rgb::new(110, 42, 28), + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(110, 42, 28)), } } @@ -538,7 +536,7 @@ impl TreeConfig { proportionality: 1.0, inhabited: false, hanging_sprites: &[(0.0001, SpriteKind::Beehive)], - wood_color: Rgb::new(90, 35, 15), + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(90, 35, 15)), } } @@ -562,7 +560,7 @@ impl TreeConfig { proportionality: 0.0, inhabited, hanging_sprites: &[(0.00025, SpriteKind::Apple), (0.00025, SpriteKind::Beehive)], - wood_color: Rgb::new(110, 68, 22), + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(110, 68, 22)), } } }