From b7a8de94f4ef7e2ef558e1c3cc369fa46013bde6 Mon Sep 17 00:00:00 2001 From: Olexorus Date: Wed, 8 Apr 2020 14:40:17 +0200 Subject: [PATCH] Change how fall damage works --- server/src/events/entity_manipulation.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 59eb020f02..8523af441d 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -138,15 +138,13 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc pub fn handle_land_on_ground(server: &Server, entity: EcsEntity, vel: Vec3) { let state = &server.state; - if vel.z <= -37.0 { + if vel.z <= -30.0 { if let Some(stats) = state.ecs().write_storage::().get_mut(entity) { - let falldmg = (vel.z / 2.5) as i32; - if falldmg < 0 { - stats.health.change_by(comp::HealthChange { - amount: falldmg, - cause: comp::HealthSource::World, - }); - } + let falldmg = vel.z.powi(2) as i32 / 20 - 40; + stats.health.change_by(comp::HealthChange { + amount: -falldmg, + cause: comp::HealthSource::World, + }); } } }