From d7f5c013ad79ad0edf2b4cb21f311fdecf5a8a8b Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Jun 2024 20:37:56 -0400 Subject: [PATCH] Remove ItemVisualKey --- assets/voxygen/item_image_manifest.ron | 8 ++++ assets/voxygen/voxel/item_drop_manifest.ron | 52 +++++++++++++++++---- voxygen/src/hud/item_imgs.rs | 32 ++----------- voxygen/src/scene/figure/load.rs | 5 +- 4 files changed, 59 insertions(+), 38 deletions(-) diff --git a/assets/voxygen/item_image_manifest.ron b/assets/voxygen/item_image_manifest.ron index 359c50b284..83010c3453 100644 --- a/assets/voxygen/item_image_manifest.ron +++ b/assets/voxygen/item_image_manifest.ron @@ -1744,6 +1744,10 @@ "voxel.object.recipe_blacksmithing", (1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, ), + Simple("common.items.recipes.unique.delvers_lamp"): VoxTrans( + "voxel.object.recipe_lapidary", + (1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, + ), Simple("common.items.recipes.weapons.iron"): VoxTrans( "voxel.object.recipe_blacksmithing", (1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, @@ -1804,6 +1808,10 @@ "voxel.object.recipe_lapidary", (1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, ), + Simple("common.items.recipes.unique.abyssal_ring"): VoxTrans( + "voxel.object.recipe_lapidary", + (1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, + ), Simple("common.items.recipes.unique.seashell_necklace"): VoxTrans( "voxel.object.recipe_lapidary", (1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, diff --git a/assets/voxygen/voxel/item_drop_manifest.ron b/assets/voxygen/voxel/item_drop_manifest.ron index 3940ef308d..8481ac76c5 100644 --- a/assets/voxygen/voxel/item_drop_manifest.ron +++ b/assets/voxygen/voxel/item_drop_manifest.ron @@ -418,14 +418,50 @@ // Other Simple("common.items.utility.coins"): "voxel.object.v-coin", Simple("common.items.utility.collar"): "voxel.object.collar", - Recipe("recipe_alchemy"): "voxel.object.recipe_alchemy", - Recipe("recipe_blacksmithing"): "voxel.object.recipe_blacksmithing", - Recipe("recipe_carpentry"): "voxel.object.recipe_carpentry", - Recipe("recipe_cooking"): "voxel.object.recipe_cooking", - Recipe("recipe_lapidary"): "voxel.object.recipe_lapidary", - Recipe("recipe_leatherworking"): "voxel.object.recipe_leatherworking", - Recipe("recipe_weaving"): "voxel.object.recipe_weaving", - Recipe("scroll"): "voxel.object.scroll", + Simple("common.items.recipes.potions"): "voxel.object.recipe_alchemy", + Simple("common.items.recipes.explosives"): "voxel.object.recipe_alchemy", + Simple("common.items.recipes.charms"): "voxel.object.recipe_alchemy", + Simple("common.items.recipes.armor.iron"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.armor.steel"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.armor.cobalt"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.armor.bloodsteel"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.armor.orichalcum"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.unique.polaris"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.unique.delvers_lamp"): "voxel.object.recipe_lapidary", + Simple("common.items.recipes.weapons.iron"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.weapons.steel"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.weapons.cobalt"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.weapons.bloodsteel"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.weapons.orichalcum"): "voxel.object.recipe_blacksmithing", + Simple("common.items.recipes.gliders"): "voxel.object.recipe_carpentry", + Simple("common.items.recipes.instruments"): "voxel.object.recipe_carpentry", + Simple("common.items.recipes.weapons.bamboo"): "voxel.object.recipe_carpentry", + Simple("common.items.recipes.weapons.hardwood"): "voxel.object.recipe_carpentry", + Simple("common.items.recipes.weapons.ironwood"): "voxel.object.recipe_carpentry", + Simple("common.items.recipes.weapons.frostwood"): "voxel.object.recipe_carpentry", + Simple("common.items.recipes.weapons.eldwood"): "voxel.object.recipe_carpentry", + Simple("common.items.recipes.food"): "voxel.object.recipe_cooking", + Simple("common.items.recipes.armor.brinestone"): "voxel.object.recipe_lapidary", + Simple("common.items.recipes.unique.abyssal_gorget"): "voxel.object.recipe_lapidary", + Simple("common.items.recipes.unique.abyssal_ring"): "voxel.object.recipe_lapidary", + Simple("common.items.recipes.unique.seashell_necklace"): "voxel.object.recipe_lapidary", + Simple("common.items.recipes.armor.leather"): "voxel.object.recipe_leatherworking", + Simple("common.items.recipes.armor.scale"): "voxel.object.recipe_leatherworking", + Simple("common.items.recipes.armor.carapace"): "voxel.object.recipe_leatherworking", + Simple("common.items.recipes.armor.primal"): "voxel.object.recipe_leatherworking", + Simple("common.items.recipes.armor.dragonscale"): "voxel.object.recipe_leatherworking", + Simple("common.items.recipes.unique.mindflayer_spellbag"): "voxel.object.recipe_leatherworking", + Simple("common.items.recipes.unique.troll_hide_pack"): "voxel.object.recipe_leatherworking", + Simple("common.items.recipes.unique.winged_coronet"): "voxel.object.recipe_leatherworking", + Simple("common.items.recipes.armor.woolen"): "voxel.object.recipe_weaving", + Simple("common.items.recipes.armor.silken"): "voxel.object.recipe_weaving", + Simple("common.items.recipes.armor.druid"): "voxel.object.recipe_weaving", + Simple("common.items.recipes.armor.moonweave"): "voxel.object.recipe_weaving", + Simple("common.items.recipes.armor.sunsilk"): "voxel.object.recipe_weaving", + Simple("common.items.recipes.utility"): "voxel.object.scroll", + Simple("common.items.recipes.equipment.basic"): "voxel.object.scroll", + Simple("common.items.recipes.equipment.moderate"): "voxel.object.scroll", + Simple("common.items.recipes.equipment.advanced"): "voxel.object.scroll", // Armor // Starter Parts Simple("common.items.armor.misc.foot.sandals"): "voxel.armor.misc.foot.cloth_sandal", diff --git a/voxygen/src/hud/item_imgs.rs b/voxygen/src/hud/item_imgs.rs index eb0b4caf96..7d7234f80c 100644 --- a/voxygen/src/hud/item_imgs.rs +++ b/voxygen/src/hud/item_imgs.rs @@ -1,7 +1,7 @@ use crate::ui::{Graphic, SampleStrat, Transform, Ui}; use common::{ assets::{self, AssetCombined, AssetExt, AssetHandle, Concatenate, DotVoxAsset, ReloadWatcher}, - comp::item::{item_key::ItemKey, modular}, + comp::item::item_key::ItemKey, figure::Segment, }; use conrod_core::image::Id; @@ -56,7 +56,7 @@ impl ImageSpec { } #[derive(Serialize, Deserialize)] -pub struct ItemImagesSpec(pub HashMap); +pub struct ItemImagesSpec(pub HashMap); impl assets::Asset for ItemImagesSpec { type Loader = assets::RonLoader; @@ -68,7 +68,7 @@ impl Concatenate for ItemImagesSpec { // TODO: when there are more images don't load them all into memory pub struct ItemImgs { - map: HashMap, + map: HashMap, manifest: AssetHandle, watcher: ReloadWatcher, not_found: Id, @@ -118,11 +118,11 @@ impl ItemImgs { if let ItemKey::TagExamples(keys, _) = item_key { return keys .iter() - .filter_map(|k| self.map.get(&ItemVisualKey::from(k.clone()))) + .filter_map(|k| self.map.get(k)) .cloned() .collect(); }; - match self.map.get(&ItemVisualKey::from(item_key.clone())) { + match self.map.get(&item_key) { Some(id) => vec![*id], // There was no specification in the ron None => { @@ -183,25 +183,3 @@ fn graceful_load_segment_no_skin(specifier: &str, model_index: u32) -> Arc, String), - Recipe(String), - Empty, -} - -impl From for ItemVisualKey { - fn from(item_key: ItemKey) -> Self { - match item_key { - ItemKey::Simple(key) => Self::Simple(key), - ItemKey::ModularWeapon(key) => Self::ModularWeapon(key), - ItemKey::ModularWeaponComponent(key) => Self::ModularWeaponComponent(key), - ItemKey::TagExamples(keys, key) => Self::TagExamples(keys, key), - ItemKey::Empty => Self::Empty, - } - } -} diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 1db0080b49..a0e6fe70e7 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -1,7 +1,6 @@ use super::cache::{ FigureKey, FigureModelEntryFuture, ModelEntryFuture, TerrainModelEntryFuture, ToolKey, }; -use crate::hud::item_imgs::ItemVisualKey; use common::{ assets::{self, AssetExt, AssetHandle, Concatenate, DotVoxAsset, MultiRon, ReloadWatcher}, comp::{ @@ -5610,7 +5609,7 @@ impl<'de> Deserialize<'de> for ModelWithOptionalIndex { } #[derive(Deserialize)] -struct ItemDropCentralSpec(HashMap); +struct ItemDropCentralSpec(HashMap); impl_concatenate_for_wrapper!(ItemDropCentralSpec); make_vox_spec!( @@ -5646,7 +5645,7 @@ impl ItemDropCentralSpec { if let Some(spec) = match item_drop { item_drop::Body::CoinPouch => Some(&coin_pouch), - _ => self.0.get(&ItemVisualKey::from(item_key.clone())), + _ => self.0.get(item_key), } { let full_spec: String = ["voxygen.", spec.0.as_str()].concat(); let segment = match item_drop {