Prevented spots spawning on sites

This commit is contained in:
Joshua Barretto 2021-08-01 17:04:02 +01:00
parent 06d85b8b10
commit 95dce5a1ac
3 changed files with 13 additions and 4 deletions

View File

@ -3,7 +3,11 @@ use crate::{
util::seed_expan,
Canvas,
};
use common::{generation::EntityInfo, terrain::Structure};
use common::{
generation::EntityInfo,
terrain::{Structure, TerrainChunkSize},
vol::RectVolSize,
};
use rand::prelude::*;
use rand_chacha::ChaChaRng;
use std::ops::Range;
@ -103,7 +107,11 @@ impl Spot {
trees: bool,
) {
let world_size = world.get_size();
for _ in 0..(world_size.product() as f32 / 32.0f32.powi(2) * freq).ceil() as u64 {
for _ in
0..(world_size.product() as f32 * TerrainChunkSize::RECT_SIZE.product() as f32 * freq
/ 1000.0f32.powi(2))
.ceil() as u64
{
let pos = world_size.map(|e| world.rng.gen_range(0..e as i32));
if let Some((_, chunk)) = world
.get_gradient_approx(pos)

View File

@ -45,6 +45,7 @@ pub use index::{IndexOwned, IndexRef};
use crate::{
column::ColumnGen,
index::Index,
layer::spot::Spot,
site::SiteKind,
util::{Grid, Sampler},
};
@ -105,6 +106,8 @@ impl World {
sim2::simulate(&mut index, &mut sim);
Spot::generate(&mut sim);
(Self { sim, civs }, IndexOwned::new(index))
})
}

View File

@ -1414,8 +1414,6 @@ impl WorldSim {
this.generate_cliffs();
Spot::generate(&mut this);
if opts.seed_elements {
this.seed_elements();
}