diff options
author | 12xx12 <44411062+12xx12@users.noreply.github.com> | 2020-09-05 17:13:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-05 17:13:44 +0200 |
commit | c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd (patch) | |
tree | d87a9a2041afd755cbe0b63bb52e079b0f36235f /src/Entities | |
parent | Use pitch lookup in noteblock block entity (#4826) (diff) | |
download | cuberite-c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd.tar cuberite-c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd.tar.gz cuberite-c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd.tar.bz2 cuberite-c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd.tar.lz cuberite-c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd.tar.xz cuberite-c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd.tar.zst cuberite-c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd.zip |
Diffstat (limited to 'src/Entities')
-rw-r--r-- | src/Entities/Player.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 841b70b01..d9353f67f 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -334,7 +334,12 @@ void cPlayer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } - m_Stats.AddValue(Statistic::PlayOneMinute, 1); + m_Stats.AddValue(Statistic::PlayOneMinute); + m_Stats.AddValue(Statistic::TimeSinceDeath); + if (IsCrouched()) + { + m_Stats.AddValue(Statistic::SneakTime); + } // Handle the player detach, when the player is in spectator mode if ( @@ -1235,6 +1240,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI) } m_Stats.AddValue(Statistic::Deaths); + m_Stats.SetValue(Statistic::TimeSinceDeath, 0); m_World->GetScoreBoard().AddPlayerScore(GetName(), cObjective::otDeathCount, 1); } @@ -2675,14 +2681,33 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos, bool a_PreviousIs } else if (IsInWater()) { - // TODO: implement differentiation between diving and swimming - m_Stats.AddValue(Statistic::WalkUnderWaterOneCm, Value); + if (m_IsHeadInWater) + { + m_Stats.AddValue(Statistic::WalkUnderWaterOneCm, Value); + } + else + { + m_Stats.AddValue(Statistic::WalkOnWaterOneCm, Value); + } AddFoodExhaustion(0.00015 * static_cast<double>(Value)); } else if (IsOnGround()) { - m_Stats.AddValue(Statistic::WalkOneCm, Value); - AddFoodExhaustion((IsSprinting() ? 0.001 : 0.0001) * static_cast<double>(Value)); + if (IsCrouched()) + { + m_Stats.AddValue(Statistic::CrouchOneCm, Value); + AddFoodExhaustion(0.0001 * static_cast<double>(Value)); + } + if (IsSprinting()) + { + m_Stats.AddValue(Statistic::SprintOneCm, Value); + AddFoodExhaustion(0.001 * static_cast<double>(Value)); + } + else + { + m_Stats.AddValue(Statistic::WalkOneCm, Value); + AddFoodExhaustion(0.0001 * static_cast<double>(Value)); + } } else { |