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

View File

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

View File

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

View File

@ -87,7 +87,7 @@ use common::{
assets::{self, AssetExt, AssetHandle},
comp::{
beam, biped_large, biped_small, bird_large, humanoid,
item::{AbilitySpec, ItemDefinitionId, ItemKind, ToolKind},
item::{item_key::ItemKey, AbilitySpec, ItemDefinitionId, ItemKind, ToolKind},
object,
poise::PoiseState,
quadruped_low, quadruped_medium, quadruped_small, Body, CharacterAbilityType, Health,
@ -298,7 +298,7 @@ pub enum SfxInventoryEvent {
CollectedTool(ToolKind),
CollectedItem(String),
CollectFailed,
Consumed(String),
Consumed(ItemKey),
Debug,
Dropped,
Given,
@ -317,7 +317,12 @@ impl From<&InventoryUpdateEvent> for SfxEvent {
ItemKind::Tool(tool) => {
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(
"Gemstone",
)))