Merge branch 'juliancoffee/broom-tweak-v2' into 'master'

Made broom even better

See merge request veloren/veloren!4365
This commit is contained in:
Illia Denysenko 2024-03-06 01:07:25 +00:00
commit 4e4c35f936
3 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,7 @@ use crate::{
consts::WATER_DENSITY,
terrain::Block,
uid::Uid,
util::Dir,
};
use hashbrown::HashMap;
use serde::{Deserialize, Serialize};
@ -25,6 +26,8 @@ pub struct Vel(pub Vec3<f32>);
impl Vel {
pub fn zero() -> Self { Vel(Vec3::zero()) }
pub fn to_dir(&self) -> Dir { Dir::from_unnormalized(self.0).unwrap_or_default() }
}
impl Component for Vel {

View File

@ -31,8 +31,8 @@ impl CharacterBehavior for Data {
fn behavior(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_orientation(data, &mut update, 10.0, None);
handle_move(data, &mut update, 1.0);
handle_orientation(data, &mut update, 10.0, None);
if self.timer < self.static_data.movement_duration {
// Movement
@ -40,6 +40,8 @@ impl CharacterBehavior for Data {
update.vel.0.z += self.static_data.speed * data.dt.0;
} else {
update.vel.0 += *data.inputs.look_dir * self.static_data.speed * data.dt.0;
let dir = Some(update.vel.to_dir());
handle_orientation(data, &mut update, 10.0, dir);
}
update.character = CharacterState::Boost(Data {
timer: tick_attack_or_default(data, self.timer, None),

View File

@ -949,8 +949,10 @@ impl ParticleMgr {
Duration::from_millis(250),
time,
ParticleMode::PortalFizz,
// Output particles from broom, not from character ass
interpolated.pos
+ vel.map_or(Vec3::zero(), |v| -v.0 * dt * rng.gen::<f32>()),
- ori.to_horizontal().look_dir().to_vec()
- vel.map_or(Vec3::zero(), |v| v.0 * dt * rng.gen::<f32>()),
)
},
);