diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index dc293fbc6c..3e93926b3a 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -51,8 +51,7 @@ impl CharacterAbility { .is_ok() }, CharacterAbility::DashMelee { .. } => { - data.physics.on_ground - && !data.physics.in_fluid + !data.physics.in_fluid && update .energy .try_change_by(-300, EnergySource::Ability) @@ -122,6 +121,7 @@ impl From<&CharacterAbility> for CharacterState { recover_duration, base_damage, } => CharacterState::DashMelee(dash_melee::Data { + initialize: true, exhausted: false, buildup_duration: *buildup_duration, recover_duration: *recover_duration, diff --git a/common/src/states/dash_melee.rs b/common/src/states/dash_melee.rs index b72502d219..8697df41d6 100644 --- a/common/src/states/dash_melee.rs +++ b/common/src/states/dash_melee.rs @@ -18,6 +18,7 @@ pub struct Data { pub base_damage: u32, /// Whether the attack can deal more damage pub exhausted: bool, + pub initialize: bool, } impl CharacterBehavior for Data { @@ -32,6 +33,10 @@ impl CharacterBehavior for Data { server_events: VecDeque::new(), }; + if self.initialize { + update.vel.0 = data.inputs.look_dir * 20.0; + } + if self.buildup_duration != Duration::default() && data.physics.touch_entity.is_none() { // Build up (this will move you forward) update.vel.0 = Vec3::new(0.0, 0.0, update.vel.0.z) @@ -49,6 +54,7 @@ impl CharacterBehavior for Data { recover_duration: self.recover_duration, base_damage: self.base_damage, exhausted: false, + initialize: false, }); } else if !self.exhausted { // Hit attempt @@ -64,6 +70,7 @@ impl CharacterBehavior for Data { recover_duration: self.recover_duration, base_damage: self.base_damage, exhausted: true, + initialize: false, }); } else if self.recover_duration != Duration::default() { // Recovery @@ -75,6 +82,7 @@ impl CharacterBehavior for Data { .unwrap_or_default(), base_damage: self.base_damage, exhausted: true, + initialize: false, }); } else { // Done