From 00b003a23c905ceaa11bfaacd9900a186c889358 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Tue, 15 Feb 2022 19:01:43 +0000 Subject: [PATCH] Enabled site2 towns by default --- assets/world/features.ron | 3 ++- server/src/lib.rs | 5 ++++- world/src/civ/mod.rs | 11 +++++------ world/src/config.rs | 3 ++- world/src/site2/mod.rs | 10 ++++++++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/assets/world/features.ron b/assets/world/features.ron index 2c4ed7198b..25a5005a61 100644 --- a/assets/world/features.ron +++ b/assets/world/features.ron @@ -9,6 +9,7 @@ scatter: true, paths: true, spots: true, - site2: false, + site2_towns: true, + site2_giant_trees: false, wildlife_density: 1.0, ) diff --git a/server/src/lib.rs b/server/src/lib.rs index 1dd69b605a..9f691f3508 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -400,10 +400,13 @@ impl Server { Some(t) => t.center, None => { let center_chunk = world.sim().map_size_lg().chunks().map(i32::from) / 2; + use world::civ::SiteKind; world .civs() .sites() - .filter(|site| matches!(site.kind, world::civ::SiteKind::Settlement)) + .filter(|site| { + matches!(site.kind, SiteKind::Settlement | SiteKind::Refactor) + }) .map(|site| site.center) .min_by_key(|site_pos| site_pos.distance_squared(center_chunk)) .unwrap_or(center_chunk) diff --git a/world/src/civ/mod.rs b/world/src/civ/mod.rs index f69026743b..54f2b2b2d8 100644 --- a/world/src/civ/mod.rs +++ b/world/src/civ/mod.rs @@ -101,10 +101,9 @@ impl Civs { for _ in 0..initial_civ_count * 3 { attempt(5, || { let (kind, size) = match ctx.rng.gen_range(0..64) { - 0..=4 => (SiteKind::Castle, 3), - 5..=28 if index.features().site2 => (SiteKind::Refactor, 6), - 29..=31 => { - if index.features().site2 { + 0..=5 => (SiteKind::Castle, 3), + 28..=31 => { + if index.features().site2_giant_trees { (SiteKind::GiantTree, 4) } else { (SiteKind::Tree, 4) @@ -449,7 +448,7 @@ impl Civs { } fn birth_civ(&mut self, ctx: &mut GenCtx) -> Option> { - let kind = SiteKind::Settlement; + let kind = SiteKind::Refactor; let site = attempt(5, || { let loc = find_site_loc(ctx, None, 1, kind)?; Some(self.establish_site(ctx, loc, |place| Site { @@ -1131,7 +1130,7 @@ impl SiteKind { // FIXME: Provide specific values for each individual SiteKind match self { SiteKind::Dungeon => 4, - _ => 2, // This is just an arbitrary value + _ => 8, // This is just an arbitrary value } } } diff --git a/world/src/config.rs b/world/src/config.rs index c7faf7c2ce..fddc417e04 100644 --- a/world/src/config.rs +++ b/world/src/config.rs @@ -86,7 +86,8 @@ pub struct Features { pub scatter: bool, pub paths: bool, pub spots: bool, - pub site2: bool, + pub site2_towns: bool, + pub site2_giant_trees: bool, // 1.0 is the default wildlife density pub wildlife_density: f32, } diff --git a/world/src/site2/mod.rs b/world/src/site2/mod.rs index dda829e13c..62cbaf831b 100644 --- a/world/src/site2/mod.rs +++ b/world/src/site2/mod.rs @@ -792,7 +792,7 @@ impl Site { let alt = canvas.col(wpos2d).map_or(0, |col| col.alt as i32); let sub_surface_color = canvas .col(wpos2d) - .map_or(vek::Rgb::zero(), |col| col.sub_surface_color); + .map_or(Rgb::zero(), |col| col.sub_surface_color * 0.5); let mut underground = true; for z in -8..6 { canvas.map(Vec3::new(wpos2d.x, wpos2d.y, alt + z), |b| { @@ -867,6 +867,9 @@ impl Site { if min_dist.is_some() { let alt = /*avg_hard_alt.map(|(sum, weight)| sum / weight).unwrap_or_else(||*/ canvas.col(wpos2d).map_or(0.0, |col| col.alt)/*)*/ as i32; let mut underground = true; + let sub_surface_color = canvas + .col(wpos2d) + .map_or(Rgb::zero(), |col| col.sub_surface_color * 0.5); for z in -6..4 { canvas.map( Vec3::new(wpos2d.x, wpos2d.y, alt + z), @@ -881,7 +884,10 @@ impl Site { b.into_vacant().with_sprite(sprite) } else if b.is_filled() { if b.is_terrain() { - Block::new(BlockKind::Earth, Rgb::new(0x6A, 0x47, 0x24)) + Block::new( + BlockKind::Earth, + (sub_surface_color * 255.0).as_(), + ) } else { b }