fix: set minimum speed for fall damage and balance it

This commit is contained in:
timokoesters 2019-10-08 18:38:20 +02:00
parent f76f74b411
commit b20cf6c62b
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097

View File

@ -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);
}
}
}
}