diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-02 19:48:05 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-02 19:48:05 +0200 |
commit | f5659a08b8413bf756cd15308e66e7927cae8c9f (patch) | |
tree | 455172b964b2eb5eebb82b6366ce7ac2fb54fc48 /src/Bindings/PluginLua.cpp | |
parent | Fixed player teleport food drain (diff) | |
parent | Merge pull request #1139 from Howaner/Hooks (diff) | |
download | cuberite-f5659a08b8413bf756cd15308e66e7927cae8c9f.tar cuberite-f5659a08b8413bf756cd15308e66e7927cae8c9f.tar.gz cuberite-f5659a08b8413bf756cd15308e66e7927cae8c9f.tar.bz2 cuberite-f5659a08b8413bf756cd15308e66e7927cae8c9f.tar.lz cuberite-f5659a08b8413bf756cd15308e66e7927cae8c9f.tar.xz cuberite-f5659a08b8413bf756cd15308e66e7927cae8c9f.tar.zst cuberite-f5659a08b8413bf756cd15308e66e7927cae8c9f.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); |