mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'sharp/better-is-underwater' into 'master'
Better is_underwater() check. See merge request veloren/veloren!759
This commit is contained in:
commit
287b62946e
@ -152,7 +152,7 @@ impl World {
|
|||||||
let mut supplement = ChunkSupplement {
|
let mut supplement = ChunkSupplement {
|
||||||
entities: if rand::thread_rng().gen::<f32>() < SPAWN_RATE
|
entities: if rand::thread_rng().gen::<f32>() < SPAWN_RATE
|
||||||
&& sim_chunk.chaos < 0.5
|
&& sim_chunk.chaos < 0.5
|
||||||
&& !sim_chunk.is_underwater
|
&& !sim_chunk.is_underwater()
|
||||||
{
|
{
|
||||||
vec![EntityInfo {
|
vec![EntityInfo {
|
||||||
pos: gen_entity_pos(),
|
pos: gen_entity_pos(),
|
||||||
|
@ -1475,7 +1475,7 @@ impl WorldSim {
|
|||||||
|
|
||||||
let new_chunk = this.get(downhill_pos)?;
|
let new_chunk = this.get(downhill_pos)?;
|
||||||
const SLIDE_THRESHOLD: f32 = 5.0;
|
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;
|
break;
|
||||||
} else {
|
} else {
|
||||||
chunk = new_chunk;
|
chunk = new_chunk;
|
||||||
@ -1720,7 +1720,6 @@ pub struct SimChunk {
|
|||||||
pub spawn_rate: f32,
|
pub spawn_rate: f32,
|
||||||
pub location: Option<LocationInfo>,
|
pub location: Option<LocationInfo>,
|
||||||
pub river: RiverData,
|
pub river: RiverData,
|
||||||
pub is_underwater: bool,
|
|
||||||
|
|
||||||
pub structures: Structures,
|
pub structures: Structures,
|
||||||
pub contains_waypoint: bool,
|
pub contains_waypoint: bool,
|
||||||
@ -1898,7 +1897,6 @@ impl SimChunk {
|
|||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
},
|
},
|
||||||
is_underwater,
|
|
||||||
is_cliffs: cliff > 0.5 && !is_underwater,
|
is_cliffs: cliff > 0.5 && !is_underwater,
|
||||||
near_cliffs: cliff > 0.2,
|
near_cliffs: cliff > 0.2,
|
||||||
tree_density,
|
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 {
|
pub fn get_base_z(&self) -> f32 {
|
||||||
self.alt - self.chaos * 50.0 - 16.0
|
self.alt - self.chaos * 50.0 - 16.0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user