Merge branch 'sharp/better-is-underwater' into 'master'

Better is_underwater() check.

See merge request veloren/veloren!759
This commit is contained in:
Joshua Yanovski 2020-01-26 20:52:56 +00:00
commit 287b62946e
2 changed files with 6 additions and 4 deletions

View File

@ -152,7 +152,7 @@ impl World {
let mut supplement = ChunkSupplement {
entities: if rand::thread_rng().gen::<f32>() < SPAWN_RATE
&& sim_chunk.chaos < 0.5
&& !sim_chunk.is_underwater
&& !sim_chunk.is_underwater()
{
vec![EntityInfo {
pos: gen_entity_pos(),

View File

@ -1475,7 +1475,7 @@ impl WorldSim {
let new_chunk = this.get(downhill_pos)?;
const SLIDE_THRESHOLD: f32 = 5.0;
if new_chunk.is_underwater || new_chunk.alt + SLIDE_THRESHOLD < chunk.alt {
if new_chunk.is_underwater() || new_chunk.alt + SLIDE_THRESHOLD < chunk.alt {
break;
} else {
chunk = new_chunk;
@ -1720,7 +1720,6 @@ pub struct SimChunk {
pub spawn_rate: f32,
pub location: Option<LocationInfo>,
pub river: RiverData,
pub is_underwater: bool,
pub structures: Structures,
pub contains_waypoint: bool,
@ -1898,7 +1897,6 @@ impl SimChunk {
} else {
0.0
},
is_underwater,
is_cliffs: cliff > 0.5 && !is_underwater,
near_cliffs: cliff > 0.2,
tree_density,
@ -1971,6 +1969,10 @@ impl SimChunk {
}
}
pub fn is_underwater(&self) -> bool {
self.river.river_kind.is_some()
}
pub fn get_base_z(&self) -> f32 {
self.alt - self.chaos * 50.0 - 16.0
}