diff options
author | JacobF <queatz@gmail.com> | 2011-08-24 18:53:06 -0400 |
---|---|---|
committer | JacobF <queatz@gmail.com> | 2011-08-24 18:53:06 -0400 |
commit | ef08163c38ea668f509015c176a59d6f4ae1fd76 (patch) | |
tree | f1601637a552385d5f45c73ac7d0fcfe6e75224a | |
parent | efd8dabd913b2d1a0564378c30ae86c7a5081f06 (diff) | |
download | minetest-ef08163c38ea668f509015c176a59d6f4ae1fd76.tar.gz minetest-ef08163c38ea668f509015c176a59d6f4ae1fd76.tar.bz2 minetest-ef08163c38ea668f509015c176a59d6f4ae1fd76.zip |
Don't remove furnace if something is inside it.
-rw-r--r-- | src/content_nodemeta.cpp | 18 | ||||
-rw-r--r-- | src/content_nodemeta.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp index 433e6d04b..f3d0e0fdc 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"<<std::endl; diff --git a/src/content_nodemeta.h b/src/content_nodemeta.h index 84c3aed9d..50decd910 100644 --- a/src/content_nodemeta.h +++ b/src/content_nodemeta.h @@ -76,6 +76,7 @@ public: virtual Inventory* getInventory() {return m_inventory;} virtual void inventoryModified(); virtual bool step(float dtime); + virtual bool nodeRemovalDisabled(); virtual std::string getInventoryDrawSpecString(); private: |