Fixes.
This commit is contained in:
parent
5a152435b3
commit
8e11f7a1f6
@ -722,7 +722,7 @@ bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int & a_NewFoodLeve
|
|||||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FOOD_LEVEL_CHANGE];
|
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FOOD_LEVEL_CHANGE];
|
||||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
||||||
{
|
{
|
||||||
m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res);
|
m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res, a_NewFoodLevel);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -521,15 +521,15 @@ void cPlayer::Heal(int a_Health)
|
|||||||
|
|
||||||
void cPlayer::SetFoodLevel(int a_FoodLevel)
|
void cPlayer::SetFoodLevel(int a_FoodLevel)
|
||||||
{
|
{
|
||||||
a_FoodLevel = std::max(0, std::min(a_FoodLevel, (int)MAX_FOOD_LEVEL));
|
int FoodLevel = std::max(0, std::min(a_FoodLevel, (int)MAX_FOOD_LEVEL));
|
||||||
|
|
||||||
if (cRoot::Get()->GetPluginManager()->CallHookPlayerFoodLevelChange(*this, a_FoodLevel))
|
if (cRoot::Get()->GetPluginManager()->CallHookPlayerFoodLevelChange(*this, FoodLevel))
|
||||||
{
|
{
|
||||||
m_FoodSaturationLevel = 5.0;
|
m_FoodSaturationLevel = 5.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_FoodLevel = a_FoodLevel;
|
m_FoodLevel = FoodLevel;
|
||||||
SendHealth();
|
SendHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user