Merge branch 'isse/usable-shovel' into 'master'

Usable shovel

See merge request veloren/veloren!4060
This commit is contained in:
Isse 2023-08-08 18:45:10 +00:00
commit b3899d6966
41 changed files with 200 additions and 47 deletions

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Combat music toggle
- Spawn rtsim wyverns that travel the world, providing dragon scale loot drops
- Hardwood in tropical forests, frostwood in cold forests, and iron wood on the top of giant trees
- Recipe for shovel, which is used to dig in mud and graves
### Changed

View File

@ -891,6 +891,11 @@
secondary: Simple(None, "common.abilities.pick.swing"),
abilities: [],
),
Tool(Shovel): (
primary: Simple(None, "common.abilities.shovel.dig"),
secondary: Simple(None, "common.abilities.shovel.dig"),
abilities: [],
),
Tool(Empty): (
primary: Simple(None, "common.abilities.empty.basic"),
secondary: Simple(None, "common.abilities.empty.basic"),

View File

@ -0,0 +1,17 @@
BasicMelee(
energy_cost: 0,
buildup_duration: 0.25,
swing_duration: 0.05,
recover_duration: 0.075,
melee_constructor: (
kind: Stab(
damage: 5.0,
poise: 0.0,
knockback: 0.0,
energy_regen: 0.0,
),
range: 4.5,
angle: 20.0,
),
ori_modifier: 1.0,
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Shovel",
description: "It's covered in manure.",
kind: Tool((
kind: Farming,
kind: Shovel,
hands: Two,
stats: (
equip_time_secs: 0.4,
@ -15,7 +15,9 @@ ItemDef(
buff_strength: 1.0,
),
)),
quality: Common,
tags: [],
quality: Moderate,
tags: [
CraftingTool,
],
ability_spec: None,
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Shovel",
description: "It's been recently cleaned.",
kind: Tool((
kind: Farming,
kind: Shovel,
hands: Two,
stats: (
equip_time_secs: 0.4,
@ -16,6 +16,8 @@ ItemDef(
),
)),
quality: Common,
tags: [],
tags: [
CraftingTool,
],
ability_spec: None,
)

View File

@ -2282,4 +2282,13 @@
],
craft_sprite: Some(CraftingBench),
),
"shovel": (
output: ("common.items.weapons.tool.shovel-0", 1),
inputs: [
(Item("common.items.crafting_ing.twigs"), 5, false),
(Item("common.items.mineral.ingot.iron"), 2, false),
(Item("common.items.tool.craftsman_hammer"), 0, false),
],
craft_sprite: Some(CraftingBench),
),
}

View File

@ -1491,6 +1491,13 @@
threshold: 0.9,
subtitle: "subtitle-attack-steam",
),
GroundDig: (
files: [
"voxygen.audio.sfx.abilities.shovel",
],
threshold: 0.8,
subtitle: "subtitle-attack-shovel",
),
// Utterances (NPCs)

BIN
assets/voxygen/audio/sfx/abilities/shovel.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/weapons/dig.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -75,6 +75,7 @@ common-weapons-unique = Unique
common-tool-debug = Debug
common-tool-farming = Farming Tool
common-tool-pick = Pickaxe
common-tool-shovel = Shovel
common-tool-mining = Mining
common-tool-instrument = Instrument
common-kind-modular_component = Modular Component
@ -113,3 +114,5 @@ common-material-cloth = Cloth
common-material-hide = Hide
common-sprite-chest = Chest
common-sprite-chair = Chair
common-sprite-mud = Mud
common-sprite-grave = Grave

View File

@ -47,7 +47,9 @@ hud-read = Read
hud-unlock-requires = Open with { $item }
hud-unlock-consumes = Use { $item } to open
hud-mine = Mine
hud-dig = Dig
hud-mine-needs_pickaxe = Needs Pickaxe
hud-mine-needs_shovel = Needs Shovel
hud-mine-needs_unhandled_case = Needs ???
hud-talk = Talk
hud-trade = Trade

View File

@ -108,6 +108,7 @@ subtitle-attack-flash_freeze = Flash freeze
subtitle-attack-icy_spikes = Icy spikes
subtitle-attack-ice_crack = Ice crack
subtitle-attack-steam = Steam
subtitle-attack-shovel = Shovel digging
subtitle-consume_potion = Drinking potion
subtitle-consume_apple = Eating apple

View File

@ -1616,11 +1616,11 @@
),
Simple("common.items.weapons.tool.shovel-0"): VoxTrans(
"voxel.weapon.tool.shovel_green",
(0.0, 0.0, 0.0), (-135.0, 90.0, 0.0), 1.2,
(0.0, 0.0, 0.0), (-45.0, -90.0, 0.0), 1.2,
),
Simple("common.items.weapons.tool.shovel-1"): VoxTrans(
"voxel.weapon.tool.shovel_gold",
(0.0, 0.0, 0.0), (-135.0, 90.0, 0.0), 1.2,
(0.0, 0.0, 0.0), (-45.0, -90.0, 0.0), 1.2,
),
Simple("common.items.tool.instruments.lyre"): VoxTrans(
"voxel.weapon.tool.wooden_lyre",

Binary file not shown.

Binary file not shown.

View File

@ -180,6 +180,7 @@ fn get_tool_kind(kind: &ToolKind) -> String {
ToolKind::Debug => "Debug".to_string(),
ToolKind::Farming => "Farming".to_string(),
ToolKind::Pick => "Pick".to_string(),
ToolKind::Shovel => "Shovel".to_string(),
ToolKind::Instrument => "Instrument".to_string(),
ToolKind::Natural => "Natural".to_string(),
ToolKind::Empty => "Empty".to_string(),

View File

@ -36,6 +36,7 @@ pub enum ToolKind {
Debug,
Farming,
Pick,
Shovel,
// npcs
/// Intended for invisible weapons (e.g. a creature using its claws or
/// biting)
@ -64,6 +65,7 @@ impl ToolKind {
ToolKind::Debug => "debug",
ToolKind::Farming => "farming",
ToolKind::Pick => "pickaxe",
ToolKind::Shovel => "shovel",
ToolKind::Instrument => "instrument",
ToolKind::Empty => "empty",
}

View File

@ -137,6 +137,9 @@ pub enum Outcome {
FireShockwave {
pos: Vec3<f32>,
},
GroundDig {
pos: Vec3<f32>,
},
}
impl Outcome {
@ -166,6 +169,7 @@ impl Outcome {
| Outcome::CyclopsCharge { pos }
| Outcome::FlamethrowerCharge { pos }
| Outcome::LaserBeam { pos }
| Outcome::GroundDig { pos }
| Outcome::Glider { pos, .. } => Some(*pos),
Outcome::BreakBlock { pos, .. }
| Outcome::SpriteUnlocked { pos }

View File

@ -3,6 +3,8 @@ use crate::{
character_state::OutputEvents, tool::ToolKind, CharacterState, MeleeConstructor,
StateUpdate,
},
event::LocalEvent,
outcome::Outcome,
states::{
behavior::{CharacterBehavior, JoinData},
utils::*,
@ -91,9 +93,17 @@ impl CharacterBehavior for Data {
self.static_data.ability_info.tool,
)
})
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
.filter(|(_, tool)| {
matches!(tool, Some(ToolKind::Pick | ToolKind::Shovel))
}),
),
);
// Send local event used for frontend shenanigans
if self.static_data.ability_info.tool == Some(ToolKind::Shovel) {
output_events.emit_local(LocalEvent::CreateOutcome(Outcome::GroundDig {
pos: data.pos.0 + *data.ori.look_dir() * (data.body.max_radius()),
}));
}
} else if self.timer < self.static_data.swing_duration {
// Swings
update.character = CharacterState::BasicMelee(Data {

View File

@ -282,7 +282,9 @@ impl CharacterBehavior for Data {
self.static_data.ability_info.tool,
)
})
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
.filter(|(_, tool)| {
matches!(tool, Some(ToolKind::Pick | ToolKind::Shovel))
}),
});
} else if self.timer < self.static_data.stage_data[stage_index].base_swing_duration
{

View File

@ -627,6 +627,7 @@ impl SpriteKind {
| SpriteKind::Silver
| SpriteKind::Gold
| SpriteKind::SapphireSmall => Some(ToolKind::Pick),
SpriteKind::Grave | SpriteKind::Mud => Some(ToolKind::Shovel),
_ => None,
}
}

View File

@ -118,6 +118,7 @@ impl<'a> TargetData<'a> {
| ToolKind::Spear
| ToolKind::Farming
| ToolKind::Pick
| ToolKind::Shovel
| ToolKind::Natural
| ToolKind::Empty,
)

View File

@ -86,7 +86,8 @@ pub fn skill_group_to_db_string(skill_group: comp::skillset::SkillGroupKind) ->
| Weapon(ToolKind::Farming)
| Weapon(ToolKind::Instrument)
| Weapon(ToolKind::Empty)
| Weapon(ToolKind::Natural) => panic!(
| Weapon(ToolKind::Natural)
| Weapon(ToolKind::Shovel) => panic!(
"Tried to add unsupported skill group to database: {:?}",
skill_group
),
@ -200,6 +201,7 @@ fn tool_kind_to_string(tool: Option<comp::item::tool::ToolKind>) -> String {
Some(Spear) => "Spear",
Some(Blowgun) => "Blowgun",
Some(Pick) => "Pick",
Some(Shovel) => "Shovel",
// Toolkinds that are not anticipated to have many active abilities (if any at all)
Some(Farming) => "Farming",

View File

@ -115,7 +115,7 @@ impl Animation for AlphaAnimation {
next.tail.orientation = Quaternion::rotation_x(0.05 * fastalt * speednormcancel)
* Quaternion::rotation_z(fast * 0.15 * speednormcancel);
},
Some(ToolKind::Axe | ToolKind::Hammer | ToolKind::Pick) => {
Some(ToolKind::Axe | ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.head.orientation = Quaternion::rotation_z(move1abs * 0.3 + move2abs * -0.6);
next.control_l.position = Vec3::new(2.0 - s_a.grip.0 * 2.0, 1.0, 3.0);
next.control_r.position = Vec3::new(

View File

@ -65,7 +65,7 @@ impl Animation for AlphaAnimation {
next.head.orientation = Quaternion::rotation_z(move1 * -0.9 + move2 * 1.8);
},
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0),
@ -96,7 +96,7 @@ impl Animation for AlphaAnimation {
match hands {
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick) => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
@ -128,6 +128,30 @@ impl Animation for AlphaAnimation {
)
* Quaternion::rotation_z(s_a.hc.5 + (moveret2 * -0.5));
},
Some(ToolKind::Shovel) => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;
let moveret1 = move1 * pullback;
let moveret2 = move2 * pullback;
next.hand_l.position = Vec3::new(8.0, 6.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
next.hand_r.position = Vec3::new(8.0, 6.0, 15.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(PI);
next.control.position = Vec3::new(-11.0 + moveret1 * 8.0, 1.8, 4.0);
next.control.orientation =
Quaternion::rotation_x(moveret1 * 0.3 + moveret2 * 0.2)
* Quaternion::rotation_y(0.8 - moveret1 * 0.7 + moveret2 * 0.7)
* Quaternion::rotation_z(moveret2 * 0.1 - moveret1 * 0.4);
},
_ => {},
}
},
@ -144,7 +168,7 @@ impl Animation for AlphaAnimation {
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
},
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.control_l.position = Vec3::new(
-7.0,
8.0 + move1 * -4.0 + move2 * 4.0,
@ -173,7 +197,7 @@ impl Animation for AlphaAnimation {
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
},
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.control_r.position = Vec3::new(
7.0,
8.0 + move1 * -4.0 + move2h * 4.0,

View File

@ -139,7 +139,7 @@ impl Animation for BlockAnimation {
* Quaternion::rotation_y(s_a.ac.4 + move1 * -1.8)
* Quaternion::rotation_z(s_a.ac.5 + move1 * 4.0);
},
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.hand_l.position = Vec3::new(
s_a.hhl.0,
s_a.hhl.1 + move1 * 6.0,

View File

@ -39,7 +39,7 @@ impl Animation for EquipAnimation {
next.hand_l.position = Vec3::new(-7.0, -5.0, 17.0);
next.hand_r.position = Vec3::new(-5.0, -4.5, 14.0);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.hand_l.position = Vec3::new(-5.0, -5.0, 13.0);
next.hand_r.position = Vec3::new(-3.0, -4.5, 10.0);
},

View File

@ -121,7 +121,7 @@ impl Animation for LeapAnimation {
match hands {
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick) => {
next.control_l.position = Vec3::new(
-7.0,
8.0 + move2 * -5.0 + move3 * 9.0,
@ -140,7 +140,7 @@ impl Animation for LeapAnimation {
match hands {
(None | Some(Hands::One), Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick) => {
next.control_r.position = Vec3::new(
7.0 + move2 * 3.0 + move3 * -3.0,
8.0 + move2 * -9.0 + move3 * 15.0,

View File

@ -103,7 +103,9 @@ impl Animation for RollAnimation {
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Instrument) => {
Some(
ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel | ToolKind::Instrument,
) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
* Quaternion::rotation_y(s_a.hhl.4)

View File

@ -179,7 +179,7 @@ impl Animation for SneakEquipAnimation {
next.hand_l.position = Vec3::new(-7.0, -5.0, 17.0);
next.hand_r.position = Vec3::new(-5.0, -4.5, 14.0);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.hand_l.position = Vec3::new(-5.0, -5.0, 13.0);
next.hand_r.position = Vec3::new(-3.0, -4.5, 10.0);
},

View File

@ -232,7 +232,7 @@ impl Animation for SneakWieldAnimation {
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
* Quaternion::rotation_y(s_a.hhl.4)

View File

@ -103,7 +103,7 @@ impl Animation for StaggeredAnimation {
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
* Quaternion::rotation_y(s_a.hhl.4)

View File

@ -99,7 +99,7 @@ impl Animation for StunnedAnimation {
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer | ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
* Quaternion::rotation_y(s_a.hhl.4)

View File

@ -223,7 +223,7 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => {
Some(ToolKind::Hammer | ToolKind::Pick) => {
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
* Quaternion::rotation_y(s_a.hhl.4)
@ -305,6 +305,19 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
Some(ToolKind::Shovel) => {
next.hand_l.position = Vec3::new(8.0, 6.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
next.hand_r.position = Vec3::new(8.0, 6.0, 15.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(PI);
next.control.position = Vec3::new(-11.0 + slow * 0.02, 1.8, 4.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.01)
* Quaternion::rotation_y(0.8 + u_slow * 0.01)
* Quaternion::rotation_z(u_slowalt * 0.01);
},
Some(ToolKind::Instrument) => {
if let Some(AbilitySpec::Custom(spec)) = active_tool_spec {
match spec.as_str() {

View File

@ -182,6 +182,7 @@ pub enum SfxEvent {
DeepLaugh,
Whoosh,
Swoosh,
GroundDig,
}
#[derive(Copy, Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
@ -488,6 +489,10 @@ impl SfxMgr {
},
}
},
Outcome::GroundDig { pos, .. } => {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::GroundDig);
audio.emit_sfx(sfx_trigger_item, *pos, Some(2.0), underwater);
},
Outcome::IceSpikes { pos, .. } => {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::IceSpikes);
audio.emit_sfx(sfx_trigger_item, *pos, Some(2.0), underwater);

View File

@ -2937,6 +2937,7 @@ fn unlock_skill_strings(group: SkillGroupKind) -> SkillStrings<'static> {
| ToolKind::Farming
| ToolKind::Instrument
| ToolKind::Pick
| ToolKind::Shovel
| ToolKind::Natural
| ToolKind::Empty,
) => {

View File

@ -92,6 +92,7 @@ image_ids! {
bow: "voxygen.element.weapons.bow",
staff: "voxygen.element.weapons.staff",
mining: "voxygen.element.weapons.mining",
dig: "voxygen.element.weapons.dig",
pickaxe: "voxygen.element.skills.pickaxe",
pickaxe_ico: "voxygen.element.weapons.pickaxe",
skilltree_ico: "voxygen.element.ui.diary.buttons.skilltree",

View File

@ -2065,11 +2065,11 @@ impl Hud {
let pos = mat.mul_point(Vec3::broadcast(0.5));
let over_pos = pos + Vec3::unit_z() * 0.7;
let interaction_text = || match interaction {
let interaction_text = |collect_default| match interaction {
BlockInteraction::Collect => {
vec![(
Some(GameInput::Interact),
i18n.get_msg("hud-collect").to_string(),
i18n.get_msg(collect_default).to_string(),
)]
},
BlockInteraction::Craft(_) => {
@ -2099,15 +2099,34 @@ impl Hud {
},
BlockInteraction::Mine(mine_tool) => {
if info.is_mining {
vec![(
Some(GameInput::Primary),
i18n.get_msg("hud-mine").to_string(),
)]
match mine_tool {
ToolKind::Pick => {
vec![(
Some(GameInput::Primary),
i18n.get_msg("hud-mine").to_string(),
)]
},
ToolKind::Shovel => {
vec![(
Some(GameInput::Primary),
i18n.get_msg("hud-dig").to_string(),
)]
},
_ => {
vec![(
None,
i18n.get_msg("hud-mine-needs_unhandled_case").to_string(),
)]
},
}
} else {
match mine_tool {
ToolKind::Pick => {
vec![(None, i18n.get_msg("hud-mine-needs_pickaxe").to_string())]
},
ToolKind::Shovel => {
vec![(None, i18n.get_msg("hud-mine-needs_shovel").to_string())]
}
// TODO: The required tool for mining something may not always be a
// pickaxe!
_ => {
@ -2148,10 +2167,7 @@ impl Hud {
overitem_properties,
self.pulse,
&global_state.window.key_layout,
vec![(
Some(GameInput::Interact),
i18n.get_msg("hud-open").to_string(),
)],
interaction_text("hud-open"),
)
.x_y(0.0, 100.0)
.position_ingame(over_pos)
@ -2160,11 +2176,7 @@ impl Hud {
// TODO: Handle this better. The items returned from `try_reclaim_from_block`
// are based on rng. We probably want some function to get only gauranteed items
// from `LootSpec`.
else if let Some((amount, mut item)) = Item::try_reclaim_from_block(*block)
.into_iter()
.flatten()
.next()
{
else if let Some((amount, mut item)) = Item::try_reclaim_from_block(*block).into_iter().flatten().next() {
item.set_amount(amount.clamp(1, item.max_amount()))
.expect("amount >= 1 and <= max_amount is always a valid amount");
make_overitem(
@ -2173,7 +2185,7 @@ impl Hud {
pos.distance_squared(player_pos),
overitem_properties,
&self.fonts,
interaction_text(),
interaction_text("hud-collect"),
)
.set(overitem_id, ui_widgets);
} else if let Some(desc) = block.get_sprite().and_then(|s| get_sprite_desc(s, i18n))
@ -2188,7 +2200,7 @@ impl Hud {
overitem_properties,
self.pulse,
&global_state.window.key_layout,
interaction_text(),
interaction_text("hud-collect"),
)
.x_y(0.0, 100.0)
.position_ingame(over_pos)
@ -5242,6 +5254,8 @@ pub fn get_sprite_desc(sprite: SpriteKind, localized_strings: &Localization) ->
| SpriteKind::DungeonChest3
| SpriteKind::DungeonChest4
| SpriteKind::DungeonChest5 => "common-sprite-chest",
SpriteKind::Mud => "common-sprite-mud",
SpriteKind::Grave => "common-sprite-grave",
SpriteKind::ChairSingle | SpriteKind::ChairDouble => "common-sprite-chair",
sprite => return Some(Cow::Owned(format!("{:?}", sprite))),
};

View File

@ -320,6 +320,7 @@ fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> Cow<'a, str> {
ToolKind::Farming => i18n.get_msg("common-tool-farming"),
ToolKind::Instrument => i18n.get_msg("common-tool-instrument"),
ToolKind::Pick => i18n.get_msg("common-tool-pick"),
ToolKind::Shovel => i18n.get_msg("common-tool-shovel"),
ToolKind::Empty => i18n.get_msg("common-empty"),
};
kind
@ -533,6 +534,8 @@ pub fn ability_image(imgs: &img_ids::Imgs, ability_id: &str) -> image::Id {
"common.abilities.dagger.tempbasic" => imgs.onehdagger_m1,
// Pickaxe
"common.abilities.pick.swing" => imgs.mining,
// Shovel
"common.abilities.shovel.dig" => imgs.dig,
// Instruments
"common.abilities.music.bass" => imgs.instrument,
"common.abilities.music.flute" => imgs.instrument,

View File

@ -386,6 +386,16 @@ impl ParticleMgr {
)
});
},
Outcome::GroundDig { pos, .. } => {
self.particles.resize_with(self.particles.len() + 12, || {
Particle::new(
Duration::from_millis(200),
time,
ParticleMode::BigShrapnel,
*pos,
)
});
},
Outcome::ProjectileShot { .. }
| Outcome::Beam { .. }
| Outcome::ExpChange { .. }

View File

@ -603,7 +603,9 @@ impl PlayState for SessionState {
.get(player_entity)
.and_then(|inv| inv.equipped(EquipSlot::ActiveMainhand))
.and_then(|item| item.tool_info())
.map_or(false, |tool_kind| tool_kind == ToolKind::Pick)
.map_or(false, |tool_kind| {
matches!(tool_kind, ToolKind::Pick | ToolKind::Shovel)
})
&& client.is_wielding() == Some(true);
// Check to see whether we're aiming at anything