summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authorNounours Heureux <schtroumps31@gmail.com>2015-06-02 17:06:18 +0200
committerNounours Heureux <schtroumps31@gmail.com>2015-06-13 10:00:31 +0200
commitd79f601d5a62f2291615955fac196dbab5caa15a (patch)
tree888f41c63844b9bd0336f9ef0ed585aa6a635883 /src/Bindings/PluginLua.cpp
parentNetherPortalScanner: Fixed type conversion warnings. (diff)
downloadcuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar
cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.gz
cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.bz2
cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.lz
cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.xz
cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.zst
cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.zip
Diffstat (limited to 'src/Bindings/PluginLua.cpp')
-rw-r--r--src/Bindings/PluginLua.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index d3ffcd0f4..9be4e0eb4 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -750,6 +750,30 @@ bool cPluginLua::OnHopperPushingItem(cWorld & a_World, cHopperEntity & a_Hopper,
+bool cPluginLua::OnKilled(cEntity & a_Victim, TakeDamageInfo & a_TDI, AString & a_DeathMessage)
+{
+ cCSLock Lock(m_CriticalSection);
+ if (!m_LuaState.IsValid())
+ {
+ return false;
+ }
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_KILLED];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_Victim, &a_TDI, a_DeathMessage, cLuaState::Return, res, a_DeathMessage);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginLua::OnKilling(cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI)
{
cCSLock Lock(m_CriticalSection);