diff options
author | Gargaj <gargaj@conspiracy.hu> | 2015-11-10 00:23:46 +0100 |
---|---|---|
committer | Gargaj <gargaj@conspiracy.hu> | 2015-11-10 00:36:15 +0100 |
commit | 51f8e0e36c6f34820f6eb71cb0c92ed9e0a9765a (patch) | |
tree | 37182103579dda6346fcb4687cdbb028eed1b657 /src/Entities/Player.cpp | |
parent | Merge pull request #2629 from Gargaj/slabfix (diff) | |
download | cuberite-51f8e0e36c6f34820f6eb71cb0c92ed9e0a9765a.tar cuberite-51f8e0e36c6f34820f6eb71cb0c92ed9e0a9765a.tar.gz cuberite-51f8e0e36c6f34820f6eb71cb0c92ed9e0a9765a.tar.bz2 cuberite-51f8e0e36c6f34820f6eb71cb0c92ed9e0a9765a.tar.lz cuberite-51f8e0e36c6f34820f6eb71cb0c92ed9e0a9765a.tar.xz cuberite-51f8e0e36c6f34820f6eb71cb0c92ed9e0a9765a.tar.zst cuberite-51f8e0e36c6f34820f6eb71cb0c92ed9e0a9765a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index bc8a0db51..d6d890fdf 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -461,8 +461,13 @@ void cPlayer::SetTouchGround(bool a_bTouchGround) static const auto HalfWidth = GetWidth() / 2; static const auto EPS = 0.0001; + + BLOCKTYPE BlockAtFoot = GetWorld()->GetBlock(POS_TOINT); + bool IsFootInWater = IsBlockWater(BlockAtFoot); + bool IsFootInLiquid = IsFootInWater || IsBlockLava(BlockAtFoot) || (BlockAtFoot == E_BLOCK_COBWEB); // okay so cobweb is not _technically_ a liquid... + if ( - !IsSwimming() && !IsFlying() && + !IsFlying() && ( ( ((GetPosY() >= 1) && (GetPosY() <= 255) && ((GetPosY() - POSY_TOINT) <= EPS)) && @@ -498,7 +503,7 @@ void cPlayer::SetTouchGround(bool a_bTouchGround) ) { auto Damage = static_cast<int>(m_LastGroundHeight - GetPosY() - 3.0); - if (Damage > 0) + if ((Damage > 0) && !IsFootInWater) { // cPlayer makes sure damage isn't applied in creative, no need to check here TakeDamage(dtFalling, nullptr, Damage, Damage, 0); @@ -523,7 +528,10 @@ void cPlayer::SetTouchGround(bool a_bTouchGround) m_bTouchGround = false; } - if (IsFlying() || IsSwimming() || IsClimbing()) + /* Note: it is currently possible to fall through lava and still die from fall damage + because of the client skipping an update about the lava block. This can only be resolved by + interpolating between positions. */ + if (IsFlying() || IsFootInLiquid || IsClimbing()) { m_LastGroundHeight = GetPosY(); } |