diff options
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Minecart.cpp | 23 | ||||
-rw-r--r-- | src/Entities/Minecart.h | 1 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index be95b2128..9ee649f05 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -766,7 +766,10 @@ void cMinecartWithFurnace::OnRightClicked(cPlayer & a_Player) { a_Player.GetInventory().RemoveOneEquippedItem(); } - + if (!m_IsFueled) // We don't want to change the direction by right clicking it. + { + AddSpeed(a_Player.GetLookVector().x, 0, a_Player.GetLookVector().z); + } m_IsFueled = true; m_World->BroadcastEntityMetadata(*this); } @@ -776,6 +779,24 @@ void cMinecartWithFurnace::OnRightClicked(cPlayer & a_Player) +void cMinecartWithFurnace::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + if (m_IsFueled) + { + if (GetSpeed().Length() > 6) + { + return; + } + AddSpeed(GetSpeed() / 4); + } +} + + + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cMinecartWithTNT: diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h index feb700b71..e30f50edc 100644 --- a/src/Entities/Minecart.h +++ b/src/Entities/Minecart.h @@ -151,6 +151,7 @@ public: // cEntity overrides: virtual void OnRightClicked(cPlayer & a_Player) override; + virtual void Tick(float a_Dt, cChunk & a_Chunk) override; bool IsFueled (void) const { return m_IsFueled; } private: |