diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-03-29 16:00:45 +0100 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-03-29 16:00:45 +0100 |
commit | ec4638a228edcf4c745088838e972ea07edc7cba (patch) | |
tree | 280182543c9788b7bc19bcc47c1a7ed2dc4ba3db /src/Bindings/PluginLua.cpp | |
parent | Fixed error when the hook gets called. (diff) | |
download | cuberite-ec4638a228edcf4c745088838e972ea07edc7cba.tar cuberite-ec4638a228edcf4c745088838e972ea07edc7cba.tar.gz cuberite-ec4638a228edcf4c745088838e972ea07edc7cba.tar.bz2 cuberite-ec4638a228edcf4c745088838e972ea07edc7cba.tar.lz cuberite-ec4638a228edcf4c745088838e972ea07edc7cba.tar.xz cuberite-ec4638a228edcf4c745088838e972ea07edc7cba.tar.zst cuberite-ec4638a228edcf4c745088838e972ea07edc7cba.zip |
Diffstat (limited to '')
-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 d4e4b3ee8..7e69e0f4b 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1108,6 +1108,26 @@ bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a +bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PROJECTILE_HIT_BLOCK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Projectile, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + bool cPluginLua::OnProjectileHitEntity(cProjectileEntity & a_Projectile, cEntity & a_HitEntity) { cCSLock Lock(m_CriticalSection); |