From a757bf3dbda41249209b3cd6e537b9001371e505 Mon Sep 17 00:00:00 2001 From: DaforLynx Date: Wed, 30 Jun 2021 11:43:00 +0000 Subject: [PATCH] Sfx fixes and new test --- assets/voxygen/audio/sfx.ron | 136 +++++++++++++----- .../audio/sfx/inventory/consumable/apple.ogg | 4 +- .../audio/sfx/inventory/consumable/food.ogg | 4 +- .../audio/sfx/inventory/consumable/liquid.ogg | 4 +- common/src/comp/inventory/mod.rs | 7 +- server/src/events/inventory_manip.rs | 4 +- voxygen/src/audio/sfx/mod.rs | 16 ++- 7 files changed, 120 insertions(+), 55 deletions(-) diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron index 9a794c203a..bdec10a231 100644 --- a/assets/voxygen/audio/sfx.ron +++ b/assets/voxygen/audio/sfx.ron @@ -584,37 +584,19 @@ // // Consumables // - Inventory(Consumed("Potion")): ( + Inventory(Consumed("Minor Potion")): ( files: [ "voxygen.audio.sfx.inventory.consumable.liquid", ], threshold: 0.3, ), - Inventory(Consumed("PotionMinor")): ( + Inventory(Consumed("Medium Potion")): ( files: [ "voxygen.audio.sfx.inventory.consumable.liquid", ], threshold: 0.3, ), - Inventory(Consumed("PotionMed")): ( - files: [ - "voxygen.audio.sfx.inventory.consumable.liquid", - ], - threshold: 0.3, - ), - Inventory(Consumed("PotionLarge")): ( - files: [ - "voxygen.audio.sfx.inventory.consumable.liquid", - ], - threshold: 0.3, - ), - Inventory(Consumed("PotionExp")): ( - files: [ - "voxygen.audio.sfx.inventory.consumable.liquid", - ], - threshold: 0.3, - ), - Inventory(Consumed("SunflowerTea")): ( + Inventory(Consumed("Large Potion")): ( files: [ "voxygen.audio.sfx.inventory.consumable.liquid", ], @@ -632,19 +614,25 @@ ], threshold: 0.3, ), - Inventory(Consumed("Cheese")): ( + Inventory(Consumed("Dwarven Cheese")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], threshold: 0.3, ), - Inventory(Consumed("AppleShroomCurry")): ( + Inventory(Consumed("Sunflower Ice Tea")): ( files: [ - "voxygen.audio.sfx.inventory.consumable.food", + "voxygen.audio.sfx.inventory.consumable.liquid", ], threshold: 0.3, ), - Inventory(Consumed("AppleStick")): ( + Inventory(Consumed("Mushroom Curry")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.liquid", + ], + threshold: 0.3, + ), + Inventory(Consumed("Apple Stick")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], @@ -656,7 +644,7 @@ ], threshold: 0.3, ), - Inventory(Consumed("MushroomStick")): ( + Inventory(Consumed("Mushroom Stick")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], @@ -668,12 +656,6 @@ ], threshold: 0.3, ), - Inventory(Consumed("Fish")): ( - files: [ - "voxygen.audio.sfx.inventory.consumable.food", - ], - threshold: 0.3, - ), Inventory(Consumed("Carrot")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", @@ -686,30 +668,100 @@ ], threshold: 0.3, ), - Inventory(Consumed("PlainSalad")): ( + Inventory(Consumed("Plain Salad")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], threshold: 0.3, ), - Inventory(Consumed("TomatoSalad")): ( + Inventory(Consumed("Tomato Salad")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], threshold: 0.3, ), - Inventory(Consumed("Velorite")): ( + Inventory(Consumed("Cactus Colada")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.liquid", + ], + threshold: 0.3, + ), + Inventory(Consumed("Raw Bird Meat")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], threshold: 0.3, ), - Inventory(Consumed("VeloriteFrag")): ( + Inventory(Consumed("Cooked Bird Meat")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], threshold: 0.3, ), + Inventory(Consumed("Raw Fish")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Cooked Fish")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Raw Meat Slab")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Cooked Meat Slab")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Raw Meat Sliver")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Cooked Meat Sliver")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Raw Tough Meat")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Cooked Tough Meat")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Huge Raw Drumstick")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + Inventory(Consumed("Huge Cooked Drumstick")): ( + files: [ + "voxygen.audio.sfx.inventory.consumable.food", + ], + threshold: 0.3, + ), + + // + //Combat + // Explosion: ( files: [ "voxygen.audio.sfx.abilities.explosion", @@ -947,7 +999,7 @@ ), Utterance(Hurt, Antelope): ( files: [ - "voxygen.audio.sfx.utterance.antelope", + "voxygen.audio.sfx.utterance.antelope_hurt1", ], threshold: 1.0, ), @@ -969,9 +1021,9 @@ ], threshold: 1.0, ), - Utterance(Hurt, Marlin): ( + Utterance(Hurt, Mandragora): ( files: [ - "voxygen.audio.sfx.utterance.marlin_hurt1", + "voxygen.audio.sfx.utterance.mandragora_hurt1", ], threshold: 1.0, ), @@ -981,6 +1033,12 @@ ], threshold: 1.0, ), + Utterance(Hurt, Marlin): ( + files: [ + "voxygen.audio.sfx.utterance.marlin_hurt1", + ], + threshold: 1.0, + ), Utterance(Hurt, Mindflayer): ( files: [ "voxygen.audio.sfx.utterance.mindflayer_hurt1", diff --git a/assets/voxygen/audio/sfx/inventory/consumable/apple.ogg b/assets/voxygen/audio/sfx/inventory/consumable/apple.ogg index 828ac48675..8cd7c406ae 100644 --- a/assets/voxygen/audio/sfx/inventory/consumable/apple.ogg +++ b/assets/voxygen/audio/sfx/inventory/consumable/apple.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:29fb83b2032f6f39028986594bceba79fb525777f873820e9205ed733a761cb6 -size 10407 +oid sha256:ddd62b70ef7b6f74bf3a7336b4888e295257593c0d3f6f3afa768d55b42fed1a +size 10341 diff --git a/assets/voxygen/audio/sfx/inventory/consumable/food.ogg b/assets/voxygen/audio/sfx/inventory/consumable/food.ogg index 785ea90f3c..274b73228e 100644 --- a/assets/voxygen/audio/sfx/inventory/consumable/food.ogg +++ b/assets/voxygen/audio/sfx/inventory/consumable/food.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aadeb9283d30ac59a6ce89c16774047cb991a3f9c3835dbb3786f584258bdde6 -size 9559 +oid sha256:f4747a7530f384f2ed4df0890278dc04ce3fbdd48d2f4481ad46a9021f9b6790 +size 9404 diff --git a/assets/voxygen/audio/sfx/inventory/consumable/liquid.ogg b/assets/voxygen/audio/sfx/inventory/consumable/liquid.ogg index 554578a84b..9abd93124d 100644 --- a/assets/voxygen/audio/sfx/inventory/consumable/liquid.ogg +++ b/assets/voxygen/audio/sfx/inventory/consumable/liquid.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:60a90bb7431cacd6505a6908bd81e62ddc21ae3f8ed9df479f9869fae182846a -size 6937 +oid sha256:5fa0891c46f10bb81ffc6c4d31c84914dd4906e6b5809b16741ce0fc0e084c61 +size 7039 diff --git a/common/src/comp/inventory/mod.rs b/common/src/comp/inventory/mod.rs index 772b3cd9ce..7152f130a2 100644 --- a/common/src/comp/inventory/mod.rs +++ b/common/src/comp/inventory/mod.rs @@ -9,10 +9,7 @@ use vek::Vec3; use crate::{ comp::{ inventory::{ - item::{ - tool::AbilityMap, ConsumableKind, ItemDef, ItemKind, MaterialStatManifest, - TagExampleInfo, - }, + item::{tool::AbilityMap, ItemDef, ItemKind, MaterialStatManifest, TagExampleInfo}, loadout::Loadout, slot::{EquipSlot, Slot, SlotError}, }, @@ -806,7 +803,7 @@ impl Component for Inventory { pub enum InventoryUpdateEvent { Init, Used, - Consumed(ConsumableKind), + Consumed(String), Gave, Given, Swapped, diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index ffb5e484f5..c2243e9395 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -285,9 +285,9 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv &state.ecs().read_resource::(), ) { match item.kind() { - ItemKind::Consumable { kind, effect, .. } => { + ItemKind::Consumable { effect, .. } => { maybe_effect = Some(effect.clone()); - Some(comp::InventoryUpdateEvent::Consumed(*kind)) + Some(comp::InventoryUpdateEvent::Consumed(item.name().to_owned())) }, ItemKind::Throwable { kind, .. } => { if let Some(pos) = diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index 6518da74fc..dfe9c32324 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -92,7 +92,7 @@ use common::{ assets::{self, AssetExt, AssetHandle}, comp::{ beam, biped_large, biped_small, humanoid, - item::{ConsumableKind, ItemKind, ToolKind}, + item::{ItemKind, ToolKind}, object, poise::PoiseState, quadruped_low, quadruped_medium, quadruped_small, Body, CharacterAbilityType, @@ -210,6 +210,7 @@ pub enum VoiceKind { Saurok, Cat, Goat, + Mandragora, } fn body_to_voice(body: &Body) -> Option { @@ -254,6 +255,7 @@ fn body_to_voice(body: &Body) -> Option { Body::BirdMedium(_) | Body::BirdLarge(_) => VoiceKind::Bird, Body::BipedSmall(body) => match body.species { biped_small::Species::Adlet => VoiceKind::Adlet, + biped_small::Species::Mandragora => VoiceKind::Mandragora, _ => return None, }, Body::BipedLarge(body) => match body.species { @@ -276,7 +278,7 @@ pub enum SfxInventoryEvent { CollectedTool(ToolKind), CollectedItem(String), CollectFailed, - Consumed(ConsumableKind), + Consumed(String), Debug, Dropped, Given, @@ -308,7 +310,7 @@ impl From<&InventoryUpdateEvent> for SfxEvent { SfxEvent::Inventory(SfxInventoryEvent::CollectFailed) }, InventoryUpdateEvent::Consumed(consumable) => { - SfxEvent::Inventory(SfxInventoryEvent::Consumed(*consumable)) + SfxEvent::Inventory(SfxInventoryEvent::Consumed(consumable.clone())) }, InventoryUpdateEvent::Debug => SfxEvent::Inventory(SfxInventoryEvent::Debug), InventoryUpdateEvent::Dropped => SfxEvent::Inventory(SfxInventoryEvent::Dropped), @@ -579,3 +581,11 @@ impl assets::Asset for SfxTriggers { const EXTENSION: &'static str = "ron"; } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_load_sfx_triggers() { let _ = SfxTriggers::load_expect("voxygen.audio.sfx"); } +}