Prevented towns in oceans

This commit is contained in:
Joshua Barretto 2019-09-23 14:32:54 +01:00
parent 5933ae608a
commit ba7fa8b55d
2 changed files with 5 additions and 2 deletions

View File

@ -392,7 +392,7 @@ impl<'a> BlockGen<'a> {
}
});
Some(block)
Some(block.unwrap_or(Block::empty()))
}
}

View File

@ -6,6 +6,7 @@ use crate::{
block::block_from_structure,
column::{ColumnGen, ColumnSample},
util::Sampler,
CONFIG,
};
use common::{
assets,
@ -123,7 +124,9 @@ impl TownState {
let radius = rng.gen_range(18, 20) * 9;
let size = Vec2::broadcast(radius * 2 / 9 - 2);
if gen.get(center).map(|sample| sample.chaos).unwrap_or(0.0) > 0.35 {
if gen.get(center).map(|sample| sample.chaos).unwrap_or(0.0) > 0.35
|| gen.get(center).map(|sample| sample.alt).unwrap_or(0.0) < CONFIG.sea_level + 10.0
{
return None;
}