From: JacobF Date: Wed, 24 Aug 2011 22:53:06 +0000 (-0400) Subject: Don't remove furnace if something is inside it. X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=ef08163c38ea668f509015c176a59d6f4ae1fd76;p=zefram%2Fminetest%2Fminetest_engine.git Don't remove furnace if something is inside it. --- diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp index 433e6d04..f3d0e0fd 100644 --- a/src/content_nodemeta.cpp +++ b/src/content_nodemeta.cpp @@ -195,6 +195,24 @@ std::string FurnaceNodeMetadata::infoText() 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() { dstream<<"Furnace inventory modification callback"<