summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-06-13 12:47:01 +0200
committerarchshift <admin@archshift.com>2014-06-17 20:39:22 +0200
commitfa1d85feca6beee9e07cf92f015a883a190c726a (patch)
treeebbd3fad6e4de32e892277edce26d5e5a9c7192e /src/Bindings/PluginLua.cpp
parentEntity Effects: Clarified user, added it to AddEntityEffect (diff)
downloadcuberite-fa1d85feca6beee9e07cf92f015a883a190c726a.tar
cuberite-fa1d85feca6beee9e07cf92f015a883a190c726a.tar.gz
cuberite-fa1d85feca6beee9e07cf92f015a883a190c726a.tar.bz2
cuberite-fa1d85feca6beee9e07cf92f015a883a190c726a.tar.lz
cuberite-fa1d85feca6beee9e07cf92f015a883a190c726a.tar.xz
cuberite-fa1d85feca6beee9e07cf92f015a883a190c726a.tar.zst
cuberite-fa1d85feca6beee9e07cf92f015a883a190c726a.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 04639da60..09ffa6064 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -420,6 +420,26 @@ bool cPluginLua::OnDisconnect(cClientHandle & a_Client, const AString & a_Reason
+bool cPluginLua::OnEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, cEntity * a_Originator, double a_DistanceModifier)
+{
+ cCSLock Lock(m_CriticalSection);
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_ADD_EFFECT];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_Entity, a_EffectType, a_EffectDurationTicks, a_EffectIntensity, a_Originator, a_DistanceModifier, cLuaState::Return, res);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginLua::OnExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split)
{
cCSLock Lock(m_CriticalSection);
@@ -1507,6 +1527,7 @@ const char * cPluginLua::GetHookFnName(int a_HookType)
case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe";
case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect";
case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation";
+ case cPluginManager::HOOK_ENTITY_ADD_EFFECT: return "OnEntityAddEffect";
case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand";
case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake";
case cPluginManager::HOOK_KILLING: return "OnKilling";