Hunger - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: Hunger (/thread-250.html) |
Hunger - cedeel - 12-29-2011 Hi, I've created a patch for rudimentary hunger management. Eating food will saturate the food bar, but healing from the food bar isn't implemented yet. Patch made against latest svn rev 154 (Had to add .txt for the forum) RE: Hunger - mtilden - 12-30-2011 Added, good start, thanks. RE: Hunger - Lapayo - 12-30-2011 I think it should be outsourced a bit. The clienthandle is already very overloaded For example: if(SomeClass::IsFood(Item->m_ItemID)) { if(m_Player->GetInventory().RemoveItem( Item ) m_Player->Feed(SomeClass::GetSaturation(Item->m_ItemID)); break; } This would make the cClientHandle a bit clearer RE: Hunger - cedeel - 12-30-2011 It could probably do with some refactoring later on. I was in fact a tad confused about how things were organized. RE: Hunger - Lapayo - 12-30-2011 Yes I also realized this. Therefore I mentioned this point because we should try to clean up the code bit by bit. |