summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-03-16 14:38:41 +0100
committerHowaner <franzi.moos@googlemail.com>2014-03-27 23:20:28 +0100
commitc4a8336e847d2f4731dd9d899d6af200631f8aef (patch)
treeb4032137f8033224894a190d0c799eb819989f22 /src/Bindings/PluginLua.cpp
parentAdd new leaves to all classes. (diff)
downloadcuberite-c4a8336e847d2f4731dd9d899d6af200631f8aef.tar
cuberite-c4a8336e847d2f4731dd9d899d6af200631f8aef.tar.gz
cuberite-c4a8336e847d2f4731dd9d899d6af200631f8aef.tar.bz2
cuberite-c4a8336e847d2f4731dd9d899d6af200631f8aef.tar.lz
cuberite-c4a8336e847d2f4731dd9d899d6af200631f8aef.tar.xz
cuberite-c4a8336e847d2f4731dd9d899d6af200631f8aef.tar.zst
cuberite-c4a8336e847d2f4731dd9d899d6af200631f8aef.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/PluginLua.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index cccbc3c93..cefeb4996 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -195,6 +195,26 @@ void cPluginLua::Tick(float a_Dt)
+bool cPluginLua::OnBlockSpread(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
+{
+ cCSLock Lock(m_CriticalSection);
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_BLOCK_SPREAD];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), a_World, a_BlockX, a_BlockY, a_BlockZ, cLuaState::Return, res);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginLua::OnBlockToPickups(cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups)
{
cCSLock Lock(m_CriticalSection);
@@ -1430,6 +1450,7 @@ const char * cPluginLua::GetHookFnName(int a_HookType)
{
switch (a_HookType)
{
+ case cPluginManager::HOOK_BLOCK_SPREAD: return "OnBlockSpread";
case cPluginManager::HOOK_BLOCK_TO_PICKUPS: return "OnBlockToPickups";
case cPluginManager::HOOK_CHAT: return "OnChat";
case cPluginManager::HOOK_CHUNK_AVAILABLE: return "OnChunkAvailable";