Prevent NPCs from spawnign underwater

This should be set until there are underwater NPC types.
This commit is contained in:
S Handley 2020-01-08 12:48:00 +00:00 committed by Acrimon
parent 2710e6133d
commit 5b65b16594
2 changed files with 6 additions and 1 deletions

View File

@ -148,7 +148,10 @@ impl World {
const SPAWN_RATE: f32 = 0.1;
const BOSS_RATE: f32 = 0.03;
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 {
pos: gen_entity_pos(),
boss: rand::thread_rng().gen::<f32>() < BOSS_RATE,

View File

@ -970,6 +970,7 @@ pub struct SimChunk {
pub spawn_rate: f32,
pub location: Option<LocationInfo>,
pub river: RiverData,
pub is_underwater: bool,
pub structures: Structures,
}
@ -1146,6 +1147,7 @@ impl SimChunk {
} else {
0.0
},
is_underwater,
is_cliffs: cliff > 0.5 && !is_underwater,
near_cliffs: cliff > 0.2,
tree_density,