mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix: set minimum speed for fall damage and balance it
This commit is contained in:
parent
f76f74b411
commit
b20cf6c62b
@ -407,10 +407,13 @@ impl State {
|
||||
let mut controllers = self.ecs.write_storage::<comp::Controller>();
|
||||
match event {
|
||||
LocalEvent::LandOnGround { entity, vel } => {
|
||||
if let Some(stats) = self.ecs.write_storage::<comp::Stats>().get_mut(entity) {
|
||||
let falldmg = (vel.z / 1.5 + 10.0) as i32;
|
||||
if falldmg < 0 {
|
||||
stats.health.change_by(falldmg, comp::HealthSource::World);
|
||||
if vel.z <= -20.0 {
|
||||
if let Some(stats) = self.ecs.write_storage::<comp::Stats>().get_mut(entity)
|
||||
{
|
||||
let falldmg = (vel.z / 5.0) as i32;
|
||||
if falldmg < 0 {
|
||||
stats.health.change_by(falldmg, comp::HealthSource::World);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user