diff --git a/CHANGELOG.md b/CHANGELOG.md index 63c9428937..37505d520e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Crushing damage now does poise damage to a target equal to the amount mitigated by armor - UI to select abilities and assign to hotbar - Position of abilities on hotbar is now persisted through the server +- Interation hints now appear for sprites and entities +- Players can now mount and ride pets ### Changed diff --git a/assets/voxygen/i18n/en/hud/misc.ron b/assets/voxygen/i18n/en/hud/misc.ron index 44cd0e3d08..3a7b30298d 100644 --- a/assets/voxygen/i18n/en/hud/misc.ron +++ b/assets/voxygen/i18n/en/hud/misc.ron @@ -50,6 +50,7 @@ Whenever you feel ready, try to get even better equipment from the many challeng "hud.pick_up": "Pick up", "hud.open": "Open", "hud.use": "Use", + "hud.mine": "Mine", "hud.talk": "Talk", "hud.trade": "Trade", "hud.mount": "Mount", diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index edb323bc3e..175bcd88e0 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -57,7 +57,10 @@ use crate::{ game_input::GameInput, hud::{img_ids::ImgsRot, prompt_dialog::DialogOutcomeEvent}, render::UiDrawer, - scene::camera::{self, Camera}, + scene::{ + camera::{self, Camera}, + terrain::Interaction, + }, session::{ interactable::Interactable, settings_change::{Chat as ChatChange, Interface as InterfaceChange, SettingsChange}, @@ -1726,7 +1729,7 @@ impl Hud { } // Render overtime for an interactable block - if let Some(Interactable::Block(block, pos, _)) = interactable { + if let Some(Interactable::Block(block, pos, interaction)) = interactable { let overitem_id = overitem_walker.next( &mut self.ids.overitems, &mut ui_widgets.widget_id_generator(), @@ -1763,7 +1766,17 @@ impl Hud { pos.distance_squared(player_pos), overitem_properties, &self.fonts, - vec![(GameInput::Interact, i18n.get("hud.collect").to_string())], + match interaction { + Interaction::Collect => { + vec![(GameInput::Interact, i18n.get("hud.collect").to_string())] + }, + Interaction::Craft(_) => { + vec![(GameInput::Interact, i18n.get("hud.use").to_string())] + }, + Interaction::Mine => { + vec![(GameInput::Primary, i18n.get("hud.mine").to_string())] + }, + }, ) .set(overitem_id, ui_widgets); } else if let Some(desc) = block.get_sprite().and_then(|s| get_sprite_desc(s, i18n)) @@ -1960,6 +1973,7 @@ impl Hud { }, Some(comp::Alignment::Owned(owner)) if Some(*owner) == client.uid() + && !client.is_riding() && is_mount.is_none() && dist_sqr < common::consts::MAX_MOUNT_RANGE.powi(2) => { diff --git a/voxygen/src/scene/terrain/watcher.rs b/voxygen/src/scene/terrain/watcher.rs index 7bc085167d..17d5acb77f 100644 --- a/voxygen/src/scene/terrain/watcher.rs +++ b/voxygen/src/scene/terrain/watcher.rs @@ -9,6 +9,7 @@ use vek::*; pub enum Interaction { Collect, Craft(CraftingTab), + Mine, } #[derive(Default)] diff --git a/voxygen/src/session/interactable.rs b/voxygen/src/session/interactable.rs index 39a8d5b926..b11270d6e3 100644 --- a/voxygen/src/session/interactable.rs +++ b/voxygen/src/session/interactable.rs @@ -22,7 +22,7 @@ use crate::scene::{terrain::Interaction, Scene}; // enum since they don't use the interaction key #[derive(Clone, Copy, Debug)] pub enum Interactable { - Block(Block, Vec3, Option), + Block(Block, Vec3, Interaction), Entity(specs::Entity), } @@ -81,9 +81,8 @@ pub(super) fn select_interactable( .or_else(|| { collect_target.and_then(|t| { if Some(t.distance) == nearest_dist { - get_block(client, t).map(|b| { - Interactable::Block(b, t.position_int(), Some(Interaction::Collect)) - }) + get_block(client, t) + .map(|b| Interactable::Block(b, t.position_int(), Interaction::Collect)) } else { None } @@ -99,7 +98,7 @@ pub(super) fn select_interactable( // elements (e.g. minerals). The mineable weakrock are used // in the terrain selected_pos, but is not an interactable. if b.mine_tool().is_some() && b.is_air() { - Some(Interactable::Block(b, t.position_int(), None)) + Some(Interactable::Block(b, t.position_int(), Interaction::Mine)) } else { None } @@ -200,7 +199,7 @@ pub(super) fn select_interactable( .get(block_pos) .ok() .copied() - .map(|b| Interactable::Block(b, block_pos, Some(*interaction))) + .map(|b| Interactable::Block(b, block_pos, *interaction)) }) .or_else(|| closest_interactable_entity.map(|(e, _)| Interactable::Entity(e))) } diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index a028df181e..143946cdfc 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -713,18 +713,18 @@ impl PlayState for SessionState { match interactable { Interactable::Block(block, pos, interaction) => { match interaction { - Some(Interaction::Collect) => { + Interaction::Collect => { if block.is_collectible() { client.collect_block(pos); } }, - Some(Interaction::Craft(tab)) => { + Interaction::Craft(tab) => { self.hud.show.open_crafting_tab( tab, block.get_sprite().map(|s| (pos, s)), ) }, - _ => {}, + Interaction::Mine => {}, } }, Interactable::Entity(entity) => {