diff --git a/CHANGELOG.md b/CHANGELOG.md index d20e78c7fa..ae113245c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - A way for servers to specify must-accept rules for players - A flag argument type for commands - The ability to turn lamp-like sprites on and off +- Added Autumn Forests, Cherry Blossom Forests, and Maple Trees. ### Changed diff --git a/assets/world/style/colors.ron b/assets/world/style/colors.ron index e974827c67..f1fa96d698 100644 --- a/assets/world/style/colors.ron +++ b/assets/world/style/colors.ron @@ -19,10 +19,7 @@ // Leaves all actually get interpolated. TemperateLeaves: [ (start: (20, 100, 40), end: (60, 120, 0)), - // TODO: Uncomment when we add autumnal trees. - //(start: (178, 216, 0), end: (255, 185, 63)), - //(start: (142, 164, 0), end: (142, 164, 0)), - //(start: (168, 81, 0), end: (54, 150, 31)), + ], PineLeaves: [(start: (0, 60, 50), end: (30, 80, 10))], FrostpineLeaves: [(start: (24, 89, 85), end: (67, 22, 82))], @@ -34,7 +31,8 @@ Chestnut: [(start: (30, 80, 0), end: (50, 120, 0))], Baobab: [(start: (50, 100, 40), end: (50, 90, 0))], MapleLeaves: [(start: (103, 32, 21), end: (131, 24, 26)), (start: (96, 30, 44), end: (92, 9, 46))], - CherryLeaves: [(start: (210, 109, 116), end: (217, 102, 102)), (start: (191, 128, 151), end: (206, 113, 123))] + CherryLeaves: [(start: (210, 109, 116), end: (217, 102, 102)), (start: (191, 128, 151), end: (206, 113, 123))], + AutumnLeaves: [(start: (198, 87, 24), end: (184, 57, 15)), (start: (230, 151, 27), end: (213, 130, 20)), (start: (131, 23, 31), end: (115, 5, 31))], ) // Water blocks ignore color now so this isn't used, but just in case this color was worth diff --git a/common/src/terrain/structure.rs b/common/src/terrain/structure.rs index 619fe4c33f..9a5b6b8868 100644 --- a/common/src/terrain/structure.rs +++ b/common/src/terrain/structure.rs @@ -50,6 +50,7 @@ make_case_elim!( HaniwaKeyhole(consumes: String) = 30, MapleLeaves = 31, CherryLeaves = 32, + AutumnLeaves = 33, } ); diff --git a/world/src/all.rs b/world/src/all.rs index 9a59503deb..e4fc6867f7 100644 --- a/world/src/all.rs +++ b/world/src/all.rs @@ -21,6 +21,7 @@ pub enum ForestKind { Dead, Mapletree, Cherry, + AutumnTree, } pub struct Environment { @@ -47,6 +48,7 @@ impl ForestKind { ForestKind::Dead => 0.0..1.5, ForestKind::Mapletree => 0.65..1.25, ForestKind::Cherry => 0.45..0.75, + ForestKind::AutumnTree => 0.25..0.65, _ => 0.0..0.0, } } @@ -68,6 +70,7 @@ impl ForestKind { ForestKind::Dead => -1.5..1.0, ForestKind::Mapletree => -0.15..0.25, ForestKind::Cherry => -0.10..0.15, + ForestKind::AutumnTree => -0.45..0.05, _ => 0.0..0.0, } } @@ -98,6 +101,7 @@ impl ForestKind { ForestKind::Dead => 0.01, ForestKind::Mapletree => 0.65, ForestKind::Cherry => 12.0, + ForestKind::AutumnTree => 125.0, _ => 0.0, } } @@ -117,6 +121,7 @@ impl ForestKind { ForestKind::Swamp => 0.4, ForestKind::Mapletree => 0.4, ForestKind::Cherry => 0.3, + ForestKind::AutumnTree => 0.4, _ => 1.0, } } diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index 5aae6790cd..251e2ff3b6 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -282,7 +282,8 @@ pub fn block_from_structure( | StructureBlock::Chestnut | StructureBlock::Baobab | StructureBlock::MapleLeaves - | StructureBlock::CherryLeaves => { + | StructureBlock::CherryLeaves + | StructureBlock::AutumnLeaves => { let ranges = sblock .elim_case_pure(&index.colors.block.structure_blocks) .as_ref() diff --git a/world/src/layer/tree.rs b/world/src/layer/tree.rs index ba012f6094..5398f65a3f 100644 --- a/world/src/layer/tree.rs +++ b/world/src/layer/tree.rs @@ -242,6 +242,15 @@ pub fn apply_trees_to( StructureBlock::CherryLeaves, ); }, + ForestKind::AutumnTree => { + break 'model TreeModel::Procedural( + ProceduralTree::generate( + TreeConfig::autumn_tree(&mut RandomPerm::new(seed), scale), + &mut RandomPerm::new(seed), + ), + StructureBlock::AutumnLeaves, + ); + }, }; let models = models.read(); @@ -766,6 +775,31 @@ impl TreeConfig { trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(69, 37, 17)), } } + + pub fn autumn_tree(rng: &mut impl Rng, scale: f32) -> Self { + let scale = scale * (0.8 + rng.gen::().powi(2) * 0.5); + let log_scale = 1.0 + scale.log2().max(0.0); + + Self { + trunk_len: 9.0 * scale, + trunk_radius: 2.0 * scale, + branch_child_len: 0.9, + branch_child_radius: 0.75, + branch_child_radius_lerp: true, + leaf_radius: 2.5 * log_scale..3.25 * log_scale, + leaf_radius_scaled: 0.0, + straightness: 0.45, + max_depth: 4, + splits: 2.25..3.25, + split_range: 0.75..1.5, + branch_len_bias: 0.0, + leaf_vertical_scale: 1.0, + proportionality: 0.0, + inhabited: false, + hanging_sprites: &[(0.0002, SpriteKind::Apple), (0.00007, SpriteKind::Beehive)], + trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(90, 45, 15)), + } + } } // TODO: Rename this to `Tree` when the name conflict is gone