From 93bea033d9778934b417232b2ba97e9e63ce5223 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Fri, 20 Mar 2020 01:27:54 -0400 Subject: [PATCH 1/3] axe, hammer proper wields --- voxygen/src/anim/character/attack.rs | 1 + voxygen/src/anim/character/mod.rs | 2 + voxygen/src/anim/character/stand.rs | 2 +- voxygen/src/anim/character/wield.rs | 70 ++++++++++++++-------------- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index dea9736ebe..dd853fda44 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -61,6 +61,7 @@ impl Animation for AttackAnimation { * Quaternion::rotation_y(decel * 0.08); next.shorts.scale = Vec3::one(); + match active_tool_kind { //TODO: Inventory Some(ToolKind::Sword(_)) => { diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 0fe9e9ac1a..c4560db4cb 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -120,6 +120,7 @@ pub struct SkeletonAttr { neck_right: f32, weapon_x: f32, weapon_y: f32, + } impl SkeletonAttr { pub fn calculate_scale(body: &comp::humanoid::Body) -> f32 { @@ -151,6 +152,7 @@ impl Default for SkeletonAttr { neck_right: 1.0, weapon_x: 1.0, weapon_y: 1.0, + } } } diff --git a/voxygen/src/anim/character/stand.rs b/voxygen/src/anim/character/stand.rs index c66afb21b4..ab2d67fea7 100644 --- a/voxygen/src/anim/character/stand.rs +++ b/voxygen/src/anim/character/stand.rs @@ -86,7 +86,7 @@ impl Animation for StandAnimation { next.main.offset = Vec3::new( -7.0 + skeleton_attr.weapon_x, -5.0 + skeleton_attr.weapon_y, - 18.0, + 15.0, ); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/wield.rs b/voxygen/src/anim/character/wield.rs index 05cfaafdc6..f52587ae84 100644 --- a/voxygen/src/anim/character/wield.rs +++ b/voxygen/src/anim/character/wield.rs @@ -19,7 +19,7 @@ impl Animation for WieldAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin(); + let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); let wave = (anim_time as f32 * 1.0).sin(); @@ -45,44 +45,42 @@ impl Animation for WieldAnimation { next.control.scale = Vec3::one(); }, 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; - next.r_hand.offset = Vec3::new(-3.0, 6.5, 6.0); - next.r_hand.ori = Quaternion::rotation_x(0.13) - * Quaternion::rotation_z(2.98) - * Quaternion::rotation_y(-0.50); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -5.0 + skeleton_attr.weapon_x, - 8.5 + skeleton_attr.weapon_y, - -0.5, - ); - next.main.ori = Quaternion::rotation_x(1.70) - * Quaternion::rotation_y(-0.25) - * Quaternion::rotation_z(0.0); + next.l_hand.offset = Vec3::new(-4.0, 3.0, 6.0); + next.l_hand.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(3.14 - 0.3) * Quaternion::rotation_y(-0.8); + next.l_hand.scale = Vec3::one() * 1.08; + next.r_hand.offset = Vec3::new(-2.5, 9.0, 4.0); + next.r_hand.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(3.14 - 0.3)* Quaternion::rotation_y(-0.8); + next.r_hand.scale = Vec3::one() * 1.06; + next.main.offset = Vec3::new(-6.0, 10.0, -1.0); + next.main.ori = Quaternion::rotation_x(1.27) + * Quaternion::rotation_y(-0.3) + * Quaternion::rotation_z(-0.8); next.main.scale = Vec3::one(); + + next.control.offset = Vec3::new(0.0, 0.0, 0.0); + next.control.ori = Quaternion::rotation_x( wave_ultra_slow_cos * 0.1) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z( wave_ultra_slow * 0.1); + next.control.scale = Vec3::one(); }, 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) - * Quaternion::rotation_z(0.0); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new(7.0, 2.5, -1.25); - next.r_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - 5.0 + skeleton_attr.weapon_x, - 8.75 + skeleton_attr.weapon_y, - -2.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(-1.27) - * Quaternion::rotation_z(wave * -0.25); + next.l_hand.offset = Vec3::new(-7.0, 4.6, 7.5); + next.l_hand.ori = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(0.32); + next.l_hand.scale = Vec3::one() * 1.08; + next.r_hand.offset = Vec3::new(8.0, 5.75, 4.0); + next.r_hand.ori = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(0.22); + next.r_hand.scale = Vec3::one() * 1.06; + next.main.offset = Vec3::new(6.0, 7.0, 0.0); + next.main.ori = Quaternion::rotation_x(0.3) + * Quaternion::rotation_y(-1.35) + * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one(); + + next.control.offset = Vec3::new(0.0, 0.0, 0.0); + next.control.ori = Quaternion::rotation_x(wave_ultra_slow * 0.15) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(wave_ultra_slow_cos * 0.08); + next.control.scale = Vec3::one(); }, Some(ToolKind::Staff(_)) => { next.l_hand.offset = Vec3::new( @@ -196,7 +194,7 @@ impl Animation for WieldAnimation { _ => {}, } - next.torso.offset = Vec3::new(0.0, 0.0 + wave * -0.08, 0.1) * skeleton_attr.scaler; + next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; From 50e96efe6bb6d3bbcb2ecb53a2a88b5ecef8703f Mon Sep 17 00:00:00 2001 From: jshipsey Date: Fri, 20 Mar 2020 02:38:53 -0400 Subject: [PATCH 2/3] hammer go smash --- voxygen/src/anim/character/attack.rs | 45 ++++++++++++++-------------- voxygen/src/anim/character/mod.rs | 2 -- voxygen/src/anim/character/wield.rs | 12 +++++--- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index dd853fda44..b866629bbf 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -23,6 +23,8 @@ impl Animation for AttackAnimation { let mut next = (*skeleton).clone(); let lab = 1.0; + let test = (anim_time as f32 * 16.0 * lab as f32).cos(); + let accel_med = 1.0 - (anim_time as f32 * 16.0 * lab as f32).cos(); let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos(); let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos(); @@ -32,6 +34,10 @@ impl Animation for AttackAnimation { / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 12.4).sin()).powf(2.0 as f32))) .sqrt()) * ((anim_time as f32 * lab as f32 * 12.4).sin()); + let slower = (((5.0) + / (0.1 + 4.9 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 4.0).sin()); next.head.offset = Vec3::new( 0.0 + skeleton_attr.neck_right, @@ -61,7 +67,6 @@ impl Animation for AttackAnimation { * Quaternion::rotation_y(decel * 0.08); next.shorts.scale = Vec3::one(); - match active_tool_kind { //TODO: Inventory Some(ToolKind::Sword(_)) => { @@ -109,29 +114,23 @@ impl Animation for AttackAnimation { next.main.scale = Vec3::one(); }, 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) - * Quaternion::rotation_x(0.0 + accel_med * -0.8) - * Quaternion::rotation_y(0.0 + accel_med * -0.4); - next.l_hand.scale = Vec3::one() * 1.01; - - next.r_hand.offset = - Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0); - next.r_hand.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + accel_med * -0.8) - * Quaternion::rotation_y(0.0 + accel_med * -0.4); - next.r_hand.scale = Vec3::one() * 1.01; - - next.main.offset = Vec3::new( - -8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x, - 8.0 + accel_fast * 3.0, - 0.0, - ); - next.main.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + accel_med * -0.8) - * Quaternion::rotation_y(0.0 + accel_med * -0.4); + next.l_hand.offset = Vec3::new(0.0, 1.0, 5.0); + next.l_hand.ori = Quaternion::rotation_x(1.27); + next.l_hand.scale = Vec3::one() * 1.04; + next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0); + next.r_hand.ori = Quaternion::rotation_x(1.27); + next.r_hand.scale = Vec3::one() * 1.05; + next.main.offset = Vec3::new(0.0, 6.0, -1.0); + next.main.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); next.main.scale = Vec3::one(); + + next.control.offset = Vec3::new(-6.0, 3.0, 5.0 + slower * 5.0); + next.control.ori = Quaternion::rotation_x(-0.2 + slower * 2.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(1.4 + 1.57); + next.control.scale = Vec3::one(); }, Some(ToolKind::Staff(_)) => { next.l_hand.offset = diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index c4560db4cb..0fe9e9ac1a 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -120,7 +120,6 @@ pub struct SkeletonAttr { neck_right: f32, weapon_x: f32, weapon_y: f32, - } impl SkeletonAttr { pub fn calculate_scale(body: &comp::humanoid::Body) -> f32 { @@ -152,7 +151,6 @@ impl Default for SkeletonAttr { neck_right: 1.0, weapon_x: 1.0, weapon_y: 1.0, - } } } diff --git a/voxygen/src/anim/character/wield.rs b/voxygen/src/anim/character/wield.rs index f52587ae84..713061f0bc 100644 --- a/voxygen/src/anim/character/wield.rs +++ b/voxygen/src/anim/character/wield.rs @@ -46,10 +46,14 @@ impl Animation for WieldAnimation { }, Some(ToolKind::Axe(_)) => { next.l_hand.offset = Vec3::new(-4.0, 3.0, 6.0); - next.l_hand.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(3.14 - 0.3) * Quaternion::rotation_y(-0.8); + next.l_hand.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_z(3.14 - 0.3) + * Quaternion::rotation_y(-0.8); next.l_hand.scale = Vec3::one() * 1.08; next.r_hand.offset = Vec3::new(-2.5, 9.0, 4.0); - next.r_hand.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(3.14 - 0.3)* Quaternion::rotation_y(-0.8); + next.r_hand.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_z(3.14 - 0.3) + * Quaternion::rotation_y(-0.8); next.r_hand.scale = Vec3::one() * 1.06; next.main.offset = Vec3::new(-6.0, 10.0, -1.0); next.main.ori = Quaternion::rotation_x(1.27) @@ -58,9 +62,9 @@ impl Animation for WieldAnimation { next.main.scale = Vec3::one(); next.control.offset = Vec3::new(0.0, 0.0, 0.0); - next.control.ori = Quaternion::rotation_x( wave_ultra_slow_cos * 0.1) + next.control.ori = Quaternion::rotation_x(wave_ultra_slow_cos * 0.1) * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z( wave_ultra_slow * 0.1); + * Quaternion::rotation_z(wave_ultra_slow * 0.1); next.control.scale = Vec3::one(); }, Some(ToolKind::Hammer(_)) => { From 835f3f5fe33c2a3ca8e5000be3df9dab54846072 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 20 Mar 2020 11:25:53 +0100 Subject: [PATCH 3/3] Arrows shouldn't turn into loot, staff shoots fireballs again --- common/src/comp/inventory/item.rs | 30 +++++++++++--- server/src/events/entity_manipulation.rs | 52 +++++++++++++----------- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/common/src/comp/inventory/item.rs b/common/src/comp/inventory/item.rs index 6f522eb094..6392756d71 100644 --- a/common/src/comp/inventory/item.rs +++ b/common/src/comp/inventory/item.rs @@ -114,11 +114,31 @@ impl ToolData { recover_duration: Duration::from_millis(400), base_damage: 5, }], - Staff(_) => vec![BasicMelee { - buildup_duration: Duration::from_millis(400), - recover_duration: Duration::from_millis(300), - base_damage: 7, - }], + Staff(_) => vec![ + BasicMelee { + buildup_duration: Duration::from_millis(400), + recover_duration: Duration::from_millis(300), + base_damage: 7, + }, + BasicRanged { + projectile: Projectile { + hit_ground: vec![projectile::Effect::Vanish], + hit_wall: vec![projectile::Effect::Vanish], + hit_entity: vec![ + projectile::Effect::Damage(HealthChange { + // TODO: This should not be fixed (?) + amount: -8, + cause: HealthSource::Item, + }), + projectile::Effect::Vanish, + ], + time_left: Duration::from_secs(5), + owner: None, + }, + projectile_body: Body::Object(object::Body::BoltFire), + recover_duration: Duration::from_millis(800), + }, + ], Shield(_) => vec![BasicBlock], Debug(kind) => match kind { DebugKind::Boost => vec![ diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 29c9c606e5..1de8f83dd7 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -91,29 +91,35 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc .write_storage::() .insert(entity, comp::CharacterState::default()); } else { - // Replace npc with loot - let _ = state - .ecs() - .write_storage() - .insert(entity, Body::Object(object::Body::Pouch)); - let _ = state.ecs().write_storage().insert( - entity, - assets::load_expect_cloned::("common.items.cheese"), - ); - state.ecs().write_storage::().remove(entity); - state.ecs().write_storage::().remove(entity); - state - .ecs() - .write_storage::() - .remove(entity); - state - .ecs() - .write_storage::() - .remove(entity); - state - .ecs() - .write_storage::() - .remove(entity); + if state.ecs().read_storage::().contains(entity) { + // Replace npc with loot + let _ = state + .ecs() + .write_storage() + .insert(entity, Body::Object(object::Body::Pouch)); + let _ = state.ecs().write_storage().insert( + entity, + assets::load_expect_cloned::("common.items.cheese"), + ); + state.ecs().write_storage::().remove(entity); + state.ecs().write_storage::().remove(entity); + state + .ecs() + .write_storage::() + .remove(entity); + state + .ecs() + .write_storage::() + .remove(entity); + state + .ecs() + .write_storage::() + .remove(entity); + } else { + if let Err(err) = state.delete_entity_recorded(entity) { + error!("Failed to delete destroyed entity: {:?}", err); + } + } // TODO: Add Delete(time_left: Duration) component /*