mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'juliancoffee/broom-tweak-v2' into 'master'
Made broom even better See merge request veloren/veloren!4365
This commit is contained in:
commit
4e4c35f936
@ -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 {
|
||||
|
@ -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),
|
||||
|
@ -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>()),
|
||||
)
|
||||
},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user