More voice kinds, more opportunities for sounds

This commit is contained in:
Joshua Barretto 2021-06-16 13:49:43 +01:00
parent fb51fd3230
commit e3c44ba7fe
6 changed files with 58 additions and 6 deletions

View File

@ -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,
),
}
)

BIN
assets/voxygen/audio/sfx/utterance/bird_angry.ogg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -102,6 +102,7 @@ pub enum UtteranceKind {
Angry,
Surprised,
Hurt,
Greeting,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]

View File

@ -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::<f32>() < 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 (

View File

@ -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!(

View File

@ -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,
}
}