River water sfx

This commit is contained in:
jiminycrick 2020-11-05 15:12:38 -08:00
parent 8f5a22671d
commit 09a1974974
7 changed files with 29 additions and 5 deletions

View File

@ -46,6 +46,12 @@
],
threshold: 15.0,
),
RunningWater: (
files: [
"voxygen.audio.sfx.ambient.running_water_1",
],
threshold: 7.0,
),
//
// Character States
//

BIN
assets/voxygen/audio/sfx/ambient/running_water_1.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -71,6 +71,7 @@ pub struct TerrainChunkMeta {
//warp_factor: f32,
surface_veg: f32,
cave_alt: f32,
contains_river: bool,
/*place: Option<Id<Place>>, */
/*path: (Way, Path),*/
@ -89,6 +90,7 @@ impl TerrainChunkMeta {
tree_density: f32,
surface_veg: f32,
cave_alt: f32,
contains_river: bool,
) -> Self {
Self {
name,
@ -101,6 +103,7 @@ impl TerrainChunkMeta {
tree_density,
surface_veg,
cave_alt,
contains_river,
}
}
@ -116,6 +119,7 @@ impl TerrainChunkMeta {
tree_density: 0.0,
surface_veg: 0.0,
cave_alt: 0.0,
contains_river: false,
}
}
@ -138,6 +142,8 @@ impl TerrainChunkMeta {
pub fn surface_veg(&self) -> f32 { self.surface_veg }
pub fn cave_alt(&self) -> f32 { self.cave_alt }
pub fn contains_river(&self) -> bool { self.contains_river }
}
// Terrain type aliases

View File

@ -86,6 +86,13 @@ impl EventMapper for BlockEventMapper {
volume: 1.0,
cond: |st| st.get_day_period().is_dark(),
},
BlockSounds {
blocks: |boi| &boi.river,
range: 1,
sfx: SfxEvent::RunningWater,
volume: 1.0,
cond: |_| true,
},
//BlockSounds {
// blocks: |boi| &boi.embers,
// range: 1,

View File

@ -142,6 +142,7 @@ pub enum SfxEvent {
Cricket,
Frog,
Bees,
RunningWater,
Idle,
Swim,
Run,

View File

@ -9,7 +9,7 @@ use vek::*;
pub struct BlocksOfInterest {
pub leaves: Vec<Vec3<i32>>,
pub grass: Vec<Vec3<i32>>,
pub water: Vec<Vec3<i32>>,
pub river: Vec<Vec3<i32>>,
pub embers: Vec<Vec3<i32>>,
pub beehives: Vec<Vec3<i32>>,
pub reeds: Vec<Vec3<i32>>,
@ -24,7 +24,7 @@ impl BlocksOfInterest {
span!(_guard, "from_chunk", "BlocksOfInterest::from_chunk");
let mut leaves = Vec::new();
let mut grass = Vec::new();
let mut water = Vec::new();
let mut river = Vec::new();
let mut embers = Vec::new();
let mut beehives = Vec::new();
let mut reeds = Vec::new();
@ -53,8 +53,8 @@ impl BlocksOfInterest {
}
},
BlockKind::Water => {
if thread_rng().gen_range(0, 16) == 0 {
water.push(pos)
if chunk.meta().contains_river() && thread_rng().gen_range(0, 16) == 0 {
river.push(pos)
}
},
_ => match block.get_sprite() {
@ -78,7 +78,7 @@ impl BlocksOfInterest {
Self {
leaves,
grass,
water,
river,
embers,
beehives,
reeds,

View File

@ -166,6 +166,7 @@ impl World {
sim_chunk.tree_density,
sim_chunk.surface_veg,
sim_chunk.cave.1.alt,
sim_chunk.river.is_river(),
);
let mut chunk = TerrainChunk::new(base_z, stone, air, meta);