1
0

Added implementation of E_PLUGIN_CHUNK_GENERATING lua hook

It crashes the server when a plugin actually overrides default behavior though...

git-svn-id: http://mc-server.googlecode.com/svn/trunk@594 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth
2012-06-11 19:25:55 +00:00
parent 429ccb59b5
commit 373dac3204
11 changed files with 324 additions and 25 deletions

View File

@@ -363,6 +363,27 @@ void cPlugin_NewLua::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_Chun
bool cPlugin_NewLua::OnChunkGenerating( int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk )
{
cCSLock Lock(m_CriticalSection);
if (!PushFunction("OnChunkGenerating"))
return false;
tolua_pushnumber (m_LuaState, a_ChunkX);
tolua_pushnumber (m_LuaState, a_ChunkZ);
tolua_pushusertype(m_LuaState, a_pLuaChunk, "cLuaChunk");
if( !CallFunction(3, 1, "OnChunkGenerating") )
return false;
bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
return bRetVal;
}
cWebPlugin_Lua* cPlugin_NewLua::CreateWebPlugin(lua_State* a_LuaState)
{
cCSLock Lock( m_CriticalSection );