summaryrefslogtreecommitdiffstats
path: root/src/Entities/Minecart.cpp
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-01-15 14:38:54 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2014-01-15 14:38:54 +0100
commit72dcd70f222362b161649810146c8d27162cdb84 (patch)
tree3a2cdd557fc8d2f3709c14cfcee33b380d3e46c0 /src/Entities/Minecart.cpp
parentFirst implementation for furnace minecarts. (diff)
downloadcuberite-72dcd70f222362b161649810146c8d27162cdb84.tar
cuberite-72dcd70f222362b161649810146c8d27162cdb84.tar.gz
cuberite-72dcd70f222362b161649810146c8d27162cdb84.tar.bz2
cuberite-72dcd70f222362b161649810146c8d27162cdb84.tar.lz
cuberite-72dcd70f222362b161649810146c8d27162cdb84.tar.xz
cuberite-72dcd70f222362b161649810146c8d27162cdb84.tar.zst
cuberite-72dcd70f222362b161649810146c8d27162cdb84.zip
Diffstat (limited to 'src/Entities/Minecart.cpp')
-rw-r--r--src/Entities/Minecart.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 9ee649f05..7f3fea5ec 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -750,7 +750,8 @@ void cMinecartWithChest::OnRightClicked(cPlayer & a_Player)
cMinecartWithFurnace::cMinecartWithFurnace(double a_X, double a_Y, double a_Z) :
super(mpFurnace, a_X, a_Y, a_Z),
- m_IsFueled(false)
+ m_IsFueled(false),
+ m_FueledTimeLeft(-1)
{
}
@@ -771,6 +772,7 @@ void cMinecartWithFurnace::OnRightClicked(cPlayer & a_Player)
AddSpeed(a_Player.GetLookVector().x, 0, a_Player.GetLookVector().z);
}
m_IsFueled = true;
+ m_FueledTimeLeft = m_FueledTimeLeft + 600; // The minecart will be active 600 more ticks.
m_World->BroadcastEntityMetadata(*this);
}
}
@@ -785,6 +787,14 @@ void cMinecartWithFurnace::Tick(float a_Dt, cChunk & a_Chunk)
if (m_IsFueled)
{
+ m_FueledTimeLeft--;
+ if (m_FueledTimeLeft < 0)
+ {
+ m_IsFueled = false;
+ m_World->BroadcastEntityMetadata(*this);
+ return;
+ }
+
if (GetSpeed().Length() > 6)
{
return;