mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Set dash direction based on look_dir
This commit is contained in:
@ -51,8 +51,7 @@ impl CharacterAbility {
|
|||||||
.is_ok()
|
.is_ok()
|
||||||
},
|
},
|
||||||
CharacterAbility::DashMelee { .. } => {
|
CharacterAbility::DashMelee { .. } => {
|
||||||
data.physics.on_ground
|
!data.physics.in_fluid
|
||||||
&& !data.physics.in_fluid
|
|
||||||
&& update
|
&& update
|
||||||
.energy
|
.energy
|
||||||
.try_change_by(-300, EnergySource::Ability)
|
.try_change_by(-300, EnergySource::Ability)
|
||||||
@ -122,6 +121,7 @@ impl From<&CharacterAbility> for CharacterState {
|
|||||||
recover_duration,
|
recover_duration,
|
||||||
base_damage,
|
base_damage,
|
||||||
} => CharacterState::DashMelee(dash_melee::Data {
|
} => CharacterState::DashMelee(dash_melee::Data {
|
||||||
|
initialize: true,
|
||||||
exhausted: false,
|
exhausted: false,
|
||||||
buildup_duration: *buildup_duration,
|
buildup_duration: *buildup_duration,
|
||||||
recover_duration: *recover_duration,
|
recover_duration: *recover_duration,
|
||||||
|
@ -18,6 +18,7 @@ pub struct Data {
|
|||||||
pub base_damage: u32,
|
pub base_damage: u32,
|
||||||
/// Whether the attack can deal more damage
|
/// Whether the attack can deal more damage
|
||||||
pub exhausted: bool,
|
pub exhausted: bool,
|
||||||
|
pub initialize: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CharacterBehavior for Data {
|
impl CharacterBehavior for Data {
|
||||||
@ -32,6 +33,10 @@ impl CharacterBehavior for Data {
|
|||||||
server_events: VecDeque::new(),
|
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() {
|
if self.buildup_duration != Duration::default() && data.physics.touch_entity.is_none() {
|
||||||
// Build up (this will move you forward)
|
// Build up (this will move you forward)
|
||||||
update.vel.0 = Vec3::new(0.0, 0.0, update.vel.0.z)
|
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,
|
recover_duration: self.recover_duration,
|
||||||
base_damage: self.base_damage,
|
base_damage: self.base_damage,
|
||||||
exhausted: false,
|
exhausted: false,
|
||||||
|
initialize: false,
|
||||||
});
|
});
|
||||||
} else if !self.exhausted {
|
} else if !self.exhausted {
|
||||||
// Hit attempt
|
// Hit attempt
|
||||||
@ -64,6 +70,7 @@ impl CharacterBehavior for Data {
|
|||||||
recover_duration: self.recover_duration,
|
recover_duration: self.recover_duration,
|
||||||
base_damage: self.base_damage,
|
base_damage: self.base_damage,
|
||||||
exhausted: true,
|
exhausted: true,
|
||||||
|
initialize: false,
|
||||||
});
|
});
|
||||||
} else if self.recover_duration != Duration::default() {
|
} else if self.recover_duration != Duration::default() {
|
||||||
// Recovery
|
// Recovery
|
||||||
@ -75,6 +82,7 @@ impl CharacterBehavior for Data {
|
|||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
base_damage: self.base_damage,
|
base_damage: self.base_damage,
|
||||||
exhausted: true,
|
exhausted: true,
|
||||||
|
initialize: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Done
|
// Done
|
||||||
|
Reference in New Issue
Block a user