mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-24 08:28:49 -05:00
Don't remove furnace if something is inside it.
This commit is contained in:
parent
efd8dabd91
commit
ef08163c38
@ -195,6 +195,24 @@ std::string FurnaceNodeMetadata::infoText()
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool FurnaceNodeMetadata::nodeRemovalDisabled()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Disable removal if furnace is not empty
|
||||||
|
*/
|
||||||
|
InventoryList *list[3] = {m_inventory->getList("src"),
|
||||||
|
m_inventory->getList("dst"), m_inventory->getList("fuel")};
|
||||||
|
|
||||||
|
for(int i = 0; i < 3; i++) {
|
||||||
|
if(list[i] == NULL)
|
||||||
|
continue;
|
||||||
|
if(list[i]->getUsedSlots() == 0)
|
||||||
|
continue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
void FurnaceNodeMetadata::inventoryModified()
|
void FurnaceNodeMetadata::inventoryModified()
|
||||||
{
|
{
|
||||||
dstream<<"Furnace inventory modification callback"<<std::endl;
|
dstream<<"Furnace inventory modification callback"<<std::endl;
|
||||||
|
@ -76,6 +76,7 @@ public:
|
|||||||
virtual Inventory* getInventory() {return m_inventory;}
|
virtual Inventory* getInventory() {return m_inventory;}
|
||||||
virtual void inventoryModified();
|
virtual void inventoryModified();
|
||||||
virtual bool step(float dtime);
|
virtual bool step(float dtime);
|
||||||
|
virtual bool nodeRemovalDisabled();
|
||||||
virtual std::string getInventoryDrawSpecString();
|
virtual std::string getInventoryDrawSpecString();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user