From 1d0c861e19170fcaf11543008925a8f6ff674f51 Mon Sep 17 00:00:00 2001 From: ubruntu Date: Fri, 21 Jan 2022 18:05:39 +0000 Subject: [PATCH] Fix chest display names --- assets/voxygen/i18n/en/common.ron | 2 ++ voxygen/src/hud/mod.rs | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/assets/voxygen/i18n/en/common.ron b/assets/voxygen/i18n/en/common.ron index 5c9a9132f4..55159fa1fb 100644 --- a/assets/voxygen/i18n/en/common.ron +++ b/assets/voxygen/i18n/en/common.ron @@ -115,6 +115,8 @@ Is the client up to date?"#, "common.material.stone": "Stone", "common.material.cloth": "Cloth", "common.material.hide": "Hide", + + "common.sprite.chest": "Chest", }, diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 6322d7c486..cf59ad0b0b 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1743,9 +1743,13 @@ impl Hud { let over_pos = pos + Vec3::unit_z() * 0.7; // This is only done once per frame, so it's not a performance issue - if let Some(sprite) = block.get_sprite().filter(|s| s.is_container()) { + if let Some(desc) = block + .get_sprite() + .filter(|s| s.is_container()) + .and_then(|s| get_sprite_desc(s, i18n)) + { overitem::Overitem::new( - format!("{:?}", sprite).into(), + desc, overitem::TEXT_COLOR, pos.distance_squared(player_pos), &self.fonts, @@ -4333,6 +4337,14 @@ pub fn get_sprite_desc(sprite: SpriteKind, localized_strings: &Localization) -> SpriteKind::SpinningWheel => "hud.crafting.spinning_wheel", SpriteKind::TanningRack => "hud.crafting.tanning_rack", SpriteKind::DismantlingBench => "hud.crafting.salvaging_station", + SpriteKind::ChestBuried + | SpriteKind::Chest + | SpriteKind::DungeonChest0 + | SpriteKind::DungeonChest1 + | SpriteKind::DungeonChest2 + | SpriteKind::DungeonChest3 + | SpriteKind::DungeonChest4 + | SpriteKind::DungeonChest5 => "common.sprite.chest", sprite => return Some(Cow::Owned(format!("{:?}", sprite))), }; Some(Cow::Borrowed(localized_strings.get(i18n_key)))