diff options
author | Mattes D <github@xoft.cz> | 2014-07-02 16:33:24 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-07-02 16:33:24 +0200 |
commit | 9204c8a124c015be6919be8428517e0e3f0429e7 (patch) | |
tree | 4038c19d1cb7f74baf427923869c5c450ed1583c /src/Bindings/PluginLua.cpp | |
parent | CMake: Use cmake for file-copying. (diff) | |
parent | Update documentation (diff) | |
download | cuberite-9204c8a124c015be6919be8428517e0e3f0429e7.tar cuberite-9204c8a124c015be6919be8428517e0e3f0429e7.tar.gz cuberite-9204c8a124c015be6919be8428517e0e3f0429e7.tar.bz2 cuberite-9204c8a124c015be6919be8428517e0e3f0429e7.tar.lz cuberite-9204c8a124c015be6919be8428517e0e3f0429e7.tar.xz cuberite-9204c8a124c015be6919be8428517e0e3f0429e7.tar.zst cuberite-9204c8a124c015be6919be8428517e0e3f0429e7.zip |
Diffstat (limited to 'src/Bindings/PluginLua.cpp')
-rw-r--r-- | src/Bindings/PluginLua.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 97366cc4c..344031995 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -715,6 +715,26 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) +bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int a_NewFoodLevel) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FOOD_LEVEL_CHANGE]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + bool cPluginLua::OnPlayerFished(cPlayer & a_Player, const cItems & a_Reward) { cCSLock Lock(m_CriticalSection); |