diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-22 21:03:09 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-22 21:03:09 +0100 |
commit | 945ba36d1b7b1b90028148aa5637f9842858af12 (patch) | |
tree | d503a9df915e2fd538c2ebf0b1ad4ba030182f36 /src/Entities | |
parent | Daylight sensors (diff) | |
download | cuberite-945ba36d1b7b1b90028148aa5637f9842858af12.tar cuberite-945ba36d1b7b1b90028148aa5637f9842858af12.tar.gz cuberite-945ba36d1b7b1b90028148aa5637f9842858af12.tar.bz2 cuberite-945ba36d1b7b1b90028148aa5637f9842858af12.tar.lz cuberite-945ba36d1b7b1b90028148aa5637f9842858af12.tar.xz cuberite-945ba36d1b7b1b90028148aa5637f9842858af12.tar.zst cuberite-945ba36d1b7b1b90028148aa5637f9842858af12.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 8f30cd4cc..aedd3b77e 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -247,6 +247,9 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk) m_World->SendPlayerList(this); m_LastPlayerListTime = t1.GetNowTime(); } + + if (IsFlying()) + m_LastGroundHeight = (float)GetPosY(); } @@ -447,10 +450,19 @@ void cPlayer::SetTouchGround(bool a_bTouchGround) if (m_LastJumpHeight > m_LastGroundHeight) Damage++; m_LastJumpHeight = (float)GetPosY(); - if ((Damage > 0) && (!IsGameModeCreative())) + if (Damage > 0) { - TakeDamage(dtFalling, NULL, Damage, Damage, 0); - } + if (!IsGameModeCreative()) + { + TakeDamage(dtFalling, NULL, Damage, Damage, 0); + } + + GetWorld()->BroadcastSoundParticleEffect( + 2006, + (int)GetPosX(), (int)GetPosY() - 1, (int)GetPosZ(), + Damage // Used as particle effect speed modifier + ); + } m_LastGroundHeight = (float)GetPosY(); } @@ -974,6 +986,9 @@ void cPlayer::SetGameMode(eGameMode a_GameMode) m_GameMode = a_GameMode; m_ClientHandle->SendGameMode(a_GameMode); + + SetFlying(false); + SetCanFly(false); } |