Merge branch 'zesterer/tiny-fixes' into 'master'

Worldgen hotfix

See merge request veloren/veloren!2797
This commit is contained in:
Joshua Barretto 2021-09-01 12:47:50 +00:00
commit 82886dcd3f
5 changed files with 37 additions and 19 deletions

View File

@ -609,6 +609,11 @@ impl<const AVERAGE_PALETTE: bool> VoxelImageDecoding for TriPngEncoding<AVERAGE_
g: 229,
b: 198,
},
GlowingWeakRock => Rgb {
r: 61,
g: 185,
b: 240,
},
Grass => Rgb {
r: 51,
g: 160,

View File

@ -38,6 +38,7 @@ make_case_elim!(
WeakRock = 0x11, // Explodable
Lava = 0x12, // TODO: Reevaluate whether this should be in the rock section
GlowingRock = 0x13,
GlowingWeakRock = 0x14,
// 0x12 <= x < 0x20 is reserved for future rocks
Grass = 0x20, // Note: *not* the same as grass sprites
Snow = 0x21,
@ -168,7 +169,7 @@ impl Block {
pub fn get_glow(&self) -> Option<u8> {
match self.kind() {
BlockKind::Lava => Some(24),
BlockKind::GlowingRock => Some(12),
BlockKind::GlowingRock | BlockKind::GlowingWeakRock => Some(12),
_ => match self.get_sprite()? {
SpriteKind::StreetLamp | SpriteKind::StreetLampTall => Some(24),
SpriteKind::Ember => Some(20),
@ -272,7 +273,7 @@ impl Block {
#[inline]
pub fn mine_tool(&self) -> Option<ToolKind> {
match self.kind() {
BlockKind::WeakRock => Some(ToolKind::Pick),
BlockKind::WeakRock | BlockKind::GlowingWeakRock => Some(ToolKind::Pick),
_ => self.get_sprite().and_then(|s| s.mine_tool()),
}
}

View File

@ -48,7 +48,7 @@ impl ForestKind {
ForestKind::Baobab => 0.4..0.9,
ForestKind::Oak => -0.35..0.45,
ForestKind::Chestnut => -0.35..0.45,
ForestKind::Cedar => -1.0..0.1,
ForestKind::Cedar => -0.65..0.15,
ForestKind::Pine => -1.8..-0.2,
ForestKind::Birch => -0.7..0.25,
ForestKind::Mangrove => 0.4..1.6,

View File

@ -253,7 +253,7 @@ pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) {
canvas.set(
Vec3::new(wpos2d.x, wpos2d.y, z),
Block::new(
BlockKind::GlowingRock,
BlockKind::GlowingWeakRock,
noisy_color(info.index().colors.layer.vein.into(), 16),
),
);
@ -265,7 +265,7 @@ pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) {
canvas.set(
Vec3::new(wpos2d.x, wpos2d.y, z),
Block::new(
BlockKind::GlowingRock,
BlockKind::GlowingWeakRock,
noisy_color(info.index().colors.layer.vein.into(), 16),
),
);

View File

@ -199,7 +199,7 @@ pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) {
}
let hanging_sprites = match &tree.model {
TreeModel::Structure(_) => &[(0.0004, SpriteKind::Beehive)],
TreeModel::Structure(_) => [(0.0004, SpriteKind::Beehive)].as_ref(),
TreeModel::Procedural(t, _) => t.config.hanging_sprites,
};
@ -223,10 +223,12 @@ pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) {
TreeModel::Procedural(t, leaf_block) => Some(
match t.is_branch_or_leaves_at(model_pos.map(|e| e as f32 + 0.5)) {
(_, _, true, _) => {
StructureBlock::Filled(BlockKind::Wood, Rgb::new(110, 68, 22))
StructureBlock::Filled(BlockKind::Wood, Rgb::new(150, 98, 41))
},
(_, _, _, true) => StructureBlock::None,
(true, _, _, _) => StructureBlock::Log,
(true, _, _, _) => {
StructureBlock::Filled(BlockKind::Wood, t.config.wood_color)
},
(_, true, _, _) => *leaf_block,
_ => StructureBlock::None,
},
@ -327,6 +329,8 @@ pub struct TreeConfig {
/// Whether the tree is inhabited (adds various features and effects)
pub inhabited: bool,
pub hanging_sprites: &'static [(f32, SpriteKind)],
/// The colour of branches and the trunk.
pub wood_color: Rgb<u8>,
}
impl TreeConfig {
@ -350,7 +354,8 @@ impl TreeConfig {
leaf_vertical_scale: 1.0,
proportionality: 0.0,
inhabited: false,
hanging_sprites: &[(0.0005, SpriteKind::Beehive)],
hanging_sprites: &[(0.0002, SpriteKind::Apple), (0.00007, SpriteKind::Beehive)],
wood_color: Rgb::new(90, 45, 15),
}
}
@ -374,7 +379,8 @@ impl TreeConfig {
leaf_vertical_scale: 0.4,
proportionality: 0.8,
inhabited: false,
hanging_sprites: &[(0.00015, SpriteKind::Beehive), (0.015, SpriteKind::Liana)],
hanging_sprites: &[(0.00007, SpriteKind::Beehive), (0.015, SpriteKind::Liana)],
wood_color: Rgb::new(118, 67, 42),
}
}
@ -398,7 +404,8 @@ impl TreeConfig {
leaf_vertical_scale: 0.2,
proportionality: 1.0,
inhabited: false,
hanging_sprites: &[(0.0005, SpriteKind::Beehive)],
hanging_sprites: &[(0.00007, SpriteKind::Beehive)],
wood_color: Rgb::new(125, 60, 6),
}
}
@ -422,7 +429,8 @@ impl TreeConfig {
leaf_vertical_scale: 0.4,
proportionality: 0.0,
inhabited: false,
hanging_sprites: &[(0.0005, SpriteKind::Beehive)],
hanging_sprites: &[(0.00007, SpriteKind::Beehive)],
wood_color: Rgb::new(110, 68, 65),
}
}
@ -446,7 +454,8 @@ impl TreeConfig {
leaf_vertical_scale: 0.2,
proportionality: 1.0,
inhabited: false,
hanging_sprites: &[(0.0005, SpriteKind::Beehive)],
hanging_sprites: &[(0.00005, SpriteKind::Beehive)],
wood_color: Rgb::new(150, 95, 65),
}
}
@ -460,17 +469,18 @@ impl TreeConfig {
branch_child_len: 0.75,
branch_child_radius: 0.75,
branch_child_radius_lerp: true,
leaf_radius: 2.5 * log_scale..2.6 * log_scale,
leaf_radius: 2.0 * log_scale..2.1 * log_scale,
leaf_radius_scaled: 0.0,
straightness: 0.4,
straightness: 0.3,
max_depth: 5,
splits: 3.0..3.5,
splits: 3.5..4.25,
split_range: 0.5..1.25,
branch_len_bias: 0.0,
leaf_vertical_scale: 0.5,
proportionality: 0.5,
inhabited: false,
hanging_sprites: &[(0.0005, SpriteKind::Beehive)],
hanging_sprites: &[(0.00007, SpriteKind::Beehive)],
wood_color: Rgb::new(110, 42, 28),
}
}
@ -494,7 +504,8 @@ impl TreeConfig {
leaf_vertical_scale: 0.3,
proportionality: 1.0,
inhabited: false,
hanging_sprites: &[(0.0005, SpriteKind::Beehive)],
hanging_sprites: &[(0.0001, SpriteKind::Beehive)],
wood_color: Rgb::new(90, 35, 15),
}
}
@ -517,7 +528,8 @@ impl TreeConfig {
leaf_vertical_scale: 0.6,
proportionality: 0.0,
inhabited,
hanging_sprites: &[(0.0005, SpriteKind::Beehive)],
hanging_sprites: &[(0.00025, SpriteKind::Apple), (0.00025, SpriteKind::Beehive)],
wood_color: Rgb::new(110, 68, 22),
}
}
}