From c16ec4393873272d15a6f16560b5eb53073ea06a Mon Sep 17 00:00:00 2001 From: Snowram Date: Sat, 24 Apr 2021 02:03:07 +0200 Subject: [PATCH] Body specific beam offsets --- CHANGELOG.md | 2 ++ common/src/comp/body.rs | 2 +- common/src/states/basic_beam.rs | 12 ++++++++---- voxygen/anim/src/bird_large/shoot.rs | 22 ++-------------------- voxygen/benches/meshing_benchmark.rs | 7 ++++++- voxygen/src/scene/figure/mod.rs | 3 --- 6 files changed, 19 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cb1304efb..b0aa14db29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Drag is now calculated based on physical properties - Terrain chunks are now deflate-compressed when sent over the network. - Missing translations can be displayed in English. +- New large birds npcs +- Day period dependant wildlife spawns ### Changed diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index d11aca639a..1fe48767b6 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -282,7 +282,7 @@ impl Body { }, Body::BipedSmall(_) => Vec3::new(1.0, 0.75, 1.4), Body::BirdMedium(_) => Vec3::new(2.0, 1.0, 1.1), - Body::BirdLarge(_) => Vec3::new(2.0, 5.5, 3.8), + Body::BirdLarge(_) => Vec3::new(2.0, 5.0, 2.4), Body::Dragon(_) => Vec3::new(16.0, 10.0, 16.0), Body::FishMedium(_) => Vec3::new(0.5, 2.0, 0.8), Body::FishSmall(_) => Vec3::new(0.3, 1.2, 0.6), diff --git a/common/src/states/basic_beam.rs b/common/src/states/basic_beam.rs index 766959470f..ca700bf91b 100644 --- a/common/src/states/basic_beam.rs +++ b/common/src/states/basic_beam.rs @@ -3,7 +3,7 @@ use crate::{ Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageSource, GroupTarget, }, - comp::{beam, CharacterState, EnergyChange, EnergySource, Ori, Pos, StateUpdate}, + comp::{beam, Body, CharacterState, EnergyChange, EnergySource, Ori, Pos, StateUpdate}, event::ServerEvent, states::{ behavior::{CharacterBehavior, JoinData}, @@ -136,11 +136,15 @@ impl CharacterBehavior for Data { owner: Some(*data.uid), specifier: self.static_data.specifier, }; + let body_offsets_z = match data.body { + Body::BirdLarge(_) => data.body.height() * 0.9, + _ => data.body.height() * 0.5, + }; // Gets offsets let body_offsets = Vec3::new( - (data.body.radius() + 0.2) * data.inputs.look_dir.x, - (data.body.radius() + 0.2) * data.inputs.look_dir.y, - data.body.eye_height() * 0.6, + (data.body.radius() + 1.0) * data.inputs.look_dir.x, + (data.body.radius() + 1.0) * data.inputs.look_dir.y, + body_offsets_z, ); let pos = Pos(data.pos.0 + body_offsets); // Create beam segment diff --git a/voxygen/anim/src/bird_large/shoot.rs b/voxygen/anim/src/bird_large/shoot.rs index cd56d3020b..23cd8c3f08 100644 --- a/voxygen/anim/src/bird_large/shoot.rs +++ b/voxygen/anim/src/bird_large/shoot.rs @@ -6,16 +6,7 @@ use common::{states::utils::StageSection, util::Dir}; pub struct ShootAnimation; -type ShootAnimationDependency = ( - f32, - f32, - Vec3, - Vec3, - Option, - f32, - Dir, - bool, -); +type ShootAnimationDependency = (f32, Option, f32, Dir, bool); impl Animation for ShootAnimation { type Dependency = ShootAnimationDependency; @@ -27,16 +18,7 @@ impl Animation for ShootAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_shoot")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - ( - _velocity, - global_time, - _orientation, - _last_ori, - stage_section, - timer, - look_dir, - on_ground, - ): Self::Dependency, + (global_time, stage_section, timer, look_dir, on_ground): Self::Dependency, anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, diff --git a/voxygen/benches/meshing_benchmark.rs b/voxygen/benches/meshing_benchmark.rs index 31f12a9215..a203913312 100644 --- a/voxygen/benches/meshing_benchmark.rs +++ b/voxygen/benches/meshing_benchmark.rs @@ -27,7 +27,12 @@ pub fn criterion_benchmark(c: &mut Criterion) { (0..GEN_SIZE) .flat_map(|x| (0..GEN_SIZE).map(move |y| Vec2::new(x, y))) .map(|offset| offset + CENTER) - .map(|pos| (pos, world.generate_chunk(index, pos, || false).unwrap())) + .map(|pos| { + ( + pos, + world.generate_chunk(index, pos, || false, None).unwrap(), + ) + }) .for_each(|(key, chunk)| { terrain.insert(key, Arc::new(chunk.0)); }); diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 9eb7f1b45f..ff3845c199 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -3441,10 +3441,7 @@ impl FigureMgr { anim::bird_large::ShootAnimation::update_skeleton( &target_base, ( - rel_vel.magnitude(), time, - ori * anim::vek::Vec3::::unit_y(), - state.last_ori * anim::vek::Vec3::::unit_y(), Some(s.stage_section), state.state_time, look_dir,