1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Rats are now eatable. Also made their selection box move smoothly.

This commit is contained in:
Perttu Ahola 2011-07-30 18:51:15 +03:00
parent 4556c212db
commit d62ae0e18b
10 changed files with 140 additions and 57 deletions

View file

@ -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