summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ravenscroft <ravenscroftj@gmail.com>2013-08-08 17:32:14 +0200
committerJames Ravenscroft <ravenscroftj@gmail.com>2013-08-08 17:32:14 +0200
commit9f7db50de0537ae9e918ab3a9cf49e01eda93cf1 (patch)
tree3d76e422b3f50d4e91faabeb55f62af03e930bd3
parentcPlugin_NewLua is now completely rewritten to use templated LuaState calls. (diff)
downloadcuberite-9f7db50de0537ae9e918ab3a9cf49e01eda93cf1.tar
cuberite-9f7db50de0537ae9e918ab3a9cf49e01eda93cf1.tar.gz
cuberite-9f7db50de0537ae9e918ab3a9cf49e01eda93cf1.tar.bz2
cuberite-9f7db50de0537ae9e918ab3a9cf49e01eda93cf1.tar.lz
cuberite-9f7db50de0537ae9e918ab3a9cf49e01eda93cf1.tar.xz
cuberite-9f7db50de0537ae9e918ab3a9cf49e01eda93cf1.tar.zst
cuberite-9f7db50de0537ae9e918ab3a9cf49e01eda93cf1.zip
Diffstat (limited to '')
-rw-r--r--source/Items/ItemFood.h1
-rw-r--r--source/Items/ItemHandler.cpp1
-rw-r--r--source/Player.cpp7
3 files changed, 9 insertions, 0 deletions
diff --git a/source/Items/ItemFood.h b/source/Items/ItemFood.h
index 6434f3dc7..2ae572331 100644
--- a/source/Items/ItemFood.h
+++ b/source/Items/ItemFood.h
@@ -50,6 +50,7 @@ public:
case E_ITEM_ROTTEN_FLESH: return FoodInfo(4, 0.8, 80);
case E_ITEM_SPIDER_EYE: return FoodInfo(2, 3.2, 100);
case E_ITEM_STEAK: return FoodInfo(8, 12.8);
+ case E_ITEM_MUSHROOM_SOUP: return FoodInfo(6, 7.2);
}
LOGWARNING("%s: Unknown food item (%d), returning zero nutrition", __FUNCTION__, m_ItemType);
return FoodInfo(0, 0.f);
diff --git a/source/Items/ItemHandler.cpp b/source/Items/ItemHandler.cpp
index c81916f5f..f3f4ac6e7 100644
--- a/source/Items/ItemHandler.cpp
+++ b/source/Items/ItemHandler.cpp
@@ -181,6 +181,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_RED_APPLE:
case E_ITEM_GOLDEN_APPLE:
case E_ITEM_ROTTEN_FLESH:
+ case E_ITEM_MUSHROOM_SOUP:
case E_ITEM_SPIDER_EYE:
{
return new cItemFoodHandler(a_ItemType);
diff --git a/source/Player.cpp b/source/Player.cpp
index fb752ed87..6219523cf 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -400,7 +400,14 @@ void cPlayer::FinishEating(void)
return;
}
ItemHandler->OnFoodEaten(m_World, this, &Item);
+
GetInventory().RemoveOneEquippedItem();
+
+ //if the food is mushroom soup, return a bowl to the inventory
+ if( Item.m_ItemType == E_ITEM_MUSHROOM_SOUP ) {
+ cItem emptyBowl(E_ITEM_BOWL, 1, 0, "");
+ GetInventory().AddItem(emptyBowl, true, true);
+ }
}