From 71bbf2d44ba5fc00fcb15ed96aff083342309498 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 28 Jan 2013 16:54:11 +0000 Subject: Renamed HOOK_KILLED to HOOK_KILLING to match naming conventions. Also tweaked the mechanics so that plugins may revive without dropping other plugins out of the picture. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1182 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Plugin_NewLua.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'source/Plugin_NewLua.cpp') diff --git a/source/Plugin_NewLua.cpp b/source/Plugin_NewLua.cpp index 418c484ad..ed497e1a9 100644 --- a/source/Plugin_NewLua.cpp +++ b/source/Plugin_NewLua.cpp @@ -14,26 +14,23 @@ extern "C" #include "Bindings.h" #include "ManualBindings.h" -#ifdef _WIN32 -// #include "wdirent.h" -#else -#include -#endif +extern bool report_errors(lua_State * lua, int status); -extern bool report_errors(lua_State* lua, int status); +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cPlugin_NewLua: -cPlugin_NewLua::cPlugin_NewLua( const AString & a_PluginDirectory ) +cPlugin_NewLua::cPlugin_NewLua(const AString & a_PluginDirectory) : m_LuaState( 0 ) , cWebPlugin() - , cPlugin( a_PluginDirectory ) + , cPlugin(a_PluginDirectory) { } @@ -389,17 +386,17 @@ bool cPlugin_NewLua::OnHandshake(cClientHandle * a_Client, const AString & a_Use -bool cPlugin_NewLua::OnKilled(cPawn & a_Killed, cEntity * a_Killer) +bool cPlugin_NewLua::OnKilling(cPawn & a_Victim, cEntity * a_Killer) { cCSLock Lock(m_CriticalSection); - const char * FnName = GetHookFnName(cPluginManager::HOOK_KILLED); + const char * FnName = GetHookFnName(cPluginManager::HOOK_KILLING); ASSERT(FnName != NULL); if (!PushFunction(FnName)) { return false; } - tolua_pushusertype(m_LuaState, &a_Killed, "cPawn"); + tolua_pushusertype(m_LuaState, &a_Victim, "cPawn"); tolua_pushusertype(m_LuaState, a_Killer, "cEntity"); if (!CallFunction(2, 1, FnName)) @@ -1194,7 +1191,7 @@ const char * cPlugin_NewLua::GetHookFnName(cPluginManager::PluginHook a_Hook) case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe"; case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect"; case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake"; - case cPluginManager::HOOK_KILLED: return "OnKilled"; + case cPluginManager::HOOK_KILLING: return "OnKilling"; case cPluginManager::HOOK_LOGIN: return "OnLogin"; case cPluginManager::HOOK_PLAYER_BREAKING_BLOCK: return "OnPlayerBreakingBlock"; case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock"; -- cgit v1.2.3