1
0

First implementation for furnace minecarts.

This commit is contained in:
STRWarrior 2014-01-15 14:03:09 +01:00
parent d23e743303
commit bdfe31f917
2 changed files with 23 additions and 1 deletions

View File

@ -766,7 +766,10 @@ void cMinecartWithFurnace::OnRightClicked(cPlayer & a_Player)
{ {
a_Player.GetInventory().RemoveOneEquippedItem(); 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_IsFueled = true;
m_World->BroadcastEntityMetadata(*this); 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: // cMinecartWithTNT:

View File

@ -151,6 +151,7 @@ public:
// cEntity overrides: // cEntity overrides:
virtual void OnRightClicked(cPlayer & a_Player) override; virtual void OnRightClicked(cPlayer & a_Player) override;
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
bool IsFueled (void) const { return m_IsFueled; } bool IsFueled (void) const { return m_IsFueled; }
private: private: