Added more cow noises, prepare for merge

This commit is contained in:
Joshua Barretto 2021-06-16 17:16:05 +01:00
parent 9510869870
commit b8749dc219
11 changed files with 108 additions and 79 deletions

View File

@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Added a skill tree for mining, which gains xp from mining ores and gems. - Added a skill tree for mining, which gains xp from mining ores and gems.
- Added debug line info to release builds, enhancing the usefulness of panic backtraces - Added debug line info to release builds, enhancing the usefulness of panic backtraces
- NPCs and animals can now make sounds in response to certain events
- Players can press H to greet others
### Changed ### Changed
- Entity-entity pushback is no longer applied in forced movement states like rolling and leaping. - Entity-entity pushback is no longer applied in forced movement states like rolling and leaping.
@ -18,7 +20,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed ### Removed
### Fixed ### Fixed
- Cases where no audio output could be produced before. - Cases where no audio output could be produced before.
- Significantly improved the performance of playing sound effects
## [0.10.0] - 2021-06-12 ## [0.10.0] - 2021-06-12

View File

@ -835,50 +835,52 @@
files: [ files: [
"voxygen.audio.sfx.utterance.wendigo_angry", "voxygen.audio.sfx.utterance.wendigo_angry",
], ],
threshold: 4.0, threshold: 0.2,
), ),
Utterance(Angry, BipedLarge): ( Utterance(Angry, BipedLarge): (
files: [ files: [
"voxygen.audio.sfx.utterance.ogre_angry", "voxygen.audio.sfx.utterance.ogre_angry",
"voxygen.audio.sfx.utterance.ogre_angry2", "voxygen.audio.sfx.utterance.ogre_angry2",
], ],
threshold: 4.0, threshold: 0.2,
), ),
Utterance(Angry, Reptile): ( Utterance(Angry, Reptile): (
files: [ files: [
"voxygen.audio.sfx.utterance.saurok_angry", "voxygen.audio.sfx.utterance.saurok_angry",
], ],
threshold: 4.0, threshold: 0.2,
), ),
Utterance(Angry, Bird): ( Utterance(Angry, Bird): (
files: [ files: [
"voxygen.audio.sfx.utterance.bird_angry", "voxygen.audio.sfx.utterance.bird_angry",
], ],
threshold: 4.0, threshold: 0.2,
), ),
Utterance(Calm, Pig): ( Utterance(Calm, Pig): (
files: [ files: [
"voxygen.audio.sfx.utterance.pig_calm", "voxygen.audio.sfx.utterance.pig_calm",
], ],
threshold: 4.0, threshold: 0.2,
), ),
Utterance(Calm, Cow): ( Utterance(Calm, Cow): (
files: [ files: [
"voxygen.audio.sfx.utterance.cow_calm", "voxygen.audio.sfx.utterance.cow_calm",
"voxygen.audio.sfx.utterance.cow_calm2",
"voxygen.audio.sfx.utterance.cow_calm3",
], ],
threshold: 4.0, threshold: 0.2,
), ),
Utterance(Calm, Sheep): ( Utterance(Calm, Sheep): (
files: [ files: [
"voxygen.audio.sfx.utterance.sheep_calm", "voxygen.audio.sfx.utterance.sheep_calm",
], ],
threshold: 4.0, threshold: 0.2,
), ),
Utterance(Greeting, HumanMale): ( Utterance(Greeting, HumanMale): (
files: [ files: [
"voxygen.audio.sfx.utterance.humanmale_greeting", "voxygen.audio.sfx.utterance.humanmale_greeting",
], ],
threshold: 4.0, threshold: 0.2,
), ),
} }
) )

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

Binary file not shown.

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

Binary file not shown.

View File

@ -28,7 +28,7 @@ use common::{
skills::Skill, skills::Skill,
slot::Slot, slot::Slot,
ChatMode, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, InputKind, ChatMode, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, InputKind,
InventoryAction, InventoryEvent, InventoryUpdateEvent, InventoryAction, InventoryEvent, InventoryUpdateEvent, UtteranceKind,
}, },
event::{EventBus, LocalEvent}, event::{EventBus, LocalEvent},
grid::Grid, grid::Grid,
@ -1224,6 +1224,10 @@ impl Client {
} }
} }
pub fn utter(&mut self, kind: UtteranceKind) {
self.send_msg(ClientGeneral::ControlEvent(ControlEvent::Utterance(kind)));
}
pub fn toggle_sneak(&mut self) { pub fn toggle_sneak(&mut self) {
let is_sneaking = self let is_sneaking = self
.state .state

View File

@ -404,6 +404,7 @@ pub fn handle_sound(server: &mut Server, sound: &Sound) {
.inbox .inbox
.push_back(AgentEvent::ServerSound(propagated_sound)); .push_back(AgentEvent::ServerSound(propagated_sound));
} }
}
// Attempt to turn this sound into an outcome to be received by frontends. // Attempt to turn this sound into an outcome to be received by frontends.
if let Some(outcome) = match sound.kind { if let Some(outcome) = match sound.kind {
@ -416,5 +417,4 @@ pub fn handle_sound(server: &mut Server, sound: &Sound) {
} { } {
ecs.write_resource::<Vec<Outcome>>().push(outcome); ecs.write_resource::<Vec<Outcome>>().push(outcome);
} }
}
} }

View File

@ -106,7 +106,7 @@ use event_mapper::SfxEventMapper;
use hashbrown::HashMap; use hashbrown::HashMap;
use rand::prelude::*; use rand::prelude::*;
use serde::Deserialize; use serde::Deserialize;
use tracing::warn; use tracing::{debug, warn};
use vek::*; use vek::*;
/// We watch the states of nearby entities in order to emit SFX at their /// We watch the states of nearby entities in order to emit SFX at their
@ -186,9 +186,8 @@ pub enum SfxEvent {
Utterance(UtteranceKind, VoiceKind), Utterance(UtteranceKind, VoiceKind),
} }
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
pub enum VoiceKind { pub enum VoiceKind {
Mute,
HumanFemale, HumanFemale,
HumanMale, HumanMale,
BipedLarge, BipedLarge,
@ -203,8 +202,8 @@ pub enum VoiceKind {
BigCat, BigCat,
} }
fn body_to_voice(body: &Body) -> VoiceKind { fn body_to_voice(body: &Body) -> Option<VoiceKind> {
match body { Some(match body {
Body::Humanoid(body) => match &body.body_type { Body::Humanoid(body) => match &body.body_type {
humanoid::BodyType::Female => VoiceKind::HumanFemale, humanoid::BodyType::Female => VoiceKind::HumanFemale,
humanoid::BodyType::Male => VoiceKind::HumanMale, humanoid::BodyType::Male => VoiceKind::HumanMale,
@ -232,7 +231,7 @@ fn body_to_voice(body: &Body) -> VoiceKind {
| quadruped_medium::Species::Yak | quadruped_medium::Species::Yak
| quadruped_medium::Species::Moose | quadruped_medium::Species::Moose
| quadruped_medium::Species::Dreadhorn => VoiceKind::Cow, | quadruped_medium::Species::Dreadhorn => VoiceKind::Cow,
_ => VoiceKind::Mute, _ => return None,
}, },
Body::BirdMedium(_) | Body::BirdLarge(_) => VoiceKind::Bird, Body::BirdMedium(_) | Body::BirdLarge(_) => VoiceKind::Bird,
Body::BipedLarge(body) => match body.species { Body::BipedLarge(body) => match body.species {
@ -243,8 +242,8 @@ fn body_to_voice(body: &Body) -> VoiceKind {
_ => VoiceKind::BipedLarge, _ => VoiceKind::BipedLarge,
}, },
Body::Theropod(_) | Body::Dragon(_) => VoiceKind::Reptile, Body::Theropod(_) | Body::Dragon(_) => VoiceKind::Reptile,
_ => VoiceKind::Mute, _ => return None,
} })
} }
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)] #[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
@ -516,9 +515,18 @@ impl SfxMgr {
}, },
}, },
Outcome::Utterance { pos, kind, body } => { Outcome::Utterance { pos, kind, body } => {
if let Some(voice) = body_to_voice(body) {
let sfx_trigger_item = let sfx_trigger_item =
triggers.get_key_value(&SfxEvent::Utterance(*kind, body_to_voice(body))); triggers.get_key_value(&SfxEvent::Utterance(*kind, voice));
audio.emit_sfx(sfx_trigger_item, *pos, Some(2.5), false); if let Some(sfx_trigger_item) = sfx_trigger_item {
audio.emit_sfx(Some(sfx_trigger_item), *pos, Some(2.5), false);
} else {
debug!(
"No utterance sound effect exists for ({:?}, {:?})",
kind, voice
);
}
}
}, },
Outcome::ExpChange { .. } Outcome::ExpChange { .. }
| Outcome::ComboChange { .. } | Outcome::ComboChange { .. }

View File

@ -2,7 +2,7 @@
//! the need to decode files on each playback //! the need to decode files on each playback
use common::assets::{self, Loader}; use common::assets::{self, Loader};
use rodio::{source::Buffered, Decoder, Source}; use rodio::{source::Buffered, Decoder, Source};
use std::{borrow::Cow, io, sync::Arc}; use std::{borrow::Cow, io};
use tracing::warn; use tracing::warn;
// Implementation of sound taken from this github issue: // Implementation of sound taken from this github issue:
@ -13,10 +13,6 @@ pub struct SoundLoader;
#[derive(Clone)] #[derive(Clone)]
pub struct OggSound(Buffered<Decoder<io::Cursor<Vec<u8>>>>); pub struct OggSound(Buffered<Decoder<io::Cursor<Vec<u8>>>>);
// impl AsRef<[u8]> for OggSound {
// fn as_ref(&self) -> &[u8] { &self.0 }
// }
impl Loader<OggSound> for SoundLoader { impl Loader<OggSound> for SoundLoader {
fn load(content: Cow<[u8]>, _: &str) -> Result<OggSound, assets::BoxedError> { fn load(content: Cow<[u8]>, _: &str) -> Result<OggSound, assets::BoxedError> {
let source = Decoder::new(io::Cursor::new(content.into_owned()))?.buffered(); let source = Decoder::new(io::Cursor::new(content.into_owned()))?.buffered();

View File

@ -15,7 +15,7 @@ use common::{
inventory::slot::{EquipSlot, Slot}, inventory::slot::{EquipSlot, Slot},
invite::InviteKind, invite::InviteKind,
item::{tool::ToolKind, ItemDef, ItemDesc}, item::{tool::ToolKind, ItemDef, ItemDesc},
ChatMsg, ChatType, InputKind, InventoryUpdateEvent, Pos, Vel, ChatMsg, ChatType, InputKind, InventoryUpdateEvent, Pos, UtteranceKind, Vel,
}, },
consts::{MAX_MOUNT_RANGE, MAX_PICKUP_RANGE}, consts::{MAX_MOUNT_RANGE, MAX_PICKUP_RANGE},
outcome::Outcome, outcome::Outcome,
@ -525,6 +525,11 @@ impl PlayState for SessionState {
self.client.borrow_mut().toggle_dance(); self.client.borrow_mut().toggle_dance();
} }
}, },
GameInput::Greet => {
if state {
self.client.borrow_mut().utter(UtteranceKind::Greeting);
}
},
GameInput::Sneak => { GameInput::Sneak => {
if state { if state {
self.stop_auto_walk(); self.stop_auto_walk();

View File

@ -123,6 +123,7 @@ impl ControlSettings {
GameInput::Jump => KeyMouse::Key(VirtualKeyCode::Space), GameInput::Jump => KeyMouse::Key(VirtualKeyCode::Space),
GameInput::Sit => KeyMouse::Key(VirtualKeyCode::K), GameInput::Sit => KeyMouse::Key(VirtualKeyCode::K),
GameInput::Dance => KeyMouse::Key(VirtualKeyCode::J), GameInput::Dance => KeyMouse::Key(VirtualKeyCode::J),
GameInput::Greet => KeyMouse::Key(VirtualKeyCode::H),
GameInput::Glide => KeyMouse::Key(VirtualKeyCode::LShift), GameInput::Glide => KeyMouse::Key(VirtualKeyCode::LShift),
GameInput::Climb => KeyMouse::Key(VirtualKeyCode::Space), GameInput::Climb => KeyMouse::Key(VirtualKeyCode::Space),
GameInput::ClimbDown => KeyMouse::Key(VirtualKeyCode::LControl), GameInput::ClimbDown => KeyMouse::Key(VirtualKeyCode::LControl),

View File

@ -39,6 +39,7 @@ pub enum GameInput {
Jump, Jump,
Sit, Sit,
Dance, Dance,
Greet,
Glide, Glide,
Climb, Climb,
ClimbDown, ClimbDown,
@ -94,6 +95,7 @@ impl GameInput {
GameInput::Jump => "gameinput.jump", GameInput::Jump => "gameinput.jump",
GameInput::Sit => "gameinput.sit", GameInput::Sit => "gameinput.sit",
GameInput::Dance => "gameinput.dance", GameInput::Dance => "gameinput.dance",
GameInput::Greet => "gameinput.greet",
GameInput::Glide => "gameinput.glide", GameInput::Glide => "gameinput.glide",
GameInput::Climb => "gameinput.climb", GameInput::Climb => "gameinput.climb",
GameInput::ClimbDown => "gameinput.climbdown", GameInput::ClimbDown => "gameinput.climbdown",
@ -159,6 +161,7 @@ impl GameInput {
GameInput::Jump, GameInput::Jump,
GameInput::Sit, GameInput::Sit,
GameInput::Dance, GameInput::Dance,
GameInput::Greet,
GameInput::Glide, GameInput::Glide,
GameInput::Climb, GameInput::Climb,
GameInput::ClimbDown, GameInput::ClimbDown,