mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Variable town sizes
This commit is contained in:
parent
2a1ea63910
commit
d8702f128b
@ -359,11 +359,15 @@ impl Civs {
|
||||
SiteKind::Castle => {
|
||||
WorldSite::castle(Castle::generate(wpos, Some(ctx.sim), &mut rng))
|
||||
},
|
||||
SiteKind::Refactor => WorldSite::refactor(site2::Site::generate_city(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::Refactor => {
|
||||
let size = Lerp::lerp(0.03, 1.0, rng.gen_range(0.0..1f32).powi(5));
|
||||
WorldSite::refactor(site2::Site::generate_city(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
size,
|
||||
))
|
||||
},
|
||||
SiteKind::CliffTown => WorldSite::cliff_town(site2::Site::generate_cliff_town(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
|
@ -493,7 +493,8 @@ impl Site {
|
||||
site
|
||||
}
|
||||
|
||||
pub fn generate_city(land: &Land, rng: &mut impl Rng, origin: Vec2<i32>) -> Self {
|
||||
// Size is 0..1
|
||||
pub fn generate_city(land: &Land, rng: &mut impl Rng, origin: Vec2<i32>, size: f32) -> Self {
|
||||
let mut rng = reseed(rng);
|
||||
|
||||
let mut site = Site {
|
||||
@ -510,7 +511,7 @@ impl Site {
|
||||
|
||||
let mut castles = 0;
|
||||
|
||||
for _ in 0..120 {
|
||||
for _ in 0..(size * 200.0) as i32 {
|
||||
match *build_chance.choose_seeded(rng.gen()) {
|
||||
// House
|
||||
1 => {
|
||||
@ -1417,7 +1418,9 @@ impl Site {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn test_site() -> Site { Site::generate_city(&Land::empty(), &mut thread_rng(), Vec2::zero()) }
|
||||
pub fn test_site() -> Site {
|
||||
Site::generate_city(&Land::empty(), &mut thread_rng(), Vec2::zero(), 0.5)
|
||||
}
|
||||
|
||||
fn wpos_is_hazard(land: &Land, wpos: Vec2<i32>) -> Option<HazardKind> {
|
||||
if land
|
||||
|
Loading…
Reference in New Issue
Block a user