digging shovel

This commit is contained in:
Isse 2023-08-03 19:32:00 +02:00
parent 8abb93040c
commit a39923e4d6
26 changed files with 111 additions and 30 deletions

View File

@ -891,6 +891,11 @@
secondary: Simple(None, "common.abilities.pick.swing"), secondary: Simple(None, "common.abilities.pick.swing"),
abilities: [], abilities: [],
), ),
Tool(Shovel): (
primary: Simple(None, "common.abilities.shovel.dig"),
secondary: Simple(None, "common.abilities.shovel.dig"),
abilities: [],
),
Tool(Empty): ( Tool(Empty): (
primary: Simple(None, "common.abilities.empty.basic"), primary: Simple(None, "common.abilities.empty.basic"),
secondary: 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", name: "Shovel",
description: "It's covered in manure.", description: "It's covered in manure.",
kind: Tool(( kind: Tool((
kind: Farming, kind: Shovel,
hands: Two, hands: Two,
stats: ( stats: (
equip_time_secs: 0.4, equip_time_secs: 0.4,
@ -16,6 +16,8 @@ ItemDef(
), ),
)), )),
quality: Common, quality: Common,
tags: [], tags: [
CraftingTool,
],
ability_spec: None, ability_spec: None,
) )

View File

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

View File

@ -2282,4 +2282,13 @@
], ],
craft_sprite: Some(CraftingBench), 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),
),
} }

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-debug = Debug
common-tool-farming = Farming Tool common-tool-farming = Farming Tool
common-tool-pick = Pickaxe common-tool-pick = Pickaxe
common-tool-shovel = Shovel
common-tool-mining = Mining common-tool-mining = Mining
common-tool-instrument = Instrument common-tool-instrument = Instrument
common-kind-modular_component = Modular Component common-kind-modular_component = Modular Component
@ -113,3 +114,5 @@ common-material-cloth = Cloth
common-material-hide = Hide common-material-hide = Hide
common-sprite-chest = Chest common-sprite-chest = Chest
common-sprite-chair = Chair 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-requires = Open with { $item }
hud-unlock-consumes = Use { $item } to open hud-unlock-consumes = Use { $item } to open
hud-mine = Mine hud-mine = Mine
hud-dig = Dig
hud-mine-needs_pickaxe = Needs Pickaxe hud-mine-needs_pickaxe = Needs Pickaxe
hud-mine-needs_shovel = Needs Shovel
hud-mine-needs_unhandled_case = Needs ??? hud-mine-needs_unhandled_case = Needs ???
hud-talk = Talk hud-talk = Talk
hud-trade = Trade hud-trade = Trade

View File

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

View File

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

View File

@ -91,7 +91,9 @@ impl CharacterBehavior for Data {
self.static_data.ability_info.tool, 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.swing_duration { } else if self.timer < self.static_data.swing_duration {

View File

@ -282,7 +282,9 @@ impl CharacterBehavior for Data {
self.static_data.ability_info.tool, 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 } 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::Silver
| SpriteKind::Gold | SpriteKind::Gold
| SpriteKind::SapphireSmall => Some(ToolKind::Pick), | SpriteKind::SapphireSmall => Some(ToolKind::Pick),
SpriteKind::Grave | SpriteKind::Mud => Some(ToolKind::Shovel),
_ => None, _ => None,
} }
} }

View File

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

View File

@ -167,7 +167,7 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_y(-0.2 * speednorm) * Quaternion::rotation_y(-0.2 * speednorm)
* Quaternion::rotation_z(0.5); * Quaternion::rotation_z(0.5);
}, },
Some(ToolKind::Axe | ToolKind::Hammer | ToolKind::Pick) => { Some(ToolKind::Axe | ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
next.control_l.position = Vec3::new(2.0 - s_a.grip.0 * 2.0, 1.0, 3.0); next.control_l.position = Vec3::new(2.0 - s_a.grip.0 * 2.0, 1.0, 3.0);
next.control_r.position = next.control_r.position =
Vec3::new(9.0 + s_a.grip.0 * 2.0, -1.0, -2.0 + speednorm * -3.0); Vec3::new(9.0 + s_a.grip.0 * 2.0, -1.0, -2.0 + speednorm * -3.0);

View File

@ -65,7 +65,7 @@ impl Animation for AlphaAnimation {
next.head.orientation = Quaternion::rotation_z(move1 * -0.9 + move2 * 1.8); next.head.orientation = Quaternion::rotation_z(move1 * -0.9 + move2 * 1.8);
}, },
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => { Some(ToolKind::Hammer) | Some(ToolKind::Pick) | Some(ToolKind::Shovel) => {
let (move1, move2, move3) = match stage_section { let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0), Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0),
@ -96,7 +96,7 @@ impl Animation for AlphaAnimation {
match hands { match hands {
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => { (Some(Hands::Two), _) | (None, Some(Hands::Two)) => {
match ability_info.and_then(|a| a.tool) { match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => { Some(ToolKind::Hammer) | Some(ToolKind::Pick) | Some(ToolKind::Shovel) => {
let (move1, move2, move3) = match stage_section { let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0), Some(StageSection::Action) => (1.0, anim_time, 0.0),
@ -144,7 +144,7 @@ impl Animation for AlphaAnimation {
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
}, },
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => { Some(ToolKind::Hammer) | Some(ToolKind::Pick) | Some(ToolKind::Shovel) => {
next.control_l.position = Vec3::new( next.control_l.position = Vec3::new(
-7.0, -7.0,
8.0 + move1 * -4.0 + move2 * 4.0, 8.0 + move1 * -4.0 + move2 * 4.0,
@ -173,7 +173,7 @@ impl Animation for AlphaAnimation {
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
}, },
Some(ToolKind::Hammer) | Some(ToolKind::Pick) => { Some(ToolKind::Hammer) | Some(ToolKind::Pick) | Some(ToolKind::Shovel) => {
next.control_r.position = Vec3::new( next.control_r.position = Vec3::new(
7.0, 7.0,
8.0 + move1 * -4.0 + move2h * 4.0, 8.0 + move1 * -4.0 + move2h * 4.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_l.position = Vec3::new(-7.0, -5.0, 17.0);
next.hand_r.position = Vec3::new(-5.0, -4.5, 14.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_l.position = Vec3::new(-5.0, -5.0, 13.0);
next.hand_r.position = Vec3::new(-3.0, -4.5, 10.0); next.hand_r.position = Vec3::new(-3.0, -4.5, 10.0);
}, },

View File

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

View File

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

View File

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

View File

@ -2099,15 +2099,34 @@ impl Hud {
}, },
BlockInteraction::Mine(mine_tool) => { BlockInteraction::Mine(mine_tool) => {
if info.is_mining { if info.is_mining {
vec![( match mine_tool {
Some(GameInput::Primary), ToolKind::Pick => {
i18n.get_msg("hud-mine").to_string(), 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 { } else {
match mine_tool { match mine_tool {
ToolKind::Pick => { ToolKind::Pick => {
vec![(None, i18n.get_msg("hud-mine-needs_pickaxe").to_string())] 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 // TODO: The required tool for mining something may not always be a
// pickaxe! // pickaxe!
_ => { _ => {
@ -2148,10 +2167,11 @@ impl Hud {
overitem_properties, overitem_properties,
self.pulse, self.pulse,
&global_state.window.key_layout, &global_state.window.key_layout,
vec![( interaction_text(),
Some(GameInput::Interact), // vec![(
i18n.get_msg("hud-open").to_string(), // Some(GameInput::Interact),
)], // i18n.get_msg("hud-open").to_string(),
// )],
) )
.x_y(0.0, 100.0) .x_y(0.0, 100.0)
.position_ingame(over_pos) .position_ingame(over_pos)
@ -2160,11 +2180,7 @@ impl Hud {
// TODO: Handle this better. The items returned from `try_reclaim_from_block` // 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 // are based on rng. We probably want some function to get only gauranteed items
// from `LootSpec`. // from `LootSpec`.
else if let Some((amount, mut item)) = Item::try_reclaim_from_block(*block) else if let Some((amount, mut item)) = Item::try_reclaim_from_block(*block).into_iter().flatten().next() {
.into_iter()
.flatten()
.next()
{
item.set_amount(amount.clamp(1, item.max_amount())) item.set_amount(amount.clamp(1, item.max_amount()))
.expect("amount >= 1 and <= max_amount is always a valid amount"); .expect("amount >= 1 and <= max_amount is always a valid amount");
make_overitem( make_overitem(
@ -5242,6 +5258,8 @@ pub fn get_sprite_desc(sprite: SpriteKind, localized_strings: &Localization) ->
| SpriteKind::DungeonChest3 | SpriteKind::DungeonChest3
| SpriteKind::DungeonChest4 | SpriteKind::DungeonChest4
| SpriteKind::DungeonChest5 => "common-sprite-chest", | SpriteKind::DungeonChest5 => "common-sprite-chest",
SpriteKind::Mud => "common-sprite-mud",
SpriteKind::Grave => "common-sprite-grave",
SpriteKind::ChairSingle | SpriteKind::ChairDouble => "common-sprite-chair", SpriteKind::ChairSingle | SpriteKind::ChairDouble => "common-sprite-chair",
sprite => return Some(Cow::Owned(format!("{:?}", sprite))), 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::Farming => i18n.get_msg("common-tool-farming"),
ToolKind::Instrument => i18n.get_msg("common-tool-instrument"), ToolKind::Instrument => i18n.get_msg("common-tool-instrument"),
ToolKind::Pick => i18n.get_msg("common-tool-pick"), ToolKind::Pick => i18n.get_msg("common-tool-pick"),
ToolKind::Shovel => i18n.get_msg("common-tool-shovel"),
ToolKind::Empty => i18n.get_msg("common-empty"), ToolKind::Empty => i18n.get_msg("common-empty"),
}; };
kind 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, "common.abilities.dagger.tempbasic" => imgs.onehdagger_m1,
// Pickaxe // Pickaxe
"common.abilities.pick.swing" => imgs.mining, "common.abilities.pick.swing" => imgs.mining,
// Shovel
"common.abilities.shovel.dig" => imgs.dig,
// Instruments // Instruments
"common.abilities.music.bass" => imgs.instrument, "common.abilities.music.bass" => imgs.instrument,
"common.abilities.music.flute" => imgs.instrument, "common.abilities.music.flute" => imgs.instrument,

View File

@ -603,7 +603,9 @@ impl PlayState for SessionState {
.get(player_entity) .get(player_entity)
.and_then(|inv| inv.equipped(EquipSlot::ActiveMainhand)) .and_then(|inv| inv.equipped(EquipSlot::ActiveMainhand))
.and_then(|item| item.tool_info()) .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); && client.is_wielding() == Some(true);
// Check to see whether we're aiming at anything // Check to see whether we're aiming at anything