feat: eat to heal
This commit is contained in:
1 parent
7d592c43ca
commit
9bcb6f8a3d
7 files changed
+36
-21
No files matched your search
@@ -98,20 +98,7 @@ void CakeTile::attack(Level *level, int x, int y, int z, shared_ptr<Player> play
|
||||
|
||||
void CakeTile::eat(Level *level, int x, int y, int z, shared_ptr<Player> player)
|
||||
{
|
||||
if (player->canEat(false))
|
||||
{
|
||||
player->getFoodData()->eat(2, FoodConstants::FOOD_SATURATION_POOR);
|
||||
|
||||
int d = level->getData(x, y, z) + 1;
|
||||
if (d >= 6)
|
||||
{
|
||||
level->setTile(x, y, z, 0);
|
||||
} else
|
||||
{
|
||||
level->setData(x, y, z, d);
|
||||
level->setTileDirty(x, y, z);
|
||||
}
|
||||
}
|
||||
player->heal(1.5);
|
||||
}
|
||||
|
||||
bool CakeTile::mayPlace(Level *level, int x, int y, int z)
|
||||
|
||||
Reference in new issue
Block a user