Make sfx.ron use ItemKey

This commit is contained in:
juliancoffee 2024-01-10 18:47:20 +02:00
parent 9264fe77b1
commit 75013cc04a
4 changed files with 45 additions and 40 deletions

View File

@ -986,231 +986,231 @@
// //
// Consumables // Consumables
// //
Inventory(Consumed("Minor Potion")): ( Inventory(Consumed(Simple("common.items.consumable.potion_minor"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_potion", subtitle: "subtitle-consume_potion",
), ),
Inventory(Consumed("Medium Potion")): ( Inventory(Consumed(Simple("common.items.consumable.potion_med"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_potion", subtitle: "subtitle-consume_potion",
), ),
Inventory(Consumed("Large Potion")): ( Inventory(Consumed(Simple("common.items.consumable.potion_big"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_potion", subtitle: "subtitle-consume_potion",
), ),
Inventory(Consumed("Apple")): ( Inventory(Consumed(Simple("common.items.food.apple"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.apple", "voxygen.audio.sfx.inventory.consumable.apple",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_apple", subtitle: "subtitle-consume_apple",
), ),
Inventory(Consumed("Mushroom")): ( Inventory(Consumed(Simple("common.items.food.mushroom"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Dwarven Cheese")): ( Inventory(Consumed(Simple("common.items.food.cheese"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_cheese", subtitle: "subtitle-consume_cheese",
), ),
Inventory(Consumed("Sunflower Ice Tea")): ( Inventory(Consumed(Simple("common.items.food.sunflower_icetea"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_liquid", subtitle: "subtitle-consume_liquid",
), ),
Inventory(Consumed("Mushroom Curry")): ( Inventory(Consumed(Simple("common.items.food.apple_mushroom_curry"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Apple Stick")): ( Inventory(Consumed(Simple("common.items.food.apple_stick"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Coconut")): ( Inventory(Consumed(Simple("common.items.food.coconut"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Mushroom Stick")): ( Inventory(Consumed(Simple("common.items.food.mushroom_stick"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Tomato")): ( Inventory(Consumed(Simple("common.items.food.tomato"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Carrot")): ( Inventory(Consumed(Simple("common.items.food.carrot"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Lettuce")): ( Inventory(Consumed(Simple("common.items.food.lettuce"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Plain Salad")): ( Inventory(Consumed(Simple("common.items.food.plainsalad"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Tomato Salad")): ( Inventory(Consumed(Simple("common.items.food.tomatosalad"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Cactus Colada")): ( Inventory(Consumed(Simple("common.items.food.cactus_colada"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_liquid", subtitle: "subtitle-consume_liquid",
), ),
Inventory(Consumed("Raw Bird Meat")): ( Inventory(Consumed(Simple("common.items.food.meat.bird_raw"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Cooked Bird Meat")): ( Inventory(Consumed(Simple("common.items.food.meat.bird_cooked"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Raw Fish")): ( Inventory(Consumed(Simple("common.items.food.meat.fish_raw"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Cooked Fish")): ( Inventory(Consumed(Simple("common.items.food.meat.fish_cooked"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Raw Meat Slab")): ( Inventory(Consumed(Simple("common.items.food.meat.beast_large_raw"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Cooked Meat Slab")): ( Inventory(Consumed(Simple("common.items.food.meat.beast_large_cooked"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Raw Meat Sliver")): ( Inventory(Consumed(Simple("common.items.food.meat.beast_small_raw"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Cooked Meat Sliver")): ( Inventory(Consumed(Simple("common.items.food.meat.beast_small_cooked"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Raw Tough Meat")): ( Inventory(Consumed(Simple("common.items.food.meat.tough_raw"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Cooked Tough Meat")): ( Inventory(Consumed(Simple("common.items.food.meat.tough_cooked"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Huge Raw Drumstick")): ( Inventory(Consumed(Simple("common.items.food.meat.bird_large_raw"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Huge Cooked Drumstick")): ( Inventory(Consumed(Simple("common.items.food.meat.bird_large_cooked"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Honeycorn")): ( Inventory(Consumed(Simple("common.items.food.honeycorn"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_food", subtitle: "subtitle-consume_food",
), ),
Inventory(Consumed("Pumpkin Spice Brew")): ( Inventory(Consumed(Simple("common.items.food.pumpkin_spice_brew"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_liquid", subtitle: "subtitle-consume_liquid",
), ),
Inventory(Consumed("Blue Cheese")): ( Inventory(Consumed(Simple("common.items.food.blue_cheese"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
subtitle: "subtitle-consume_cheese", subtitle: "subtitle-consume_cheese",
), ),
Inventory(Consumed("Golden Cheese")): ( Inventory(Consumed(Simple("common.items.debug.golden_cheese"))): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],

View File

@ -11,8 +11,8 @@ use crate::{
body::Body, body::Body,
inventory::{ inventory::{
item::{ item::{
tool::AbilityMap, ItemDef, ItemDefinitionIdOwned, ItemKind, MaterialStatManifest, item_key::ItemKey, tool::AbilityMap, ItemDef, ItemDefinitionIdOwned, ItemKind,
TagExampleInfo, MaterialStatManifest, TagExampleInfo,
}, },
loadout::Loadout, loadout::Loadout,
slot::{EquipSlot, Slot, SlotError}, slot::{EquipSlot, Slot, SlotError},
@ -974,7 +974,7 @@ pub enum CollectFailedReason {
pub enum InventoryUpdateEvent { pub enum InventoryUpdateEvent {
Init, Init,
Used, Used,
Consumed(String), Consumed(ItemKey),
Gave, Gave,
Given, Given,
Swapped, Swapped,

View File

@ -443,7 +443,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
match &*item.kind() { match &*item.kind() {
ItemKind::Consumable { effects, .. } => { ItemKind::Consumable { effects, .. } => {
maybe_effect = Some(effects.clone()); maybe_effect = Some(effects.clone());
Some(InventoryUpdateEvent::Consumed(item.name().into_owned())) Some(InventoryUpdateEvent::Consumed((&item).into()))
}, },
ItemKind::Throwable { kind, .. } => { ItemKind::Throwable { kind, .. } => {
if let Some(pos) = if let Some(pos) =

View File

@ -87,7 +87,7 @@ use common::{
assets::{self, AssetExt, AssetHandle}, assets::{self, AssetExt, AssetHandle},
comp::{ comp::{
beam, biped_large, biped_small, bird_large, humanoid, beam, biped_large, biped_small, bird_large, humanoid,
item::{AbilitySpec, ItemDefinitionId, ItemKind, ToolKind}, item::{item_key::ItemKey, AbilitySpec, ItemDefinitionId, ItemKind, ToolKind},
object, object,
poise::PoiseState, poise::PoiseState,
quadruped_low, quadruped_medium, quadruped_small, Body, CharacterAbilityType, Health, quadruped_low, quadruped_medium, quadruped_small, Body, CharacterAbilityType, Health,
@ -298,7 +298,7 @@ pub enum SfxInventoryEvent {
CollectedTool(ToolKind), CollectedTool(ToolKind),
CollectedItem(String), CollectedItem(String),
CollectFailed, CollectFailed,
Consumed(String), Consumed(ItemKey),
Debug, Debug,
Dropped, Dropped,
Given, Given,
@ -317,7 +317,12 @@ impl From<&InventoryUpdateEvent> for SfxEvent {
ItemKind::Tool(tool) => { ItemKind::Tool(tool) => {
SfxEvent::Inventory(SfxInventoryEvent::CollectedTool(tool.kind)) SfxEvent::Inventory(SfxInventoryEvent::CollectedTool(tool.kind))
}, },
ItemKind::Ingredient { .. } if matches!(item.item_definition_id(), ItemDefinitionId::Simple(id) if id.contains("mineral.gem.")) => { ItemKind::Ingredient { .. }
if matches!(
item.item_definition_id(),
ItemDefinitionId::Simple(id) if id.contains("mineral.gem.")
) =>
{
SfxEvent::Inventory(SfxInventoryEvent::CollectedItem(String::from( SfxEvent::Inventory(SfxInventoryEvent::CollectedItem(String::from(
"Gemstone", "Gemstone",
))) )))