Apply fall damage even after a block-hop

This commit is contained in:
Joshua Barretto 2023-06-01 14:14:28 +01:00
parent f00f96636c
commit 3a383050d5
3 changed files with 6 additions and 1 deletions

View File

@ -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 - Default audio volume should be less likely to destroy ear drums
- Creatures flee less quickly when low on health - 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 - 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 ### Removed

View File

@ -1638,7 +1638,11 @@ fn box_voxel_collision<T: BaseVol<Vox = Block> + ReadVol>(
} { } {
// ...block-hop! // ...block-hop!
pos.0.z = pos.0.z.max(block_aabb.max.z); 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); vel.0.z = vel.0.z.max(0.0);
// Push the character on to the block very slightly // Push the character on to the block very slightly
// to avoid jitter due to imprecision // to avoid jitter due to imprecision
if (vel.0 * resolve_dir).xy().magnitude_squared() < 1.0_f32.powi(2) { if (vel.0 * resolve_dir).xy().magnitude_squared() < 1.0_f32.powi(2) {

View File

@ -603,7 +603,7 @@ pub fn handle_land_on_ground(
) { ) {
let ecs = server.state.ecs(); 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 // threshold in the horizontal axis. This factor dampens velocity in the
// horizontal axis when applying fall damage. // horizontal axis when applying fall damage.
let horizontal_damp = 0.5 let horizontal_damp = 0.5