mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add support for different models per weapon type
This commit is contained in:
parent
431974cf8e
commit
4741e41230
@ -5,7 +5,7 @@ Item(
|
||||
Power: 20",
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Hammer,
|
||||
kind: Hammer(BasicHammer),
|
||||
equip_time_millis: 1000,
|
||||
)
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ Item(
|
||||
description: "Legends tell this item is useless.",
|
||||
kind: Tool (
|
||||
ToolData (
|
||||
kind: Shield,
|
||||
kind: Shield(BasicShield),
|
||||
equip_time_millis: 400,
|
||||
)
|
||||
),
|
||||
|
@ -5,7 +5,7 @@ Item(
|
||||
Power: 6",
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Staff,
|
||||
kind: Staff(BasicStaff),
|
||||
equip_time_millis: 800,
|
||||
)
|
||||
),
|
||||
|
@ -5,7 +5,7 @@ Item(
|
||||
Power: 15",
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Axe,
|
||||
kind: Axe(BasicAxe),
|
||||
equip_time_millis: 1000,
|
||||
)
|
||||
),
|
||||
|
@ -5,7 +5,7 @@ Item(
|
||||
Power: 15",
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Bow,
|
||||
kind: Bow(BasicBow),
|
||||
equip_time_millis: 800,
|
||||
)
|
||||
),
|
||||
|
@ -4,7 +4,7 @@ Item(
|
||||
Power: 15",
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Dagger,
|
||||
kind: Dagger(BasicDagger),
|
||||
equip_time_millis: 300,
|
||||
)
|
||||
),
|
||||
|
@ -5,7 +5,7 @@ Item(
|
||||
Power: 15",
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Hammer,
|
||||
kind: Hammer(BasicHammer),
|
||||
equip_time_millis: 1000,
|
||||
)
|
||||
),
|
||||
|
@ -5,12 +5,8 @@ Item(
|
||||
Power: 20",
|
||||
kind: Tool(
|
||||
ToolData (
|
||||
kind: Staff,
|
||||
kind: Staff(BasicHammer),
|
||||
equip_time_millis: 800,
|
||||
attack_buildup_millis: 400,
|
||||
attack_recover_millis: 300,
|
||||
range: 3,
|
||||
base_damage: 10,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
@ -3,11 +3,11 @@
|
||||
// VoxTrans(specifier, offset, (x_rot, y_rot, z_rot), zoom)
|
||||
({
|
||||
// Weapons
|
||||
Tool(Bow): VoxTrans(
|
||||
Tool(Bow(BasicBow)): VoxTrans(
|
||||
"voxel.weapon.bow.simple-bow",
|
||||
(0.0, 0.0, 0.0), (90.0, 90.0, 0.0), 1.0,
|
||||
),
|
||||
Tool(Dagger): VoxTrans(
|
||||
Tool(Dagger(BasicDagger)): VoxTrans(
|
||||
"voxel.weapon.dagger.dagger_rusty",
|
||||
(0.0, 0.0, -4.0), (-120.0, 90.0, 0.0), 1.1,
|
||||
),
|
||||
@ -15,19 +15,19 @@
|
||||
"voxel.weapon.sword.rusty_2h",
|
||||
(0.0, 9.0, 0.0), (-90.0, 90.0, 0.0), 2.4,
|
||||
),
|
||||
Tool(Axe): VoxTrans(
|
||||
Tool(Axe(BasicAxe)): VoxTrans(
|
||||
"voxel.weapon.axe.rusty_2h",
|
||||
(0.0, -8.0, 0.0), (-90.0, 90.0, 0.0), 2.0,
|
||||
),
|
||||
Tool(Hammer): VoxTrans(
|
||||
Tool(Hammer(BasicHammer)): VoxTrans(
|
||||
"voxel.weapon.hammer.rusty_2h",
|
||||
(0.0, -8.0, 0.0), (-90.0, 90.0, 0.0), 2.0,
|
||||
),
|
||||
Tool(Staff): VoxTrans(
|
||||
Tool(Staff(BasicStaff)): VoxTrans(
|
||||
"voxel.weapon.staff.wood-fire",
|
||||
(0.0, -9.0, 0.0), (90.0, 90.0, 0.0), 2.5,
|
||||
),
|
||||
Tool(Shield): VoxTrans(
|
||||
Tool(Shield(BasicShield)): VoxTrans(
|
||||
"voxel.weapon.shield.wood-0",
|
||||
(0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 2.4,
|
||||
),
|
||||
|
42
assets/voxygen/voxel/humanoid_main_weapon_manifest.ron
Normal file
42
assets/voxygen/voxel/humanoid_main_weapon_manifest.ron
Normal file
@ -0,0 +1,42 @@
|
||||
({
|
||||
Sword(Scimitar): (
|
||||
vox_spec: ("weapon.sword.rusty_2h", (-1.5, -6.5, -4.0)),
|
||||
color: None
|
||||
),
|
||||
Sword(Rapier): (
|
||||
vox_spec: ("weapon.sword.rusty_2h", (-1.5, -6.5, -4.0)),
|
||||
color: None
|
||||
),
|
||||
Axe(BasicAxe): (
|
||||
vox_spec: ("weapon.axe.rusty_2h", (-1.5, -5.0, -4.0)),
|
||||
color: None
|
||||
),
|
||||
Hammer(BasicHammer): (
|
||||
vox_spec: ("weapon.hammer.rusty_2h", (-2.5, -5.5, -4.0)),
|
||||
color: None
|
||||
),
|
||||
Dagger(BasicDagger): (
|
||||
vox_spec: ("weapon.hammer.rusty_2h", (-2.5, -5.5, -4.0)), // TODO
|
||||
color: None
|
||||
),
|
||||
Shield(BasicShield): (
|
||||
vox_spec: ("weapon.shield.wood-0", (-2.5, -6.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Bow(BasicBow): (
|
||||
vox_spec: ("weapon.bow.simple-bow", (-1.0, -6.0, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Staff(BasicStaff): (
|
||||
vox_spec: ("weapon.staff.wood-fire", (-1.0, -6.0, -3.0)),
|
||||
color: None
|
||||
),
|
||||
Debug(Boost): (
|
||||
vox_spec: ("weapon.debug_wand", (-1.5, -9.5, -4.0)),
|
||||
color: None
|
||||
),
|
||||
Debug(Possess): (
|
||||
vox_spec: ("weapon.debug_wand", (-1.5, -9.5, -4.0)),
|
||||
color: None
|
||||
),
|
||||
})
|
@ -7,7 +7,6 @@ use crate::{
|
||||
effect::Effect,
|
||||
terrain::{Block, BlockKind},
|
||||
};
|
||||
//use rand::prelude::*;
|
||||
use rand::seq::SliceRandom;
|
||||
use specs::{Component, FlaggedStorage};
|
||||
use specs_idvs::IDVStorage;
|
||||
@ -18,16 +17,40 @@ pub enum SwordKind {
|
||||
Scimitar,
|
||||
Rapier,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum AxeKind {
|
||||
BasicAxe,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum HammerKind {
|
||||
BasicHammer,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum BowKind {
|
||||
BasicBow,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum DaggerKind {
|
||||
BasicDagger,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum StaffKind {
|
||||
BasicStaff,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum ShieldKind {
|
||||
BasicShield,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum ToolKind {
|
||||
Sword(SwordKind),
|
||||
Axe,
|
||||
Hammer,
|
||||
Bow,
|
||||
Dagger,
|
||||
Staff,
|
||||
Shield,
|
||||
Axe(AxeKind),
|
||||
Hammer(HammerKind),
|
||||
Bow(BowKind),
|
||||
Dagger(DaggerKind),
|
||||
Staff(StaffKind),
|
||||
Shield(ShieldKind),
|
||||
Debug(DebugKind),
|
||||
/// This is an placeholder item, it is used by non-humanoid npcs to attack
|
||||
Empty,
|
||||
@ -54,17 +77,17 @@ impl ToolData {
|
||||
base_damage: 20,
|
||||
},
|
||||
],
|
||||
Axe => vec![BasicMelee {
|
||||
Axe(_) => vec![BasicMelee {
|
||||
buildup_duration: Duration::from_millis(700),
|
||||
recover_duration: Duration::from_millis(100),
|
||||
base_damage: 8,
|
||||
}],
|
||||
Hammer => vec![BasicMelee {
|
||||
Hammer(_) => vec![BasicMelee {
|
||||
buildup_duration: Duration::from_millis(700),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
base_damage: 10,
|
||||
}],
|
||||
Bow => vec![BasicRanged {
|
||||
Bow(_) => vec![BasicRanged {
|
||||
projectile: Projectile {
|
||||
hit_ground: vec![projectile::Effect::Stick],
|
||||
hit_wall: vec![projectile::Effect::Stick],
|
||||
@ -82,17 +105,17 @@ impl ToolData {
|
||||
projectile_body: Body::Object(object::Body::Arrow),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
}],
|
||||
Dagger => vec![BasicMelee {
|
||||
Dagger(_) => vec![BasicMelee {
|
||||
buildup_duration: Duration::from_millis(100),
|
||||
recover_duration: Duration::from_millis(400),
|
||||
base_damage: 5,
|
||||
}],
|
||||
Staff => vec![BasicMelee {
|
||||
Staff(_) => vec![BasicMelee {
|
||||
buildup_duration: Duration::from_millis(400),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
base_damage: 7,
|
||||
}],
|
||||
Shield => vec![BasicBlock],
|
||||
Shield(_) => vec![BasicBlock],
|
||||
Debug(kind) => match kind {
|
||||
DebugKind::Boost => vec![
|
||||
CharacterAbility::Boost {
|
||||
|
@ -161,6 +161,8 @@ impl<'a> System<'a> for Sys {
|
||||
.copied()
|
||||
.unwrap_or(Alignment::Owned(*target)),
|
||||
) {
|
||||
inputs.look_dir = tgt_pos.0 - pos.0;
|
||||
|
||||
// Don't attack entities we are passive towards
|
||||
// TODO: This is here, it's a bit of a hack
|
||||
if let Some(alignment) = alignment {
|
||||
@ -174,7 +176,6 @@ impl<'a> System<'a> for Sys {
|
||||
let dist_sqrd = pos.0.distance_squared(tgt_pos.0);
|
||||
if dist_sqrd < MIN_ATTACK_DIST.powf(2.0) {
|
||||
// Close-range attack
|
||||
inputs.look_dir = tgt_pos.0 - pos.0;
|
||||
inputs.move_dir = Vec2::from(tgt_pos.0 - pos.0)
|
||||
.try_normalized()
|
||||
.unwrap_or(Vec2::unit_y())
|
||||
|
@ -82,7 +82,7 @@ impl Animation for AttackAnimation {
|
||||
* Quaternion::rotation_z(1.4 + slow * 0.5);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Axe) => {
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
next.l_hand.offset =
|
||||
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_z(-0.8)
|
||||
@ -107,7 +107,7 @@ impl Animation for AttackAnimation {
|
||||
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer) => {
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset =
|
||||
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_z(-0.8)
|
||||
@ -132,7 +132,7 @@ impl Animation for AttackAnimation {
|
||||
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff) => {
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset =
|
||||
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_z(-0.8)
|
||||
@ -157,7 +157,7 @@ impl Animation for AttackAnimation {
|
||||
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.l_hand.offset =
|
||||
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_z(-0.8)
|
||||
@ -182,7 +182,7 @@ impl Animation for AttackAnimation {
|
||||
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
Some(ToolKind::Bow(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-7.0, -2.0 + slow * 5.0, -1.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(PI / 2.0)
|
||||
* Quaternion::rotation_y(-0.3)
|
||||
@ -203,7 +203,7 @@ impl Animation for AttackAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Dagger) => {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.l_hand.offset =
|
||||
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_z(-0.8)
|
||||
|
@ -81,7 +81,7 @@ impl Animation for BlockAnimation {
|
||||
* Quaternion::rotation_z(-1.57);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Axe) => {
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -106,7 +106,7 @@ impl Animation for BlockAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer) => {
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-7.0, 3.5, 6.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(2.07)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
@ -127,7 +127,7 @@ impl Animation for BlockAnimation {
|
||||
* Quaternion::rotation_z(-0.85);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff) => {
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -152,7 +152,7 @@ impl Animation for BlockAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -177,7 +177,7 @@ impl Animation for BlockAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
Some(ToolKind::Bow(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -202,7 +202,7 @@ impl Animation for BlockAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Dagger) => {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
|
@ -80,7 +80,7 @@ impl Animation for BlockIdleAnimation {
|
||||
* Quaternion::rotation_z(-1.57);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Axe) => {
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -105,7 +105,7 @@ impl Animation for BlockIdleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer) => {
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-7.0, 3.5 + wave_ultra_slow * 2.0, 6.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(2.07)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
@ -126,7 +126,7 @@ impl Animation for BlockIdleAnimation {
|
||||
* Quaternion::rotation_z(-0.85);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff) => {
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -151,7 +151,7 @@ impl Animation for BlockIdleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -176,7 +176,7 @@ impl Animation for BlockIdleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
Some(ToolKind::Bow(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -201,7 +201,7 @@ impl Animation for BlockIdleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Dagger) => {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
|
@ -81,7 +81,7 @@ impl Animation for CidleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Axe) => {
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.5 + wave_ultra_slow_cos * 1.0,
|
||||
-0.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -108,7 +108,7 @@ impl Animation for CidleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer) => {
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-7.0, 4.0, 3.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27 + wave_ultra_slow * -0.1)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
@ -129,7 +129,7 @@ impl Animation for CidleAnimation {
|
||||
* Quaternion::rotation_z(wave_ultra_slow * 0.2);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff) => {
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
1.0 + wave_ultra_slow_cos * 0.5,
|
||||
@ -154,7 +154,7 @@ impl Animation for CidleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
@ -179,7 +179,7 @@ impl Animation for CidleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
Some(ToolKind::Bow(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-1.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.0 + wave_ultra_slow_cos * 0.5,
|
||||
@ -208,7 +208,7 @@ impl Animation for CidleAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Dagger) => {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
3.5 + wave_ultra_slow_cos * 0.5,
|
||||
|
@ -227,25 +227,25 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
|
||||
(Danari, Male) => 0.0,
|
||||
(Danari, Female) => 0.0,
|
||||
},
|
||||
weapon_x: match ToolKind::Hammer {
|
||||
weapon_x: match ToolKind::Empty {
|
||||
ToolKind::Sword(_) => 0.0,
|
||||
ToolKind::Axe => 3.0,
|
||||
ToolKind::Hammer => 0.0,
|
||||
ToolKind::Shield => 3.0,
|
||||
ToolKind::Staff => 3.0,
|
||||
ToolKind::Bow => 0.0,
|
||||
ToolKind::Dagger => 0.0,
|
||||
ToolKind::Axe(_) => 3.0,
|
||||
ToolKind::Hammer(_) => 0.0,
|
||||
ToolKind::Shield(_) => 3.0,
|
||||
ToolKind::Staff(_) => 3.0,
|
||||
ToolKind::Bow(_) => 0.0,
|
||||
ToolKind::Dagger(_) => 0.0,
|
||||
ToolKind::Debug(_) => 0.0,
|
||||
ToolKind::Empty => 0.0,
|
||||
},
|
||||
weapon_y: match ToolKind::Hammer {
|
||||
weapon_y: match ToolKind::Empty {
|
||||
ToolKind::Sword(_) => -1.25,
|
||||
ToolKind::Axe => 0.0,
|
||||
ToolKind::Hammer => -2.0,
|
||||
ToolKind::Shield => 0.0,
|
||||
ToolKind::Staff => 0.0,
|
||||
ToolKind::Bow => -2.0,
|
||||
ToolKind::Dagger => -2.0,
|
||||
ToolKind::Axe(_) => 0.0,
|
||||
ToolKind::Hammer(_) => -2.0,
|
||||
ToolKind::Shield(_) => 0.0,
|
||||
ToolKind::Staff(_) => 0.0,
|
||||
ToolKind::Bow(_) => -2.0,
|
||||
ToolKind::Dagger(_) => -2.0,
|
||||
ToolKind::Debug(_) => 0.0,
|
||||
ToolKind::Empty => 0.0,
|
||||
},
|
||||
|
@ -44,7 +44,7 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Axe) => {
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-6.5, -0.5, 6.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.13) * Quaternion::rotation_z(-0.25);
|
||||
next.l_hand.scale = Vec3::one() * 1.01;
|
||||
@ -63,7 +63,7 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer) => {
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-7.0, 4.0, 3.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
@ -84,7 +84,7 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(wave * -0.25);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff) => {
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||
1.0 + wave_ultra_slow_cos * 0.5,
|
||||
@ -109,7 +109,7 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||
next.l_hand.scale = Vec3::one() * 1.01;
|
||||
@ -126,7 +126,7 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
Some(ToolKind::Bow(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-1.0 - wave_ultra_slow_cos * 1.0,
|
||||
3.0 + wave_ultra_slow_cos * 0.5,
|
||||
@ -155,7 +155,7 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Dagger) => {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||
next.l_hand.scale = Vec3::one() * 1.01;
|
||||
|
@ -166,27 +166,27 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
|
||||
(Danari, Male) => 0.0,
|
||||
(Danari, Female) => 0.0,
|
||||
},
|
||||
weapon_x: match ToolKind::Hammer {
|
||||
weapon_x: match ToolKind::Empty {
|
||||
// TODO: Inventory
|
||||
ToolKind::Sword(_) => 0.0,
|
||||
ToolKind::Axe => 3.0,
|
||||
ToolKind::Hammer => 0.0,
|
||||
ToolKind::Shield => 3.0,
|
||||
ToolKind::Staff => 3.0,
|
||||
ToolKind::Bow => 0.0,
|
||||
ToolKind::Dagger => 0.0,
|
||||
ToolKind::Axe(_) => 3.0,
|
||||
ToolKind::Hammer(_) => 0.0,
|
||||
ToolKind::Shield(_) => 3.0,
|
||||
ToolKind::Staff(_) => 3.0,
|
||||
ToolKind::Bow(_) => 0.0,
|
||||
ToolKind::Dagger(_) => 0.0,
|
||||
ToolKind::Debug(_) => 0.0,
|
||||
ToolKind::Empty => 0.0,
|
||||
},
|
||||
weapon_y: match ToolKind::Hammer {
|
||||
weapon_y: match ToolKind::Empty {
|
||||
// TODO: Inventory
|
||||
ToolKind::Sword(_) => -1.25,
|
||||
ToolKind::Axe => 0.0,
|
||||
ToolKind::Hammer => -2.0,
|
||||
ToolKind::Shield => 0.0,
|
||||
ToolKind::Staff => 0.0,
|
||||
ToolKind::Bow => -2.0,
|
||||
ToolKind::Dagger => -2.0,
|
||||
ToolKind::Axe(_) => 0.0,
|
||||
ToolKind::Hammer(_) => -2.0,
|
||||
ToolKind::Shield(_) => 0.0,
|
||||
ToolKind::Staff(_) => 0.0,
|
||||
ToolKind::Bow(_) => -2.0,
|
||||
ToolKind::Dagger(_) => -2.0,
|
||||
ToolKind::Debug(_) => 0.0,
|
||||
ToolKind::Empty => 0.0,
|
||||
},
|
||||
|
@ -58,8 +58,8 @@ widget_ids! {
|
||||
hands_bg,
|
||||
pants_bg,
|
||||
belt_bg,
|
||||
ring-r_bg,
|
||||
ring-l_bg,
|
||||
ring_r_bg,
|
||||
ring_l_bg,
|
||||
foot_bg,
|
||||
back_bg,
|
||||
tabard_bg,
|
||||
|
@ -586,8 +586,8 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.color(
|
||||
match self.loadout.active_item.as_ref().map(|i| &i.item.kind) {
|
||||
Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
|
||||
ToolKind::Bow => Some(BG_COLOR_2),
|
||||
ToolKind::Staff => Some(BG_COLOR_2),
|
||||
ToolKind::Bow(_) => Some(BG_COLOR_2),
|
||||
ToolKind::Staff(_) => Some(BG_COLOR_2),
|
||||
_ => Some(BG_COLOR_2),
|
||||
},
|
||||
_ => Some(BG_COLOR_2),
|
||||
@ -599,10 +599,10 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
match self.loadout.active_item.as_ref().map(|i| &i.item.kind) {
|
||||
Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
|
||||
ToolKind::Sword(_) => self.imgs.twohsword_m1,
|
||||
ToolKind::Hammer => self.imgs.twohhammer_m1,
|
||||
ToolKind::Axe => self.imgs.twohaxe_m1,
|
||||
ToolKind::Bow => self.imgs.bow_m1,
|
||||
ToolKind::Staff => self.imgs.staff_m1,
|
||||
ToolKind::Hammer(_) => self.imgs.twohhammer_m1,
|
||||
ToolKind::Axe(_) => self.imgs.twohaxe_m1,
|
||||
ToolKind::Bow(_) => self.imgs.bow_m1,
|
||||
ToolKind::Staff(_) => self.imgs.staff_m1,
|
||||
ToolKind::Debug(DebugKind::Boost) => self.imgs.flyingrod_m1,
|
||||
_ => self.imgs.twohaxe_m1,
|
||||
},
|
||||
@ -612,8 +612,8 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.w(
|
||||
match self.loadout.active_item.as_ref().map(|i| &i.item.kind) {
|
||||
Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
|
||||
ToolKind::Bow => 30.0 * scale,
|
||||
ToolKind::Staff => 32.0 * scale,
|
||||
ToolKind::Bow(_) => 30.0 * scale,
|
||||
ToolKind::Staff(_) => 32.0 * scale,
|
||||
_ => 38.0 * scale,
|
||||
},
|
||||
_ => 38.0 * scale,
|
||||
@ -622,8 +622,8 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.h(
|
||||
match self.loadout.active_item.as_ref().map(|i| &i.item.kind) {
|
||||
Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
|
||||
ToolKind::Bow => 30.0 * scale,
|
||||
ToolKind::Staff => 32.0 * scale,
|
||||
ToolKind::Bow(_) => 30.0 * scale,
|
||||
ToolKind::Staff(_) => 32.0 * scale,
|
||||
_ => 38.0 * scale,
|
||||
},
|
||||
_ => 38.0 * scale,
|
||||
@ -687,8 +687,8 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.color(
|
||||
match self.loadout.active_item.as_ref().map(|i| &i.item.kind) {
|
||||
Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
|
||||
ToolKind::Bow => Some(BG_COLOR_2),
|
||||
ToolKind::Staff => Some(BG_COLOR_2),
|
||||
ToolKind::Bow(_) => Some(BG_COLOR_2),
|
||||
ToolKind::Staff(_) => Some(BG_COLOR_2),
|
||||
_ => Some(BG_COLOR_2),
|
||||
},
|
||||
_ => Some(BG_COLOR_2),
|
||||
@ -700,10 +700,10 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
match self.loadout.active_item.as_ref().map(|i| &i.item.kind) {
|
||||
Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
|
||||
ToolKind::Sword(_) => self.imgs.twohsword_m2,
|
||||
ToolKind::Hammer => self.imgs.twohhammer_m2,
|
||||
ToolKind::Axe => self.imgs.twohaxe_m2,
|
||||
ToolKind::Bow => self.imgs.bow_m2,
|
||||
ToolKind::Staff => self.imgs.staff_m2,
|
||||
ToolKind::Hammer(_) => self.imgs.twohhammer_m2,
|
||||
ToolKind::Axe(_) => self.imgs.twohaxe_m2,
|
||||
ToolKind::Bow(_) => self.imgs.bow_m2,
|
||||
ToolKind::Staff(_) => self.imgs.staff_m2,
|
||||
ToolKind::Debug(DebugKind::Boost) => self.imgs.flyingrod_m2,
|
||||
_ => self.imgs.twohaxe_m2,
|
||||
},
|
||||
@ -713,8 +713,8 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.w(
|
||||
match self.loadout.active_item.as_ref().map(|i| &i.item.kind) {
|
||||
Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
|
||||
ToolKind::Bow => 30.0 * scale,
|
||||
ToolKind::Staff => 30.0 * scale,
|
||||
ToolKind::Bow(_) => 30.0 * scale,
|
||||
ToolKind::Staff(_) => 30.0 * scale,
|
||||
_ => 38.0 * scale,
|
||||
},
|
||||
_ => 38.0 * scale,
|
||||
@ -723,8 +723,8 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.h(
|
||||
match self.loadout.active_item.as_ref().map(|i| &i.item.kind) {
|
||||
Some(ItemKind::Tool(ToolData { kind, .. })) => match kind {
|
||||
ToolKind::Bow => 30.0 * scale,
|
||||
ToolKind::Staff => 30.0 * scale,
|
||||
ToolKind::Bow(_) => 30.0 * scale,
|
||||
ToolKind::Staff(_) => 30.0 * scale,
|
||||
_ => 38.0 * scale,
|
||||
},
|
||||
_ => 38.0 * scale,
|
||||
|
@ -119,6 +119,8 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
HumArmorPantsSpec::load_watched(&mut self.manifest_indicator);
|
||||
let humanoid_armor_foot_spec =
|
||||
HumArmorFootSpec::load_watched(&mut self.manifest_indicator);
|
||||
let humanoid_main_weapon_spec =
|
||||
HumMainWeaponSpec::load_watched(&mut self.manifest_indicator);
|
||||
|
||||
// TODO: This is bad code, maybe this method should return Option<_>
|
||||
let default_loadout = Loadout::default();
|
||||
@ -213,7 +215,7 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
})
|
||||
.unwrap_or_default()
|
||||
{
|
||||
Some(mesh_main(
|
||||
Some(humanoid_main_weapon_spec.mesh_main_weapon(
|
||||
loadout.active_item.as_ref().map(|i| &i.item.kind),
|
||||
))
|
||||
} else {
|
||||
|
@ -243,6 +243,8 @@ pub struct HumArmorBeltSpec(HashMap<Belt, ArmorVoxSpec>);
|
||||
pub struct HumArmorPantsSpec(HashMap<Pants, ArmorVoxSpec>);
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct HumArmorFootSpec(HashMap<Foot, ArmorVoxSpec>);
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct HumMainWeaponSpec(HashMap<ToolKind, ArmorVoxSpec>);
|
||||
|
||||
impl Asset for HumArmorShoulderSpec {
|
||||
const ENDINGS: &'static [&'static str] = &["ron"];
|
||||
@ -286,6 +288,13 @@ impl Asset for HumArmorFootSpec {
|
||||
Ok(ron::de::from_reader(buf_reader).expect("Error parsing humanoid armor foot spec"))
|
||||
}
|
||||
}
|
||||
impl Asset for HumMainWeaponSpec {
|
||||
const ENDINGS: &'static [&'static str] = &["ron"];
|
||||
|
||||
fn parse(buf_reader: BufReader<File>) -> Result<Self, assets::Error> {
|
||||
Ok(ron::de::from_reader(buf_reader).expect("Error parsing humanoid main weapon spec"))
|
||||
}
|
||||
}
|
||||
|
||||
impl HumArmorShoulderSpec {
|
||||
pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> {
|
||||
@ -624,25 +633,29 @@ impl HumArmorFootSpec {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mesh_main(item_kind: Option<&ItemKind>) -> Mesh<FigurePipeline> {
|
||||
if let Some(item_kind) = item_kind {
|
||||
let (name, offset) = match item_kind {
|
||||
ItemKind::Tool(ToolData { kind, .. }) => match kind {
|
||||
ToolKind::Sword(_) => ("weapon.sword.rusty_2h", Vec3::new(-1.5, -6.5, -4.0)),
|
||||
ToolKind::Axe => ("weapon.axe.rusty_2h", Vec3::new(-1.5, -5.0, -4.0)),
|
||||
ToolKind::Hammer => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)),
|
||||
ToolKind::Dagger => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)),
|
||||
ToolKind::Shield => ("weapon.shield.wood-0", Vec3::new(-2.5, -6.5, -2.0)),
|
||||
ToolKind::Bow => ("weapon.bow.simple-bow", Vec3::new(-1.0, -6.0, -2.0)),
|
||||
ToolKind::Staff => ("weapon.staff.wood-fire", Vec3::new(-1.0, -6.0, -3.0)),
|
||||
ToolKind::Debug(_) => ("weapon.debug_wand", Vec3::new(-1.5, -9.5, -4.0)),
|
||||
ToolKind::Empty => return Mesh::new(),
|
||||
},
|
||||
_ => return Mesh::new(),
|
||||
impl HumMainWeaponSpec {
|
||||
pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> {
|
||||
assets::load_watched::<Self>("voxygen.voxel.humanoid_main_weapon_manifest", indicator)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_main_weapon(&self, item_kind: Option<&ItemKind>) -> Mesh<FigurePipeline> {
|
||||
let tool_kind = if let Some(ItemKind::Tool(ToolData { kind, .. })) = item_kind {
|
||||
kind
|
||||
} else {
|
||||
return Mesh::new();
|
||||
};
|
||||
load_mesh(name, offset)
|
||||
} else {
|
||||
Mesh::new()
|
||||
|
||||
let spec = match self.0.get(tool_kind) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!("No hand specification exists for {:?}", tool_kind);
|
||||
return load_mesh("not_found", Vec3::new(-1.5, -1.5, -7.0));
|
||||
},
|
||||
};
|
||||
|
||||
let tool_kind_segment = graceful_load_segment(&spec.vox_spec.0);
|
||||
generate_mesh(&tool_kind_segment, Vec3::from(spec.vox_spec.1))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user