diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron index bbd864282e..5434e7818a 100644 --- a/assets/voxygen/audio/sfx.ron +++ b/assets/voxygen/audio/sfx.ron @@ -46,6 +46,12 @@ ], threshold: 15.0, ), + RunningWater: ( + files: [ + "voxygen.audio.sfx.ambient.running_water_1", + ], + threshold: 7.0, + ), // // Character States // diff --git a/assets/voxygen/audio/sfx/ambient/running_water_1.wav b/assets/voxygen/audio/sfx/ambient/running_water_1.wav new file mode 100644 index 0000000000..c72ff0a4d3 Binary files /dev/null and b/assets/voxygen/audio/sfx/ambient/running_water_1.wav differ diff --git a/common/src/terrain/mod.rs b/common/src/terrain/mod.rs index 0918f1c764..02d46020e6 100644 --- a/common/src/terrain/mod.rs +++ b/common/src/terrain/mod.rs @@ -71,6 +71,7 @@ pub struct TerrainChunkMeta { //warp_factor: f32, surface_veg: f32, cave_alt: f32, + contains_river: bool, /*place: Option>, */ /*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 diff --git a/voxygen/src/audio/sfx/event_mapper/block/mod.rs b/voxygen/src/audio/sfx/event_mapper/block/mod.rs index e4ceccd17e..8282892a41 100644 --- a/voxygen/src/audio/sfx/event_mapper/block/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/block/mod.rs @@ -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, diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index b7992d9bae..d4e56855bc 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -142,6 +142,7 @@ pub enum SfxEvent { Cricket, Frog, Bees, + RunningWater, Idle, Swim, Run, diff --git a/voxygen/src/scene/terrain/watcher.rs b/voxygen/src/scene/terrain/watcher.rs index 8645e14954..ca7ef1b4f9 100644 --- a/voxygen/src/scene/terrain/watcher.rs +++ b/voxygen/src/scene/terrain/watcher.rs @@ -9,7 +9,7 @@ use vek::*; pub struct BlocksOfInterest { pub leaves: Vec>, pub grass: Vec>, - pub water: Vec>, + pub river: Vec>, pub embers: Vec>, pub beehives: Vec>, pub reeds: Vec>, @@ -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, diff --git a/world/src/lib.rs b/world/src/lib.rs index 91e537e995..98455bc852 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -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);