diff options
author | Mattes D <github@xoft.cz> | 2013-12-26 08:57:02 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2013-12-26 08:57:02 +0100 |
commit | e0e01d0615fdeeb32a87dc74ca882e92a450ceb7 (patch) | |
tree | 22ef418f2fd3ff628fc010f52a5fe8e945519701 /src/Entities/Player.cpp | |
parent | Merge pull request #471 from mc-server/Fishing_Catapult (diff) | |
parent | Moved increment operator to back of variables (diff) | |
download | cuberite-e0e01d0615fdeeb32a87dc74ca882e92a450ceb7.tar cuberite-e0e01d0615fdeeb32a87dc74ca882e92a450ceb7.tar.gz cuberite-e0e01d0615fdeeb32a87dc74ca882e92a450ceb7.tar.bz2 cuberite-e0e01d0615fdeeb32a87dc74ca882e92a450ceb7.tar.lz cuberite-e0e01d0615fdeeb32a87dc74ca882e92a450ceb7.tar.xz cuberite-e0e01d0615fdeeb32a87dc74ca882e92a450ceb7.tar.zst cuberite-e0e01d0615fdeeb32a87dc74ca882e92a450ceb7.zip |
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r-- | src/Entities/Player.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index b923a094e..0fa8254ce 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -252,6 +252,11 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk) m_World->SendPlayerList(this); m_LastPlayerListTime = t1.GetNowTime(); } + + if (IsFlying()) + { + m_LastGroundHeight = (float)GetPosY(); + } } @@ -452,10 +457,16 @@ 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); + } + + // Mojang uses floor() to get X and Z positions, instead of just casting it to an (int) + GetWorld()->BroadcastSoundParticleEffect(2006, (int)floor(GetPosX()), (int)GetPosY() - 1, (int)floor(GetPosZ()), Damage /* Used as particle effect speed modifier */); + } m_LastGroundHeight = (float)GetPosY(); } @@ -979,6 +990,12 @@ void cPlayer::SetGameMode(eGameMode a_GameMode) m_GameMode = a_GameMode; m_ClientHandle->SendGameMode(a_GameMode); + + if (!IsGameModeCreative()) + { + SetFlying(false); + SetCanFly(false); + } } |