diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-01-15 14:03:09 +0100 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-01-15 14:03:09 +0100 |
commit | bdfe31f9176e3246ca320081d2d21367301d01e8 (patch) | |
tree | f043396e13405c92922c88d95181e8ff77515e47 /src | |
parent | CMake: Removed SCL warnings from Lua and ZLib. (diff) | |
download | cuberite-bdfe31f9176e3246ca320081d2d21367301d01e8.tar cuberite-bdfe31f9176e3246ca320081d2d21367301d01e8.tar.gz cuberite-bdfe31f9176e3246ca320081d2d21367301d01e8.tar.bz2 cuberite-bdfe31f9176e3246ca320081d2d21367301d01e8.tar.lz cuberite-bdfe31f9176e3246ca320081d2d21367301d01e8.tar.xz cuberite-bdfe31f9176e3246ca320081d2d21367301d01e8.tar.zst cuberite-bdfe31f9176e3246ca320081d2d21367301d01e8.zip |
Diffstat (limited to 'src')
-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: |