Remove ItemVisualKey

This commit is contained in:
Sam 2024-06-03 20:37:56 -04:00
parent c2604ef527
commit d7f5c013ad
4 changed files with 59 additions and 38 deletions

View File

@ -1744,6 +1744,10 @@
"voxel.object.recipe_blacksmithing", "voxel.object.recipe_blacksmithing",
(1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, (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( Simple("common.items.recipes.weapons.iron"): VoxTrans(
"voxel.object.recipe_blacksmithing", "voxel.object.recipe_blacksmithing",
(1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, (1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0,
@ -1804,6 +1808,10 @@
"voxel.object.recipe_lapidary", "voxel.object.recipe_lapidary",
(1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, (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( Simple("common.items.recipes.unique.seashell_necklace"): VoxTrans(
"voxel.object.recipe_lapidary", "voxel.object.recipe_lapidary",
(1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0, (1.0, 0.0, 20.0), (30.0, 45.0, 120.0), 1.0,

View File

@ -418,14 +418,50 @@
// Other // Other
Simple("common.items.utility.coins"): "voxel.object.v-coin", Simple("common.items.utility.coins"): "voxel.object.v-coin",
Simple("common.items.utility.collar"): "voxel.object.collar", Simple("common.items.utility.collar"): "voxel.object.collar",
Recipe("recipe_alchemy"): "voxel.object.recipe_alchemy", Simple("common.items.recipes.potions"): "voxel.object.recipe_alchemy",
Recipe("recipe_blacksmithing"): "voxel.object.recipe_blacksmithing", Simple("common.items.recipes.explosives"): "voxel.object.recipe_alchemy",
Recipe("recipe_carpentry"): "voxel.object.recipe_carpentry", Simple("common.items.recipes.charms"): "voxel.object.recipe_alchemy",
Recipe("recipe_cooking"): "voxel.object.recipe_cooking", Simple("common.items.recipes.armor.iron"): "voxel.object.recipe_blacksmithing",
Recipe("recipe_lapidary"): "voxel.object.recipe_lapidary", Simple("common.items.recipes.armor.steel"): "voxel.object.recipe_blacksmithing",
Recipe("recipe_leatherworking"): "voxel.object.recipe_leatherworking", Simple("common.items.recipes.armor.cobalt"): "voxel.object.recipe_blacksmithing",
Recipe("recipe_weaving"): "voxel.object.recipe_weaving", Simple("common.items.recipes.armor.bloodsteel"): "voxel.object.recipe_blacksmithing",
Recipe("scroll"): "voxel.object.scroll", 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 // Armor
// Starter Parts // Starter Parts
Simple("common.items.armor.misc.foot.sandals"): "voxel.armor.misc.foot.cloth_sandal", Simple("common.items.armor.misc.foot.sandals"): "voxel.armor.misc.foot.cloth_sandal",

View File

@ -1,7 +1,7 @@
use crate::ui::{Graphic, SampleStrat, Transform, Ui}; use crate::ui::{Graphic, SampleStrat, Transform, Ui};
use common::{ use common::{
assets::{self, AssetCombined, AssetExt, AssetHandle, Concatenate, DotVoxAsset, ReloadWatcher}, assets::{self, AssetCombined, AssetExt, AssetHandle, Concatenate, DotVoxAsset, ReloadWatcher},
comp::item::{item_key::ItemKey, modular}, comp::item::item_key::ItemKey,
figure::Segment, figure::Segment,
}; };
use conrod_core::image::Id; use conrod_core::image::Id;
@ -56,7 +56,7 @@ impl ImageSpec {
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct ItemImagesSpec(pub HashMap<ItemVisualKey, ImageSpec>); pub struct ItemImagesSpec(pub HashMap<ItemKey, ImageSpec>);
impl assets::Asset for ItemImagesSpec { impl assets::Asset for ItemImagesSpec {
type Loader = assets::RonLoader; 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 // TODO: when there are more images don't load them all into memory
pub struct ItemImgs { pub struct ItemImgs {
map: HashMap<ItemVisualKey, Id>, map: HashMap<ItemKey, Id>,
manifest: AssetHandle<ItemImagesSpec>, manifest: AssetHandle<ItemImagesSpec>,
watcher: ReloadWatcher, watcher: ReloadWatcher,
not_found: Id, not_found: Id,
@ -118,11 +118,11 @@ impl ItemImgs {
if let ItemKey::TagExamples(keys, _) = item_key { if let ItemKey::TagExamples(keys, _) = item_key {
return keys return keys
.iter() .iter()
.filter_map(|k| self.map.get(&ItemVisualKey::from(k.clone()))) .filter_map(|k| self.map.get(k))
.cloned() .cloned()
.collect(); .collect();
}; };
match self.map.get(&ItemVisualKey::from(item_key.clone())) { match self.map.get(&item_key) {
Some(id) => vec![*id], Some(id) => vec![*id],
// There was no specification in the ron // There was no specification in the ron
None => { None => {
@ -183,25 +183,3 @@ fn graceful_load_segment_no_skin(specifier: &str, model_index: u32) -> Arc<Segme
.to_segment(|_| Default::default()); .to_segment(|_| Default::default());
Arc::new(seg) Arc::new(seg)
} }
#[derive(Clone, Debug, Serialize, Deserialize, Hash, Eq, PartialEq)]
pub enum ItemVisualKey {
Simple(String),
ModularWeapon(modular::ModularWeaponKey),
ModularWeaponComponent(modular::ModularWeaponComponentKey),
TagExamples(Vec<ItemKey>, String),
Recipe(String),
Empty,
}
impl From<ItemKey> 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,
}
}
}

View File

@ -1,7 +1,6 @@
use super::cache::{ use super::cache::{
FigureKey, FigureModelEntryFuture, ModelEntryFuture, TerrainModelEntryFuture, ToolKey, FigureKey, FigureModelEntryFuture, ModelEntryFuture, TerrainModelEntryFuture, ToolKey,
}; };
use crate::hud::item_imgs::ItemVisualKey;
use common::{ use common::{
assets::{self, AssetExt, AssetHandle, Concatenate, DotVoxAsset, MultiRon, ReloadWatcher}, assets::{self, AssetExt, AssetHandle, Concatenate, DotVoxAsset, MultiRon, ReloadWatcher},
comp::{ comp::{
@ -5610,7 +5609,7 @@ impl<'de> Deserialize<'de> for ModelWithOptionalIndex {
} }
#[derive(Deserialize)] #[derive(Deserialize)]
struct ItemDropCentralSpec(HashMap<ItemVisualKey, ModelWithOptionalIndex>); struct ItemDropCentralSpec(HashMap<ItemKey, ModelWithOptionalIndex>);
impl_concatenate_for_wrapper!(ItemDropCentralSpec); impl_concatenate_for_wrapper!(ItemDropCentralSpec);
make_vox_spec!( make_vox_spec!(
@ -5646,7 +5645,7 @@ impl ItemDropCentralSpec {
if let Some(spec) = match item_drop { if let Some(spec) = match item_drop {
item_drop::Body::CoinPouch => Some(&coin_pouch), 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 full_spec: String = ["voxygen.", spec.0.as_str()].concat();
let segment = match item_drop { let segment = match item_drop {