From c2f8ceb554982a33bcd4a1e168f6c4e26d0b85dd Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Sat, 5 Sep 2020 17:13:44 +0200 Subject: Add more statistic tracking (#4837) + Added possible 1.8 stats + Added stat tracking for 1.8.2 + Added stat tracking for 1.9 + Added the breed cow achievement Co-authored-by: 12xx12 <12xx12100@gmail.com> --- src/Entities/Player.cpp | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'src/Entities') 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(Value)); } else if (IsOnGround()) { - m_Stats.AddValue(Statistic::WalkOneCm, Value); - AddFoodExhaustion((IsSprinting() ? 0.001 : 0.0001) * static_cast(Value)); + if (IsCrouched()) + { + m_Stats.AddValue(Statistic::CrouchOneCm, Value); + AddFoodExhaustion(0.0001 * static_cast(Value)); + } + if (IsSprinting()) + { + m_Stats.AddValue(Statistic::SprintOneCm, Value); + AddFoodExhaustion(0.001 * static_cast(Value)); + } + else + { + m_Stats.AddValue(Statistic::WalkOneCm, Value); + AddFoodExhaustion(0.0001 * static_cast(Value)); + } } else { -- cgit v1.2.3