Updated changelog, fixed incorrect hint for mineable blocks

This commit is contained in:
Joshua Barretto 2022-01-16 17:48:21 +00:00
parent 043016a433
commit bde3aade2b
6 changed files with 29 additions and 12 deletions

View File

@ -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

View File

@ -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",

View File

@ -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) =>
{

View File

@ -9,6 +9,7 @@ use vek::*;
pub enum Interaction {
Collect,
Craft(CraftingTab),
Mine,
}
#[derive(Default)]

View File

@ -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<i32>, Option<Interaction>),
Block(Block, Vec3<i32>, 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)))
}

View File

@ -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) => {