Removed foodlevel-change possibility. Plugins can cancel the event and use cPlayer:SetFoodLevel()
This commit is contained in:
parent
5a888f0a51
commit
4a9002045b
@ -72,7 +72,7 @@ public:
|
|||||||
virtual bool OnPlayerEating (cPlayer & a_Player) = 0;
|
virtual bool OnPlayerEating (cPlayer & a_Player) = 0;
|
||||||
virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0;
|
virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0;
|
||||||
virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0;
|
virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0;
|
||||||
virtual bool OnPlayerFoodLevelChange (cPlayer & a_Player, int & a_NewFoodLevel) = 0;
|
virtual bool OnPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel) = 0;
|
||||||
virtual bool OnPlayerJoined (cPlayer & a_Player) = 0;
|
virtual bool OnPlayerJoined (cPlayer & a_Player) = 0;
|
||||||
virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) = 0;
|
virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) = 0;
|
||||||
virtual bool OnPlayerMoved (cPlayer & a_Player) = 0;
|
virtual bool OnPlayerMoved (cPlayer & a_Player) = 0;
|
||||||
|
@ -715,14 +715,14 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int & a_NewFoodLevel)
|
bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int a_NewFoodLevel)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CriticalSection);
|
cCSLock Lock(m_CriticalSection);
|
||||||
bool res = false;
|
bool res = false;
|
||||||
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, a_NewFoodLevel);
|
m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -95,7 +95,7 @@ public:
|
|||||||
virtual bool OnPlayerEating (cPlayer & a_Player) override;
|
virtual bool OnPlayerEating (cPlayer & a_Player) override;
|
||||||
virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) override;
|
virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) override;
|
||||||
virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) override;
|
virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) override;
|
||||||
virtual bool OnPlayerFoodLevelChange (cPlayer & a_Player, int & a_NewFoodLevel) override;
|
virtual bool OnPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel) override;
|
||||||
virtual bool OnPlayerJoined (cPlayer & a_Player) override;
|
virtual bool OnPlayerJoined (cPlayer & a_Player) override;
|
||||||
virtual bool OnPlayerMoved (cPlayer & a_Player) override;
|
virtual bool OnPlayerMoved (cPlayer & a_Player) override;
|
||||||
virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override;
|
virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override;
|
||||||
|
@ -695,7 +695,7 @@ bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPluginManager::CallHookPlayerFoodLevelChange(cPlayer & a_Player, int & a_NewFoodLevel)
|
bool cPluginManager::CallHookPlayerFoodLevelChange(cPlayer & a_Player, int a_NewFoodLevel)
|
||||||
{
|
{
|
||||||
FIND_HOOK(HOOK_PLAYER_FOOD_LEVEL_CHANGE);
|
FIND_HOOK(HOOK_PLAYER_FOOD_LEVEL_CHANGE);
|
||||||
VERIFY_HOOK;
|
VERIFY_HOOK;
|
||||||
|
@ -189,7 +189,7 @@ public: // tolua_export
|
|||||||
bool CallHookPlayerEating (cPlayer & a_Player);
|
bool CallHookPlayerEating (cPlayer & a_Player);
|
||||||
bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward);
|
bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward);
|
||||||
bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward);
|
bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward);
|
||||||
bool CallHookPlayerFoodLevelChange (cPlayer & a_Player, int & a_NewFoodLevel);
|
bool CallHookPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel);
|
||||||
bool CallHookPlayerJoined (cPlayer & a_Player);
|
bool CallHookPlayerJoined (cPlayer & a_Player);
|
||||||
bool CallHookPlayerMoving (cPlayer & a_Player);
|
bool CallHookPlayerMoving (cPlayer & a_Player);
|
||||||
bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
|
bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
|
||||||
|
Loading…
Reference in New Issue
Block a user