Esempio n. 1
0
/// Updates the current recipe, based on the current input
void cFurnaceEntity::UpdateInput(void)
{
	if (!m_Contents.GetSlot(fsInput).IsEqual(m_LastInput))
	{
		// The input is different from what we had before, reset the cooking time
		m_TimeCooked = 0;
	}
	m_LastInput = m_Contents.GetSlot(fsInput);
	
	cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe();
	m_CurrentRecipe = FR->GetRecipeFrom(m_Contents.GetSlot(fsInput));
	if (!CanCookInputToOutput())
	{
		// This input cannot be cooked
		m_NeedCookTime = 0;
		SetIsCooking(false);
	}
	else
	{
		m_NeedCookTime = m_CurrentRecipe->CookTime;
		SetIsCooking(true);
		
		// Start burning new fuel if there's no flame now:
		if (GetFuelBurnTimeLeft() <= 0)
		{
			BurnNewFuel();
		}
	}
}
Esempio n. 2
0
void cFurnaceEntity::UpdateOutput(void)
{
	if (!CanCookInputToOutput())
	{
		// Cannot cook anymore:
		SetCookTimes(0, 0);
		SetIsCooking(false);
		return;
	}

	// Can cook, start cooking if not already underway:
	m_NeedCookTime = m_CurrentRecipe->CookTime;

	// Check if fuel needs to start a burn
	if (GetFuelBurnTimeLeft() <= 0)
	{
		BurnNewFuel();
	}
	// Already burning, set cooking to ensure that cooking is occuring
	else
	{
		SetIsCooking(true);
	}
}
Esempio n. 3
0
void cFurnaceEntity::UpdateInput(void)
{
	if (!m_Contents.GetSlot(fsInput).IsEqual(m_LastInput))
	{
		// The input is different from what we had before, reset the cooking time
		if (!m_IsLoading)
		{
			m_TimeCooked = 0;
		}
	}
	m_LastInput = m_Contents.GetSlot(fsInput);

	cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe();
	m_CurrentRecipe = FR->GetRecipeFrom(m_Contents.GetSlot(fsInput));
	if (!CanCookInputToOutput())
	{
		// This input cannot be cooked, reset cook counter immediately
		SetCookTimes(0, 0);
		SetIsCooking(false);
	}
	else
	{
		m_NeedCookTime = m_CurrentRecipe->CookTime;

		// Start burning new fuel if there's no flame now:
		if (GetFuelBurnTimeLeft() <= 0)
		{
			BurnNewFuel();
		}
		// Already burning, set cooking to ensure that cooking is occuring
		else
		{
			SetIsCooking(true);
		}
	}
}