From 3a383050d58fe5cd7d2caf655d9e2eb65b0a28f6 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Thu, 1 Jun 2023 14:14:28 +0100 Subject: [PATCH] Apply fall damage even after a block-hop --- CHANGELOG.md | 1 + common/systems/src/phys.rs | 4 ++++ server/src/events/entity_manipulation.rs | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23cc4ad35c..2f54cf891e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Default audio volume should be less likely to destroy ear drums - Creatures flee less quickly when low on health - All `/build_area_*` commands have been renamed to `/area_*`, and you will have to pass an additional area type +- Collision damage can now be applied in horizontal axes, in addition to the vertical axis ### Removed diff --git a/common/systems/src/phys.rs b/common/systems/src/phys.rs index a148311385..8e5ccb5a14 100644 --- a/common/systems/src/phys.rs +++ b/common/systems/src/phys.rs @@ -1638,7 +1638,11 @@ fn box_voxel_collision + ReadVol>( } { // ...block-hop! pos.0.z = pos.0.z.max(block_aabb.max.z); + + // Apply fall damage, in the vertical axis, and correct velocity + land_on_ground(entity, *vel, Vec3::unit_z()); vel.0.z = vel.0.z.max(0.0); + // Push the character on to the block very slightly // to avoid jitter due to imprecision if (vel.0 * resolve_dir).xy().magnitude_squared() < 1.0_f32.powi(2) { diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 2af58712c1..c3086f5be2 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -603,7 +603,7 @@ pub fn handle_land_on_ground( ) { let ecs = server.state.ecs(); - // HACK: Certain ability movements currently take up above the fall damage + // HACK: Certain ability movements currently take us above the fall damage // threshold in the horizontal axis. This factor dampens velocity in the // horizontal axis when applying fall damage. let horizontal_damp = 0.5