diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-08-30 14:24:12 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-08-30 14:24:12 +0300 |
commit | 1a705523c09a914243d18ae337905de0a1b3de91 (patch) | |
tree | a0b6fef7db9f4993e1b91484c686fef404265e3b | |
parent | 87b9e5467d50ba243e4b0cb63f6be206ef107f7b (diff) | |
parent | ef08163c38ea668f509015c176a59d6f4ae1fd76 (diff) | |
download | minetest-1a705523c09a914243d18ae337905de0a1b3de91.tar.gz minetest-1a705523c09a914243d18ae337905de0a1b3de91.tar.bz2 minetest-1a705523c09a914243d18ae337905de0a1b3de91.zip |
Merge remote-tracking branch 'queatz/furnace-is-not-blackhole'
-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 7c0e817f8..d29eea661 100644 --- a/src/content_nodemeta.cpp +++ b/src/content_nodemeta.cpp @@ -203,6 +203,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: |