From e3c44ba7fe4716622106d59cc991c2f8415d3d13 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Wed, 16 Jun 2021 13:49:43 +0100 Subject: [PATCH] More voice kinds, more opportunities for sounds --- assets/voxygen/audio/sfx.ron | 8 +++- .../audio/sfx/utterance/bird_angry.ogg | 3 ++ common/src/comp/controller.rs | 1 + server/src/sys/agent.rs | 6 +++ voxygen/src/audio/mod.rs | 4 +- voxygen/src/audio/sfx/mod.rs | 42 +++++++++++++++++-- 6 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 assets/voxygen/audio/sfx/utterance/bird_angry.ogg diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron index cecb6f25d0..b4f3a0f5e8 100644 --- a/assets/voxygen/audio/sfx.ron +++ b/assets/voxygen/audio/sfx.ron @@ -844,11 +844,17 @@ ], threshold: 4.0, ), - Utterance(Angry, Saurok): ( + Utterance(Angry, Reptile): ( files: [ "voxygen.audio.sfx.utterance.saurok_angry", ], threshold: 4.0, ), + Utterance(Angry, Bird): ( + files: [ + "voxygen.audio.sfx.utterance.bird_angry", + ], + threshold: 4.0, + ), } ) diff --git a/assets/voxygen/audio/sfx/utterance/bird_angry.ogg b/assets/voxygen/audio/sfx/utterance/bird_angry.ogg new file mode 100644 index 0000000000..bd0c9a7e77 --- /dev/null +++ b/assets/voxygen/audio/sfx/utterance/bird_angry.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e028570750b872652dc16dff1dd4cafe34ad568bc079bd8ba379a5ceac66942 +size 11508 diff --git a/common/src/comp/controller.rs b/common/src/comp/controller.rs index fafd138da2..c27a4c1c50 100644 --- a/common/src/comp/controller.rs +++ b/common/src/comp/controller.rs @@ -102,6 +102,7 @@ pub enum UtteranceKind { Angry, Surprised, Hurt, + Greeting, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index b0b3d88e34..dd77610f29 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -945,6 +945,10 @@ impl<'a> AgentData<'a> { controller.actions.push(ControlAction::Unwield); } + if thread_rng().gen_bool(0.001) { + controller.push_event(ControlEvent::Utterance(UtteranceKind::Calm)); + } + // Sit if thread_rng().gen::() < 0.0035 { controller.actions.push(ControlAction::Sit); @@ -990,6 +994,8 @@ impl<'a> AgentData<'a> { if self.look_toward(controller, read_data, &target) { controller.actions.push(ControlAction::Stand); controller.actions.push(ControlAction::Talk); + controller.push_event(ControlEvent::Utterance(UtteranceKind::Greeting)); + match subject { Subject::Regular => { if let ( diff --git a/voxygen/src/audio/mod.rs b/voxygen/src/audio/mod.rs index d6811f77ab..c0fb8dc175 100644 --- a/voxygen/src/audio/mod.rs +++ b/voxygen/src/audio/mod.rs @@ -209,7 +209,7 @@ impl AudioFrontend { // TODO: Should this take `underwater` into consideration? match self.play_sfx(sfx_file, self.listener.pos, None, false) { Ok(_) => {}, - Err(e) => warn!("Failed to play sfx. {}", e), + Err(e) => warn!("Failed to play sfx '{:?}'. {}", sfx_file, e), } } else { debug!("Missing sfx trigger config for external sfx event.",); @@ -244,7 +244,7 @@ impl AudioFrontend { match self.play_sfx(sfx_file, position, volume, underwater) { Ok(_) => {}, - Err(e) => warn!("Failed to play sfx. {}", e), + Err(e) => warn!("Failed to play sfx '{:?}'. {}", sfx_file, e), } } else { debug!( diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index 782825d0a4..c4a0905337 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -95,7 +95,8 @@ use common::{ item::{ItemKind, ToolKind}, object, poise::PoiseState, - Body, CharacterAbilityType, InventoryUpdateEvent, UtteranceKind, + quadruped_medium, quadruped_small, Body, CharacterAbilityType, InventoryUpdateEvent, + UtteranceKind, }, outcome::Outcome, terrain::{BlockKind, TerrainChunk}, @@ -191,18 +192,53 @@ pub enum VoiceKind { Human, BipedLarge, Wendigo, - Saurok, + Reptile, + Bird, + Critter, + Sheep, + Pig, + Cow, + Canine, + BigCat, } fn body_to_voice(body: &Body) -> VoiceKind { match body { + Body::Humanoid(_) => VoiceKind::Human, + Body::QuadrupedSmall(body) => match body.species { + quadruped_small::Species::Sheep => VoiceKind::Sheep, + quadruped_small::Species::Pig | quadruped_small::Species::Boar => VoiceKind::Pig, + _ => VoiceKind::Critter, + }, + Body::QuadrupedMedium(body) => match body.species { + quadruped_medium::Species::Saber + | quadruped_medium::Species::Tiger + | quadruped_medium::Species::Lion + | quadruped_medium::Species::Frostfang + | quadruped_medium::Species::Snowleopard => VoiceKind::BigCat, + quadruped_medium::Species::Wolf + | quadruped_medium::Species::Roshwalr + | quadruped_medium::Species::Tarasque + | quadruped_medium::Species::Darkhound + | quadruped_medium::Species::Bonerattler + | quadruped_medium::Species::Grolgar => VoiceKind::Canine, + quadruped_medium::Species::Cattle + | quadruped_medium::Species::Catoblepas + | quadruped_medium::Species::Highland + | quadruped_medium::Species::Yak + | quadruped_medium::Species::Moose + | quadruped_medium::Species::Dreadhorn => VoiceKind::Cow, + _ => VoiceKind::Mute, + }, + Body::BirdMedium(_) | Body::BirdLarge(_) => VoiceKind::Bird, Body::BipedLarge(body) => match body.species { biped_large::Species::Wendigo => VoiceKind::Wendigo, biped_large::Species::Occultsaurok | biped_large::Species::Mightysaurok - | biped_large::Species::Slysaurok => VoiceKind::Saurok, + | biped_large::Species::Slysaurok => VoiceKind::Reptile, _ => VoiceKind::BipedLarge, }, + Body::Theropod(_) | Body::Dragon(_) => VoiceKind::Reptile, _ => VoiceKind::Mute, } }