Merge branch 'DaforLynx/louder-rivers' into 'master'

Loud rivers

See merge request veloren/veloren!3254
This commit is contained in:
Justin Shipsey 2022-03-13 07:47:23 +00:00
commit 8072c9db3b
30 changed files with 136 additions and 10 deletions

View File

@ -53,7 +53,7 @@
], ],
threshold: 15.0, threshold: 15.0,
), ),
RunningWater: ( RunningWaterSlow: (
files: [ files: [
"voxygen.audio.sfx.ambient.river_sounds.running_water-001", "voxygen.audio.sfx.ambient.river_sounds.running_water-001",
"voxygen.audio.sfx.ambient.river_sounds.running_water-002", "voxygen.audio.sfx.ambient.river_sounds.running_water-002",
@ -85,6 +85,35 @@
], ],
threshold: 7.0, threshold: 7.0,
), ),
RunningWaterFast: (
files: [
"voxygen.audio.sfx.ambient.river_sounds.fast_water-001",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-002",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-003",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-004",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-005",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-006",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-007",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-008",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-009",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-010",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-011",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-012",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-013",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-014",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-015",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-016",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-017",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-018",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-019",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-020",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-021",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-022",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-023",
"voxygen.audio.sfx.ambient.river_sounds.fast_water-024",
],
threshold: 5.0,
),
// //
// Character States // Character States
// //

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -86,6 +86,7 @@ pub struct TerrainChunkMeta {
tree_density: f32, tree_density: f32,
contains_cave: bool, contains_cave: bool,
contains_river: bool, contains_river: bool,
river_velocity: Vec3<f32>,
temp: f32, temp: f32,
contains_settlement: bool, contains_settlement: bool,
contains_dungeon: bool, contains_dungeon: bool,
@ -99,6 +100,7 @@ impl TerrainChunkMeta {
tree_density: f32, tree_density: f32,
contains_cave: bool, contains_cave: bool,
contains_river: bool, contains_river: bool,
river_velocity: Vec3<f32>,
temp: f32, temp: f32,
contains_settlement: bool, contains_settlement: bool,
contains_dungeon: bool, contains_dungeon: bool,
@ -110,6 +112,7 @@ impl TerrainChunkMeta {
tree_density, tree_density,
contains_cave, contains_cave,
contains_river, contains_river,
river_velocity,
temp, temp,
contains_settlement, contains_settlement,
contains_dungeon, contains_dungeon,
@ -124,6 +127,7 @@ impl TerrainChunkMeta {
tree_density: 0.0, tree_density: 0.0,
contains_cave: false, contains_cave: false,
contains_river: false, contains_river: false,
river_velocity: Vec3::zero(),
temp: 0.0, temp: 0.0,
contains_settlement: false, contains_settlement: false,
contains_dungeon: false, contains_dungeon: false,
@ -142,6 +146,8 @@ impl TerrainChunkMeta {
pub fn contains_river(&self) -> bool { self.contains_river } pub fn contains_river(&self) -> bool { self.contains_river }
pub fn river_velocity(&self) -> Vec3<f32> { self.river_velocity }
pub fn contains_settlement(&self) -> bool { self.contains_settlement } pub fn contains_settlement(&self) -> bool { self.contains_settlement }
pub fn contains_dungeon(&self) -> bool { self.contains_dungeon } pub fn contains_dungeon(&self) -> bool { self.contains_dungeon }

View File

@ -98,12 +98,19 @@ impl EventMapper for BlockEventMapper {
cond: |st| st.get_day_period().is_dark(), cond: |st| st.get_day_period().is_dark(),
}, },
BlockSounds { BlockSounds {
blocks: |boi| &boi.river, blocks: |boi| &boi.slow_river,
range: 1, range: 1,
sfx: SfxEvent::RunningWater, sfx: SfxEvent::RunningWaterSlow,
volume: 1.5, volume: 1.5,
cond: |_| true, cond: |_| true,
}, },
BlockSounds {
blocks: |boi| &boi.fast_river,
range: 1,
sfx: SfxEvent::RunningWaterFast,
volume: 2.5,
cond: |_| true,
},
//BlockSounds { //BlockSounds {
// blocks: |boi| &boi.embers, // blocks: |boi| &boi.embers,
// range: 1, // range: 1,
@ -188,7 +195,9 @@ impl EventMapper for BlockEventMapper {
Vec3::from(chunk_pos * TerrainChunk::RECT_SIZE.map(|e| e as i32)); Vec3::from(chunk_pos * TerrainChunk::RECT_SIZE.map(|e| e as i32));
// Replace all RunningWater blocks with just one random one per tick // Replace all RunningWater blocks with just one random one per tick
let blocks = if sounds.sfx == SfxEvent::RunningWater { let blocks = if sounds.sfx == SfxEvent::RunningWaterSlow
|| sounds.sfx == SfxEvent::RunningWaterFast
{
blocks blocks
.choose(&mut thread_rng()) .choose(&mut thread_rng())
.map(std::slice::from_ref) .map(std::slice::from_ref)
@ -205,7 +214,8 @@ impl EventMapper for BlockEventMapper {
if ((sounds.sfx == SfxEvent::Birdcall || sounds.sfx == SfxEvent::Owl) if ((sounds.sfx == SfxEvent::Birdcall || sounds.sfx == SfxEvent::Owl)
&& thread_rng().gen_bool(0.999)) && thread_rng().gen_bool(0.999))
|| (sounds.sfx == SfxEvent::Frog && thread_rng().gen_bool(0.75)) || (sounds.sfx == SfxEvent::Frog && thread_rng().gen_bool(0.75))
|| (sounds.sfx == SfxEvent::RunningWater && thread_rng().gen_bool(0.5)) || (sounds.sfx == SfxEvent::RunningWaterSlow
&& thread_rng().gen_bool(0.5))
{ {
continue; continue;
} }

View File

@ -150,7 +150,8 @@ pub enum SfxEvent {
Cricket3, Cricket3,
Frog, Frog,
Bees, Bees,
RunningWater, RunningWaterSlow,
RunningWaterFast,
Idle, Idle,
Swim, Swim,
Run(BlockKind), Run(BlockKind),

View File

@ -17,7 +17,8 @@ pub struct BlocksOfInterest {
pub leaves: Vec<Vec3<i32>>, pub leaves: Vec<Vec3<i32>>,
pub drip: Vec<Vec3<i32>>, pub drip: Vec<Vec3<i32>>,
pub grass: Vec<Vec3<i32>>, pub grass: Vec<Vec3<i32>>,
pub river: Vec<Vec3<i32>>, pub slow_river: Vec<Vec3<i32>>,
pub fast_river: Vec<Vec3<i32>>,
pub fires: Vec<Vec3<i32>>, pub fires: Vec<Vec3<i32>>,
pub smokers: Vec<Vec3<i32>>, pub smokers: Vec<Vec3<i32>>,
pub beehives: Vec<Vec3<i32>>, pub beehives: Vec<Vec3<i32>>,
@ -43,7 +44,8 @@ impl BlocksOfInterest {
let mut leaves = Vec::new(); let mut leaves = Vec::new();
let mut drip = Vec::new(); let mut drip = Vec::new();
let mut grass = Vec::new(); let mut grass = Vec::new();
let mut river = Vec::new(); let mut slow_river = Vec::new();
let mut fast_river = Vec::new();
let mut fires = Vec::new(); let mut fires = Vec::new();
let mut smokers = Vec::new(); let mut smokers = Vec::new();
let mut beehives = Vec::new(); let mut beehives = Vec::new();
@ -61,6 +63,8 @@ impl BlocksOfInterest {
let mut rng = ChaCha8Rng::from_seed(thread_rng().gen()); let mut rng = ChaCha8Rng::from_seed(thread_rng().gen());
let river_speed_sq = chunk.meta().river_velocity().magnitude_squared();
chunk.iter_changed().for_each(|(pos, block)| { chunk.iter_changed().for_each(|(pos, block)| {
match block.kind() { match block.kind() {
BlockKind::Leaves if rng.gen_range(0..16) == 0 => leaves.push(pos), BlockKind::Leaves if rng.gen_range(0..16) == 0 => leaves.push(pos),
@ -76,7 +80,9 @@ impl BlocksOfInterest {
_ => {}, _ => {},
} }
}, },
BlockKind::Water if chunk.meta().contains_river() => river.push(pos), // Assign a river speed to water blocks depending on river velocity
BlockKind::Water if river_speed_sq > 0.9_f32.powi(2) => fast_river.push(pos),
BlockKind::Water if river_speed_sq > 0.3_f32.powi(2) => slow_river.push(pos),
BlockKind::Snow if rng.gen_range(0..16) == 0 => snow.push(pos), BlockKind::Snow if rng.gen_range(0..16) == 0 => snow.push(pos),
BlockKind::Lava if rng.gen_range(0..5) == 0 => fires.push(pos + Vec3::unit_z()), BlockKind::Lava if rng.gen_range(0..5) == 0 => fires.push(pos + Vec3::unit_z()),
BlockKind::Snow | BlockKind::Ice if rng.gen_range(0..16) == 0 => snow.push(pos), BlockKind::Snow | BlockKind::Ice if rng.gen_range(0..16) == 0 => snow.push(pos),
@ -153,7 +159,8 @@ impl BlocksOfInterest {
leaves, leaves,
drip, drip,
grass, grass,
river, slow_river,
fast_river,
fires, fires,
smokers, smokers,
beehives, beehives,

View File

@ -291,6 +291,7 @@ impl World {
sim_chunk.tree_density, sim_chunk.tree_density,
sim_chunk.cave.1.alt != 0.0, sim_chunk.cave.1.alt != 0.0,
sim_chunk.river.is_river(), sim_chunk.river.is_river(),
sim_chunk.river.velocity,
sim_chunk.temp, sim_chunk.temp,
sim_chunk sim_chunk
.sites .sites