1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Furnace is now usable. Added more tools.

--HG--
rename : data/tool_stpick.png => data/tool_stonepick.png
rename : data/tool_wpick.png => data/tool_woodpick.png
This commit is contained in:
Perttu Ahola 2011-04-05 18:23:30 +03:00
parent 5b4928e07c
commit 89aa8b9be1
22 changed files with 421 additions and 101 deletions

View file

@ -94,12 +94,51 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is)
MaterialItem
*/
bool MaterialItem::isCookable()
{
if(m_content == CONTENT_TREE)
{
return true;
}
else if(m_content == CONTENT_COBBLE)
{
return true;
}
return false;
}
InventoryItem *MaterialItem::createCookResult()
{
if(m_content == CONTENT_TREE)
{
return new CraftItem("lump_of_coal", 1);
}
else if(m_content == CONTENT_COBBLE)
{
return new MaterialItem(CONTENT_STONE, 1);
}
return NULL;
}
/*
CraftItem
*/
bool CraftItem::isCookable()
{
if(m_subname == "lump_of_iron")
{
return true;
}
return false;
}
InventoryItem *CraftItem::createCookResult()
{
if(m_subname == "lump_of_iron")
{
return new CraftItem("steel_ingot", 1);
}
return NULL;
}
@ -357,6 +396,9 @@ void InventoryList::deleteItem(u32 i)
InventoryItem * InventoryList::addItem(InventoryItem *newitem)
{
if(newitem == NULL)
return NULL;
/*
First try to find if it could be added to some existing items
*/
@ -391,6 +433,9 @@ InventoryItem * InventoryList::addItem(InventoryItem *newitem)
InventoryItem * InventoryList::addItem(u32 i, InventoryItem *newitem)
{
if(newitem == NULL)
return NULL;
// If it is an empty position, it's an easy job.
InventoryItem *to_item = m_items[i];
if(to_item == NULL)