Example #1
0
void cMinecartWithFurnace::OnRightClicked(cPlayer & a_Player)
{
    if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_COAL)
    {
        if (!a_Player.IsGameModeCreative())
        {
            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_FueledTimeLeft = m_FueledTimeLeft + 600;  // The minecart will be active 600 more ticks.
        m_World->BroadcastEntityMetadata(*this);
    }
}