mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better giant tree spawn rate
This commit is contained in:
parent
db573f6b2d
commit
eff9fc5393
@ -106,10 +106,10 @@ impl Civs {
|
||||
|
||||
for _ in 0..initial_civ_count * 3 {
|
||||
attempt(5, || {
|
||||
let (kind, size) = match ctx.rng.gen_range(0..16) {
|
||||
0..=1 => (SiteKind::Castle, 3),
|
||||
2..=7 => (SiteKind::Refactor, 6),
|
||||
8 => (SiteKind::Tree, 4),
|
||||
let (kind, size) = match ctx.rng.gen_range(0..64) {
|
||||
0..=4 => (SiteKind::Castle, 3),
|
||||
5..=28 => (SiteKind::Refactor, 6),
|
||||
29..=31 => (SiteKind::Tree, 4),
|
||||
_ => (SiteKind::Dungeon, 0),
|
||||
};
|
||||
let loc = find_site_loc(&mut ctx, None, size)?;
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::{
|
||||
layer::tree::{ProceduralTree, TreeConfig},
|
||||
util::{FastNoise, Sampler},
|
||||
site::SpawnRules,
|
||||
Canvas, Land,
|
||||
};
|
||||
@ -11,6 +12,7 @@ use vek::*;
|
||||
pub struct Tree {
|
||||
pub origin: Vec2<i32>,
|
||||
alt: i32,
|
||||
seed: u32,
|
||||
tree: ProceduralTree,
|
||||
}
|
||||
|
||||
@ -19,6 +21,7 @@ impl Tree {
|
||||
Self {
|
||||
origin,
|
||||
alt: land.get_alt_approx(origin) as i32,
|
||||
seed: rng.gen(),
|
||||
tree: {
|
||||
let config = TreeConfig::giant(rng, 4.0, false);
|
||||
ProceduralTree::generate(config, rng)
|
||||
@ -36,6 +39,8 @@ impl Tree {
|
||||
}
|
||||
|
||||
pub fn render(&self, canvas: &mut Canvas, dynamic_rng: &mut impl Rng) {
|
||||
let nz = FastNoise::new(self.seed);
|
||||
|
||||
canvas.foreach_col(|canvas, wpos2d, col| {
|
||||
let rpos2d = wpos2d - self.origin;
|
||||
let bounds = self.tree.get_bounds().map(|e| e as i32);
|
||||
@ -51,7 +56,10 @@ impl Tree {
|
||||
|
||||
let (branch, leaves, _, _) = self.tree.is_branch_or_leaves_at(rposf);
|
||||
if leaves {
|
||||
canvas.set(wpos, Block::new(BlockKind::Leaves, Rgb::new(30, 130, 40)));
|
||||
let dark = Rgb::new(10, 70, 50).map(|e| e as f32);
|
||||
let light = Rgb::new(80, 140, 10).map(|e| e as f32);
|
||||
let leaf_col = Lerp::lerp(dark, light, nz.get(rposf.map(|e| e as f64) * 0.05) * 0.5 + 0.5);
|
||||
canvas.set(wpos, Block::new(BlockKind::Leaves, leaf_col.map(|e| e as u8)));
|
||||
} else if branch {
|
||||
canvas.set(wpos, Block::new(BlockKind::Wood, Rgb::new(80, 32, 0)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user