mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Prevent NPCs from spawnign underwater
This should be set until there are underwater NPC types.
This commit is contained in:
parent
2710e6133d
commit
5b65b16594
@ -148,7 +148,10 @@ impl World {
|
|||||||
const SPAWN_RATE: f32 = 0.1;
|
const SPAWN_RATE: f32 = 0.1;
|
||||||
const BOSS_RATE: f32 = 0.03;
|
const BOSS_RATE: f32 = 0.03;
|
||||||
let supplement = ChunkSupplement {
|
let supplement = ChunkSupplement {
|
||||||
npcs: if rand::thread_rng().gen::<f32>() < SPAWN_RATE && sim_chunk.chaos < 0.5 {
|
npcs: if rand::thread_rng().gen::<f32>() < SPAWN_RATE
|
||||||
|
&& sim_chunk.chaos < 0.5
|
||||||
|
&& !sim_chunk.is_underwater
|
||||||
|
{
|
||||||
vec![NpcInfo {
|
vec![NpcInfo {
|
||||||
pos: gen_entity_pos(),
|
pos: gen_entity_pos(),
|
||||||
boss: rand::thread_rng().gen::<f32>() < BOSS_RATE,
|
boss: rand::thread_rng().gen::<f32>() < BOSS_RATE,
|
||||||
|
@ -970,6 +970,7 @@ 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,
|
||||||
}
|
}
|
||||||
@ -1146,6 +1147,7 @@ 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,
|
||||||
|
Loading…
Reference in New Issue
Block a user