mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed boost having ridiculous velocity.
This commit is contained in:
parent
b4840ce48d
commit
6c2de7d70e
@ -1,4 +1,6 @@
|
|||||||
Boost(
|
Boost(
|
||||||
movement_duration: 0.05,
|
movement_duration: 0.05,
|
||||||
only_up: false,
|
only_up: false,
|
||||||
|
speed: 400.0,
|
||||||
|
max_exit_velocity: 100.0,
|
||||||
)
|
)
|
@ -1,4 +1,6 @@
|
|||||||
Boost(
|
Boost(
|
||||||
movement_duration: 0.05,
|
movement_duration: 0.05,
|
||||||
only_up: true,
|
only_up: true,
|
||||||
|
speed: 250.0,
|
||||||
|
max_exit_velocity: 70.0,
|
||||||
)
|
)
|
@ -95,6 +95,8 @@ pub enum CharacterAbility {
|
|||||||
Boost {
|
Boost {
|
||||||
movement_duration: f32,
|
movement_duration: f32,
|
||||||
only_up: bool,
|
only_up: bool,
|
||||||
|
speed: f32,
|
||||||
|
max_exit_velocity: f32,
|
||||||
},
|
},
|
||||||
DashMelee {
|
DashMelee {
|
||||||
energy_cost: f32,
|
energy_cost: f32,
|
||||||
@ -371,9 +373,11 @@ impl CharacterAbility {
|
|||||||
},
|
},
|
||||||
Boost {
|
Boost {
|
||||||
ref mut movement_duration,
|
ref mut movement_duration,
|
||||||
|
speed: ref mut boost_speed,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
*movement_duration /= speed;
|
*movement_duration /= speed;
|
||||||
|
*boost_speed *= power;
|
||||||
},
|
},
|
||||||
DashMelee {
|
DashMelee {
|
||||||
ref mut base_damage,
|
ref mut base_damage,
|
||||||
@ -1150,10 +1154,14 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
CharacterAbility::Boost {
|
CharacterAbility::Boost {
|
||||||
movement_duration,
|
movement_duration,
|
||||||
only_up,
|
only_up,
|
||||||
|
speed,
|
||||||
|
max_exit_velocity,
|
||||||
} => CharacterState::Boost(boost::Data {
|
} => CharacterState::Boost(boost::Data {
|
||||||
static_data: boost::StaticData {
|
static_data: boost::StaticData {
|
||||||
movement_duration: Duration::from_secs_f32(*movement_duration),
|
movement_duration: Duration::from_secs_f32(*movement_duration),
|
||||||
only_up: *only_up,
|
only_up: *only_up,
|
||||||
|
speed: *speed,
|
||||||
|
max_exit_velocity: *max_exit_velocity,
|
||||||
ability_info,
|
ability_info,
|
||||||
},
|
},
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
|
@ -13,6 +13,8 @@ use std::time::Duration;
|
|||||||
pub struct StaticData {
|
pub struct StaticData {
|
||||||
pub movement_duration: Duration,
|
pub movement_duration: Duration,
|
||||||
pub only_up: bool,
|
pub only_up: bool,
|
||||||
|
pub speed: f32,
|
||||||
|
pub max_exit_velocity: f32,
|
||||||
pub ability_info: AbilityInfo,
|
pub ability_info: AbilityInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,9 +36,9 @@ impl CharacterBehavior for Data {
|
|||||||
if self.timer < self.static_data.movement_duration {
|
if self.timer < self.static_data.movement_duration {
|
||||||
// Movement
|
// Movement
|
||||||
if self.static_data.only_up {
|
if self.static_data.only_up {
|
||||||
update.vel.0.z += 500.0 * data.dt.0;
|
update.vel.0.z += self.static_data.speed * data.dt.0;
|
||||||
} else {
|
} else {
|
||||||
update.vel.0 += *data.inputs.look_dir * 500.0 * data.dt.0;
|
update.vel.0 += *data.inputs.look_dir * self.static_data.speed * data.dt.0;
|
||||||
}
|
}
|
||||||
update.character = CharacterState::Boost(Data {
|
update.character = CharacterState::Boost(Data {
|
||||||
timer: self
|
timer: self
|
||||||
@ -50,6 +52,12 @@ impl CharacterBehavior for Data {
|
|||||||
if input_is_pressed(data, self.static_data.ability_info.input) {
|
if input_is_pressed(data, self.static_data.ability_info.input) {
|
||||||
reset_state(self, data, &mut update);
|
reset_state(self, data, &mut update);
|
||||||
} else {
|
} else {
|
||||||
|
update.vel.0 = update.vel.0.normalized()
|
||||||
|
* update
|
||||||
|
.vel
|
||||||
|
.0
|
||||||
|
.magnitude()
|
||||||
|
.min(self.static_data.max_exit_velocity);
|
||||||
update.character = CharacterState::Wielding;
|
update.character = CharacterState::Wielding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user