Merge branch 'tony/patch_underwater_fall_damage_bug' into 'master'

Temporarily patch underwater fall damage bug

See merge request veloren/veloren!3853
This commit is contained in:
Joshua Barretto 2023-04-04 22:25:32 +00:00
commit 15ada6f25e
2 changed files with 11 additions and 1 deletions

View File

@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added SFX to the new sword abilities
- Fixed various issues with showing the correct text hint for interactable blocks.
- Intert entities like arrows no longer obstruct interacting with nearby entities/blocks.
- Underwater fall damage
## [0.14.0] - 2023-01-07

View File

@ -543,7 +543,16 @@ pub fn handle_delete(server: &mut Server, entity: EcsEntity) {
pub fn handle_land_on_ground(server: &Server, entity: EcsEntity, vel: Vec3<f32>) {
let ecs = server.state.ecs();
if vel.z <= -30.0 {
// The second part of this if statement disables all fall damage when in the
// water. This was added as a *temporary* fix a bug that causes you to take
// fall damage while swimming downwards. FIXME: Fix the actual bug and
// remove the following relevant part of the if statement.
if vel.z <= -30.0
&& ecs
.read_storage::<PhysicsState>()
.get(entity)
.map_or(true, |ps| ps.in_liquid().is_none())
{
let char_states = ecs.read_storage::<CharacterState>();
let reduced_vel_z = if let Some(CharacterState::DiveMelee(c)) = char_states.get(entity) {