From 7a1612aa8a080676ed31154a26446d218063fbe8 Mon Sep 17 00:00:00 2001 From: Isse Date: Mon, 6 Nov 2023 07:22:41 +0100 Subject: [PATCH] small fixes --- world/src/site2/mod.rs | 19 +++++++------ world/src/site2/plot/tavern.rs | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/world/src/site2/mod.rs b/world/src/site2/mod.rs index 9746cce08c..4c252a0d56 100644 --- a/world/src/site2/mod.rs +++ b/world/src/site2/mod.rs @@ -593,12 +593,12 @@ impl Site { site.make_plaza(land, &mut rng); let build_chance = Lottery::from(vec![ - // (64.0, 1), - // (5.0, 2), - // (8.0, 3), - // (5.0, 4), - // (5.0, 5), - // (15.0, 6), + (64.0, 1), + (5.0, 2), + (8.0, 3), + (5.0, 4), + (5.0, 5), + (15.0, 6), (15.0, 7), ]); @@ -607,6 +607,8 @@ impl Site { let mut workshops = 0; let mut airship_docks = 0; + + let mut taverns = 0; for _ in 0..(size * 200.0) as i32 { match *build_chance.choose_seeded(rng.gen()) { // Workshop @@ -924,7 +926,7 @@ impl Site { } } }, - 7 if size > 0.125 => { + 7 if (size > 0.125 && taverns < 2) => { let size = (3.5 + rng.gen::().powf(5.0) * 2.0).round() as u32; if let Some((aabr, door_tile, door_dir)) = attempt(32, || { site.find_roadside_aabr( @@ -955,7 +957,8 @@ impl Site { plot: Some(plot), hard_alt: Some(tavern_alt), }); - workshops += 1; + + taverns += 1; } else { site.make_plaza(land, &mut rng); } diff --git a/world/src/site2/plot/tavern.rs b/world/src/site2/plot/tavern.rs index 38c7ed2ebc..46b2515a2b 100644 --- a/world/src/site2/plot/tavern.rs +++ b/world/src/site2/plot/tavern.rs @@ -1075,6 +1075,58 @@ impl Structure for Tavern { dir, ) .fill(wall_fill.clone()); + painter + .aabb(aabb(Aabb { + min: (dir.select_aabr_with(roof.bounds, roof.bounds.min + 1) + - dir.to_vec2()) + .with_z(roof.min_z), + max: (dir.select_aabr_with(roof.bounds, roof.bounds.max - 1) + - dir.to_vec2()) + .with_z(roof.min_z), + })) + .fill(wall_detail_fill.clone()); + let center_bounds = Aabr { + min: (dir.select_aabr_with(roof.bounds, roof.bounds.center()) + - dir.to_vec2()), + max: (dir.select_aabr_with( + roof.bounds, + (roof.bounds.min + roof.bounds.max + 1) / 2, + ) - dir.to_vec2()), + }; + painter + .aabb(aabb(Aabb { + min: center_bounds.min.with_z(roof.min_z), + max: center_bounds.max.with_z(max_z - 1), + })) + .fill(wall_detail_fill.clone()); + for d in [dir.orthogonal(), -dir.orthogonal()] { + let hgt = max_z - roof.min_z; + let half_size = d.select(roof.bounds.size() + 1) / 2; + let e = half_size - hgt + 1; + let e = e - e % 2; + let f = half_size - e; + let hgt = (hgt - 1).min(e - f % 2) - (d.signum() - 1) / 2; + let mut aabr = Aabr { + min: d.select_aabr_with(center_bounds, center_bounds.min), + max: d.select_aabr_with(center_bounds, center_bounds.max) + + d.to_vec2() * hgt, + } + .made_valid(); + aabr.max += 1; + painter + .plane( + aabr, + aabr.min + .with_z(if d.signum() < 0 { + roof.min_z + hgt + } else { + roof.min_z + }) + .as_(), + d.to_vec2().as_(), + ) + .fill(wall_detail_fill.clone()); + } painter .gable( aabb(Aabb {