diff options
author | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2011-07-30 19:46:55 +0200 |
---|---|---|
committer | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2011-07-30 19:47:55 +0200 |
commit | 96bee29e35f0790657fbd8bb67d2af79b498255c (patch) | |
tree | 0712c75629ab16fad84af11050ef94d8c8ac8137 /src/inventory.cpp | |
parent | 82ea53499710c9a4e92ec595d8c14c417bdd0ee6 (diff) | |
parent | f2051c98223d087c8ba3d7e4514935781c93ed1c (diff) | |
download | minetest-96bee29e35f0790657fbd8bb67d2af79b498255c.tar.gz minetest-96bee29e35f0790657fbd8bb67d2af79b498255c.tar.bz2 minetest-96bee29e35f0790657fbd8bb67d2af79b498255c.zip |
Merge branch 'upstream/master'
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index 7ef7f0138..ca050614f 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "content_mapnode.h" #include "content_inventory.h" #include "content_sao.h" +#include "player.h" /* InventoryItem @@ -168,6 +169,20 @@ InventoryItem *CraftItem::createCookResult() return item_craft_create_cook_result(m_subname); } +bool CraftItem::use(ServerEnvironment *env, Player *player) +{ + if(item_craft_is_eatable(m_subname)) + { + s16 hp_change = item_craft_eat_hp_change(m_subname); + if(player->hp + hp_change > 20) + player->hp = 20; + else + player->hp += hp_change; + return true; + } + return false; +} + /* MapBlockObjectItem DEPRECATED TODO: Remove |