summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-05 17:20:48 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-05 17:20:48 +0200
commitd832996e198605c20760c72433e35beca3192a5a (patch)
treeaedaefb6b7753a14eb27c7c6fd3e8e3a3b7c3df3 /source
parentFixed previous commit's recipes and items. (diff)
downloadcuberite-d832996e198605c20760c72433e35beca3192a5a.tar
cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.gz
cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.bz2
cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.lz
cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.xz
cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.zst
cuberite-d832996e198605c20760c72433e35beca3192a5a.zip
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp924
-rw-r--r--source/Bindings.h2
-rw-r--r--source/cChunkGenerator.cpp4
-rw-r--r--source/cPlugin.h10
-rw-r--r--source/cPluginManager.cpp19
-rw-r--r--source/cPluginManager.h34
-rw-r--r--source/cPlugin_NewLua.cpp66
-rw-r--r--source/cPlugin_NewLua.h26
-rw-r--r--source/cRoot.cpp49
-rw-r--r--source/cRoot.h9
10 files changed, 287 insertions, 856 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 852e9e3b2..257e588b4 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 06/04/12 10:48:42.
+** Generated automatically by tolua++-1.0.92 on 06/05/12 17:10:07.
*/
#ifndef __cplusplus
@@ -7433,6 +7433,43 @@ static int tolua_AllToLua_cPlugin_OnKilled00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: OnChunkGenerated of class cPlugin */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_OnChunkGenerated00
+static int tolua_AllToLua_cPlugin_OnChunkGenerated00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0);
+ cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0));
+ int a_ChunkX = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_ChunkZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnChunkGenerated'", NULL);
+#endif
+ {
+ self->OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnChunkGenerated'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: GetName of class cPlugin */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetName00
static int tolua_AllToLua_cPlugin_GetName00(lua_State* tolua_S)
@@ -7846,6 +7883,16 @@ public:
return ( bool ) cPlugin:: OnKilled(a_Killed,a_Killer);
};
};
+ void OnChunkGenerated( cWorld* a_World, int a_ChunkX, int a_ChunkZ) {
+ if (push_method("OnChunkGenerated", tolua_AllToLua_cPlugin_OnChunkGenerated00)) {
+ tolua_pushusertype(lua_state, (void*)a_World, "cWorld");
+ tolua_pushnumber(lua_state, (lua_Number)a_ChunkX);
+ tolua_pushnumber(lua_state, (lua_Number)a_ChunkZ);
+ ToluaBase::dbcall(lua_state, 4, 0);
+ } else {
+ return ( void ) cPlugin:: OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
+ };
+ };
void cPlugin__OnDisable( void ) {
return ( void )cPlugin::OnDisable();
@@ -7886,6 +7933,9 @@ public:
bool cPlugin__OnKilled( cPawn* a_Killed, cEntity* a_Killer) {
return ( bool )cPlugin::OnKilled(a_Killed,a_Killer);
};
+ void cPlugin__OnChunkGenerated( cWorld* a_World, int a_ChunkX, int a_ChunkZ) {
+ return ( void )cPlugin::OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
+ };
Lua__cPlugin( void ): cPlugin(){};
};
@@ -8373,6 +8423,43 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnKilled00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: cPlugin__OnChunkGenerated of class Lua__cPlugin */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerated00
+static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerated00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin* self = (Lua__cPlugin*) tolua_tousertype(tolua_S,1,0);
+ cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0));
+ int a_ChunkX = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_ChunkZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin__OnChunkGenerated'", NULL);
+#endif
+ {
+ self->cPlugin__OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin__OnChunkGenerated'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: new of class Lua__cPlugin */
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_new00
static int tolua_AllToLua_Lua__cPlugin_new00(lua_State* tolua_S)
@@ -8567,393 +8654,6 @@ static int tolua_AllToLua_cPlugin_NewLua_Tick00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
-/* method: OnCollectItem of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnCollectItem00
-static int tolua_AllToLua_cPlugin_NewLua_OnCollectItem00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPickup",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPickup* a_Pickup = ((cPickup*) tolua_tousertype(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnCollectItem'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->OnCollectItem(a_Pickup,a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnCollectItem'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnDisconnect of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnDisconnect00
-static int tolua_AllToLua_cPlugin_NewLua_OnDisconnect00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- std::string a_Reason = ((std::string) tolua_tocppstring(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnDisconnect'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->OnDisconnect(a_Reason,a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnDisconnect'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnBlockPlace of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnBlockPlace00
-static int tolua_AllToLua_cPlugin_NewLua_OnBlockPlace00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPacket_BlockPlace",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPacket_BlockPlace* a_PacketData = ((cPacket_BlockPlace*) tolua_tousertype(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnBlockPlace'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->OnBlockPlace(a_PacketData,a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnBlockPlace'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnBlockDig of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnBlockDig00
-static int tolua_AllToLua_cPlugin_NewLua_OnBlockDig00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPacket_BlockDig",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,4,"cItem",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,5,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPacket_BlockDig* a_PacketData = ((cPacket_BlockDig*) tolua_tousertype(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
- cItem* a_PickupItem = ((cItem*) tolua_tousertype(tolua_S,4,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnBlockDig'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->OnBlockDig(a_PacketData,a_Player,a_PickupItem);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnBlockDig'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnChat of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnChat00
-static int tolua_AllToLua_cPlugin_NewLua_OnChat00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- const char* a_Chat = ((const char*) tolua_tostring(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnChat'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->OnChat(a_Chat,a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnChat'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnLogin of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnLogin00
-static int tolua_AllToLua_cPlugin_NewLua_OnLogin00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPacket_Login",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPacket_Login* a_PacketData = ((cPacket_Login*) tolua_tousertype(tolua_S,2,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnLogin'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->OnLogin(a_PacketData);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnLogin'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnPlayerSpawn of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnPlayerSpawn00
-static int tolua_AllToLua_cPlugin_NewLua_OnPlayerSpawn00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnPlayerSpawn'", NULL);
-#endif
- {
- self->OnPlayerSpawn(a_Player);
- }
- }
- return 0;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnPlayerSpawn'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnPlayerJoin of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00
-static int tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnPlayerJoin'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->OnPlayerJoin(a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnPlayerJoin'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnPlayerMove of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnPlayerMove00
-static int tolua_AllToLua_cPlugin_NewLua_OnPlayerMove00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnPlayerMove'", NULL);
-#endif
- {
- self->OnPlayerMove(a_Player);
- }
- }
- return 0;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnPlayerMove'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnTakeDamage of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnTakeDamage00
-static int tolua_AllToLua_cPlugin_NewLua_OnTakeDamage00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPawn",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"TakeDamageInfo",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPawn* a_Pawn = ((cPawn*) tolua_tousertype(tolua_S,2,0));
- TakeDamageInfo* a_TakeDamageInfo = ((TakeDamageInfo*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnTakeDamage'", NULL);
-#endif
- {
- self->OnTakeDamage(a_Pawn,a_TakeDamageInfo);
- }
- }
- return 0;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnTakeDamage'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: OnKilled of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnKilled00
-static int tolua_AllToLua_cPlugin_NewLua_OnKilled00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPawn",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cEntity",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPawn* a_Killed = ((cPawn*) tolua_tousertype(tolua_S,2,0));
- cEntity* a_Killer = ((cEntity*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnKilled'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->OnKilled(a_Killed,a_Killer);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnKilled'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
/* method: CreateWebPlugin of class cPlugin_NewLua */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_CreateWebPlugin00
static int tolua_AllToLua_cPlugin_NewLua_CreateWebPlugin00(lua_State* tolua_S)
@@ -9015,7 +8715,7 @@ public:
};
};
bool OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player) {
- if (push_method("OnCollectItem", tolua_AllToLua_cPlugin_NewLua_OnCollectItem00)) {
+ if (push_method("OnCollectItem", tolua_AllToLua_cPlugin_OnCollectItem00)) {
tolua_pushusertype(lua_state, (void*)a_Pickup, "cPickup");
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 3, 1);
@@ -9027,7 +8727,7 @@ public:
};
};
bool OnDisconnect( std::string a_Reason, cPlayer* a_Player) {
- if (push_method("OnDisconnect", tolua_AllToLua_cPlugin_NewLua_OnDisconnect00)) {
+ if (push_method("OnDisconnect", tolua_AllToLua_cPlugin_OnDisconnect00)) {
tolua_pushcppstring(lua_state, (const char*)a_Reason);
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 3, 1);
@@ -9039,7 +8739,7 @@ public:
};
};
bool OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player) {
- if (push_method("OnBlockPlace", tolua_AllToLua_cPlugin_NewLua_OnBlockPlace00)) {
+ if (push_method("OnBlockPlace", tolua_AllToLua_cPlugin_OnBlockPlace00)) {
tolua_pushusertype(lua_state, (void*)a_PacketData, "cPacket_BlockPlace");
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 3, 1);
@@ -9051,7 +8751,7 @@ public:
};
};
bool OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem) {
- if (push_method("OnBlockDig", tolua_AllToLua_cPlugin_NewLua_OnBlockDig00)) {
+ if (push_method("OnBlockDig", tolua_AllToLua_cPlugin_OnBlockDig00)) {
tolua_pushusertype(lua_state, (void*)a_PacketData, "cPacket_BlockDig");
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
tolua_pushusertype(lua_state, (void*)a_PickupItem, "cItem");
@@ -9064,7 +8764,7 @@ public:
};
};
bool OnChat( const char* a_Chat, cPlayer* a_Player) {
- if (push_method("OnChat", tolua_AllToLua_cPlugin_NewLua_OnChat00)) {
+ if (push_method("OnChat", tolua_AllToLua_cPlugin_OnChat00)) {
tolua_pushstring(lua_state, (const char*)a_Chat);
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 3, 1);
@@ -9076,7 +8776,7 @@ public:
};
};
bool OnLogin( cPacket_Login* a_PacketData) {
- if (push_method("OnLogin", tolua_AllToLua_cPlugin_NewLua_OnLogin00)) {
+ if (push_method("OnLogin", tolua_AllToLua_cPlugin_OnLogin00)) {
tolua_pushusertype(lua_state, (void*)a_PacketData, "cPacket_Login");
ToluaBase::dbcall(lua_state, 2, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
@@ -9087,7 +8787,7 @@ public:
};
};
void OnPlayerSpawn( cPlayer* a_Player) {
- if (push_method("OnPlayerSpawn", tolua_AllToLua_cPlugin_NewLua_OnPlayerSpawn00)) {
+ if (push_method("OnPlayerSpawn", tolua_AllToLua_cPlugin_OnPlayerSpawn00)) {
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 2, 0);
} else {
@@ -9095,7 +8795,7 @@ public:
};
};
bool OnPlayerJoin( cPlayer* a_Player) {
- if (push_method("OnPlayerJoin", tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00)) {
+ if (push_method("OnPlayerJoin", tolua_AllToLua_cPlugin_OnPlayerJoin00)) {
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 2, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
@@ -9106,7 +8806,7 @@ public:
};
};
void OnPlayerMove( cPlayer* a_Player) {
- if (push_method("OnPlayerMove", tolua_AllToLua_cPlugin_NewLua_OnPlayerMove00)) {
+ if (push_method("OnPlayerMove", tolua_AllToLua_cPlugin_OnPlayerMove00)) {
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 2, 0);
} else {
@@ -9114,7 +8814,7 @@ public:
};
};
void OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo) {
- if (push_method("OnTakeDamage", tolua_AllToLua_cPlugin_NewLua_OnTakeDamage00)) {
+ if (push_method("OnTakeDamage", tolua_AllToLua_cPlugin_OnTakeDamage00)) {
tolua_pushusertype(lua_state, (void*)a_Pawn, "cPawn");
tolua_pushusertype(lua_state, (void*)a_TakeDamageInfo, "TakeDamageInfo");
ToluaBase::dbcall(lua_state, 3, 0);
@@ -9123,7 +8823,7 @@ public:
};
};
bool OnKilled( cPawn* a_Killed, cEntity* a_Killer) {
- if (push_method("OnKilled", tolua_AllToLua_cPlugin_NewLua_OnKilled00)) {
+ if (push_method("OnKilled", tolua_AllToLua_cPlugin_OnKilled00)) {
tolua_pushusertype(lua_state, (void*)a_Killed, "cPawn");
tolua_pushusertype(lua_state, (void*)a_Killer, "cEntity");
ToluaBase::dbcall(lua_state, 3, 1);
@@ -9134,6 +8834,16 @@ public:
return ( bool ) cPlugin_NewLua:: OnKilled(a_Killed,a_Killer);
};
};
+ void OnChunkGenerated( cWorld* a_World, int a_ChunkX, int a_ChunkZ) {
+ if (push_method("OnChunkGenerated", tolua_AllToLua_cPlugin_OnChunkGenerated00)) {
+ tolua_pushusertype(lua_state, (void*)a_World, "cWorld");
+ tolua_pushnumber(lua_state, (lua_Number)a_ChunkX);
+ tolua_pushnumber(lua_state, (lua_Number)a_ChunkZ);
+ ToluaBase::dbcall(lua_state, 4, 0);
+ } else {
+ return ( void ) cPlugin_NewLua:: OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
+ };
+ };
void cPlugin_NewLua__OnDisable( void ) {
return ( void )cPlugin_NewLua::OnDisable();
@@ -9177,6 +8887,9 @@ public:
bool cPlugin_NewLua__OnKilled( cPawn* a_Killed, cEntity* a_Killer) {
return ( bool )cPlugin_NewLua::OnKilled(a_Killed,a_Killer);
};
+ void cPlugin_NewLua__OnChunkGenerated( cWorld* a_World, int a_ChunkX, int a_ChunkZ) {
+ return ( void )cPlugin_NewLua::OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
+ };
};
/* method: tolua__set_instance of class Lua__cPlugin_NewLua */
@@ -9308,393 +9021,6 @@ static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__Tick00(lua_State*
}
#endif //#ifndef TOLUA_DISABLE
-/* method: cPlugin_NewLua__OnCollectItem of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnCollectItem00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnCollectItem00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPickup",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPickup* a_Pickup = ((cPickup*) tolua_tousertype(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnCollectItem'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnCollectItem(a_Pickup,a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnCollectItem'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnDisconnect of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisconnect00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisconnect00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- std::string a_Reason = ((std::string) tolua_tocppstring(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnDisconnect'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnDisconnect(a_Reason,a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnDisconnect'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnBlockPlace of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockPlace00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockPlace00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPacket_BlockPlace",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPacket_BlockPlace* a_PacketData = ((cPacket_BlockPlace*) tolua_tousertype(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnBlockPlace'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnBlockPlace(a_PacketData,a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnBlockPlace'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnBlockDig of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockDig00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockDig00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPacket_BlockDig",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,4,"cItem",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,5,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPacket_BlockDig* a_PacketData = ((cPacket_BlockDig*) tolua_tousertype(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
- cItem* a_PickupItem = ((cItem*) tolua_tousertype(tolua_S,4,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnBlockDig'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnBlockDig(a_PacketData,a_Player,a_PickupItem);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnBlockDig'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnChat of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnChat00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnChat00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- const char* a_Chat = ((const char*) tolua_tostring(tolua_S,2,0));
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnChat'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnChat(a_Chat,a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnChat'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnLogin of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPacket_Login",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPacket_Login* a_PacketData = ((cPacket_Login*) tolua_tousertype(tolua_S,2,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnLogin'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnLogin(a_PacketData);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnLogin'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnPlayerSpawn of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerSpawn00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerSpawn00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnPlayerSpawn'", NULL);
-#endif
- {
- self->cPlugin_NewLua__OnPlayerSpawn(a_Player);
- }
- }
- return 0;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnPlayerSpawn'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnPlayerJoin of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnPlayerJoin'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnPlayerJoin(a_Player);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnPlayerJoin'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnPlayerMove of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerMove00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerMove00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnPlayerMove'", NULL);
-#endif
- {
- self->cPlugin_NewLua__OnPlayerMove(a_Player);
- }
- }
- return 0;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnPlayerMove'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnTakeDamage of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnTakeDamage00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnTakeDamage00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPawn",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"TakeDamageInfo",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPawn* a_Pawn = ((cPawn*) tolua_tousertype(tolua_S,2,0));
- TakeDamageInfo* a_TakeDamageInfo = ((TakeDamageInfo*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnTakeDamage'", NULL);
-#endif
- {
- self->cPlugin_NewLua__OnTakeDamage(a_Pawn,a_TakeDamageInfo);
- }
- }
- return 0;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnTakeDamage'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* method: cPlugin_NewLua__OnKilled of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnKilled00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnKilled00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPawn",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,3,"cEntity",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPawn* a_Killed = ((cPawn*) tolua_tousertype(tolua_S,2,0));
- cEntity* a_Killer = ((cEntity*) tolua_tousertype(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnKilled'", NULL);
-#endif
- {
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnKilled(a_Killed,a_Killer);
- tolua_pushboolean(tolua_S,(bool)tolua_ret);
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnKilled'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
/* method: GetFileName of class cPlugin_Lua */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_Lua_GetFileName00
static int tolua_AllToLua_cPlugin_Lua_GetFileName00(lua_State* tolua_S)
@@ -18458,6 +17784,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_PLUGIN_PLAYER_MOVE",cPluginManager::E_PLUGIN_PLAYER_MOVE);
tolua_constant(tolua_S,"E_PLUGIN_TAKE_DAMAGE",cPluginManager::E_PLUGIN_TAKE_DAMAGE);
tolua_constant(tolua_S,"E_PLUGIN_KILLED",cPluginManager::E_PLUGIN_KILLED);
+ tolua_constant(tolua_S,"E_PLUGIN_CHUNK_GENERATED",cPluginManager::E_PLUGIN_CHUNK_GENERATED);
+ tolua_constant(tolua_S,"E_PLUGIN_CHUNK_GENERATING",cPluginManager::E_PLUGIN_CHUNK_GENERATING);
tolua_function(tolua_S,"GetPluginManager",tolua_AllToLua_cPluginManager_GetPluginManager00);
tolua_function(tolua_S,"GetPlugin",tolua_AllToLua_cPluginManager_GetPlugin00);
tolua_function(tolua_S,"ReloadPlugins",tolua_AllToLua_cPluginManager_ReloadPlugins00);
@@ -18489,6 +17817,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"OnPlayerMove",tolua_AllToLua_cPlugin_OnPlayerMove00);
tolua_function(tolua_S,"OnTakeDamage",tolua_AllToLua_cPlugin_OnTakeDamage00);
tolua_function(tolua_S,"OnKilled",tolua_AllToLua_cPlugin_OnKilled00);
+ tolua_function(tolua_S,"OnChunkGenerated",tolua_AllToLua_cPlugin_OnChunkGenerated00);
tolua_function(tolua_S,"GetName",tolua_AllToLua_cPlugin_GetName00);
tolua_function(tolua_S,"SetName",tolua_AllToLua_cPlugin_SetName00);
tolua_function(tolua_S,"GetVersion",tolua_AllToLua_cPlugin_GetVersion00);
@@ -18521,6 +17850,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"cPlugin__OnPlayerMove",tolua_AllToLua_Lua__cPlugin_cPlugin__OnPlayerMove00);
tolua_function(tolua_S,"cPlugin__OnTakeDamage",tolua_AllToLua_Lua__cPlugin_cPlugin__OnTakeDamage00);
tolua_function(tolua_S,"cPlugin__OnKilled",tolua_AllToLua_Lua__cPlugin_cPlugin__OnKilled00);
+ tolua_function(tolua_S,"cPlugin__OnChunkGenerated",tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerated00);
tolua_function(tolua_S,"new",tolua_AllToLua_Lua__cPlugin_new00);
tolua_function(tolua_S,"new_local",tolua_AllToLua_Lua__cPlugin_new00_local);
tolua_function(tolua_S,".call",tolua_AllToLua_Lua__cPlugin_new00_local);
@@ -18531,17 +17861,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"OnDisable",tolua_AllToLua_cPlugin_NewLua_OnDisable00);
tolua_function(tolua_S,"Initialize",tolua_AllToLua_cPlugin_NewLua_Initialize00);
tolua_function(tolua_S,"Tick",tolua_AllToLua_cPlugin_NewLua_Tick00);
- tolua_function(tolua_S,"OnCollectItem",tolua_AllToLua_cPlugin_NewLua_OnCollectItem00);
- tolua_function(tolua_S,"OnDisconnect",tolua_AllToLua_cPlugin_NewLua_OnDisconnect00);
- tolua_function(tolua_S,"OnBlockPlace",tolua_AllToLua_cPlugin_NewLua_OnBlockPlace00);
- tolua_function(tolua_S,"OnBlockDig",tolua_AllToLua_cPlugin_NewLua_OnBlockDig00);
- tolua_function(tolua_S,"OnChat",tolua_AllToLua_cPlugin_NewLua_OnChat00);
- tolua_function(tolua_S,"OnLogin",tolua_AllToLua_cPlugin_NewLua_OnLogin00);
- tolua_function(tolua_S,"OnPlayerSpawn",tolua_AllToLua_cPlugin_NewLua_OnPlayerSpawn00);
- tolua_function(tolua_S,"OnPlayerJoin",tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00);
- tolua_function(tolua_S,"OnPlayerMove",tolua_AllToLua_cPlugin_NewLua_OnPlayerMove00);
- tolua_function(tolua_S,"OnTakeDamage",tolua_AllToLua_cPlugin_NewLua_OnTakeDamage00);
- tolua_function(tolua_S,"OnKilled",tolua_AllToLua_cPlugin_NewLua_OnKilled00);
tolua_function(tolua_S,"CreateWebPlugin",tolua_AllToLua_cPlugin_NewLua_CreateWebPlugin00);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"Lua__cPlugin_NewLua","Lua__cPlugin_NewLua","cPlugin_NewLua",NULL);
@@ -18550,17 +17869,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"cPlugin_NewLua__OnDisable",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisable00);
tolua_function(tolua_S,"cPlugin_NewLua__Initialize",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__Initialize00);
tolua_function(tolua_S,"cPlugin_NewLua__Tick",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__Tick00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnCollectItem",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnCollectItem00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnDisconnect",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisconnect00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnBlockPlace",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockPlace00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnBlockDig",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockDig00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnChat",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnChat00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnLogin",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnPlayerSpawn",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerSpawn00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnPlayerJoin",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnPlayerMove",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerMove00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnTakeDamage",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnTakeDamage00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnKilled",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnKilled00);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cPlugin_Lua","cPlugin_Lua","",NULL);
tolua_beginmodule(tolua_S,"cPlugin_Lua");
diff --git a/source/Bindings.h b/source/Bindings.h
index 03dab9b9b..707a60575 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 06/04/12 10:48:42.
+** Generated automatically by tolua++-1.0.92 on 06/05/12 17:10:08.
*/
/* Exported function */
diff --git a/source/cChunkGenerator.cpp b/source/cChunkGenerator.cpp
index 31df6ba5d..14008add7 100644
--- a/source/cChunkGenerator.cpp
+++ b/source/cChunkGenerator.cpp
@@ -9,6 +9,8 @@
#include "CompoGen.h"
#include "StructGen.h"
#include "FinishGen.h"
+#include "cRoot.h"
+#include "cPluginManager.h"
@@ -484,6 +486,8 @@ void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
Entities, BlockEntities,
true
);
+
+ cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::E_PLUGIN_CHUNK_GENERATED, 3, m_World, a_ChunkX, a_ChunkZ);
}
diff --git a/source/cPlugin.h b/source/cPlugin.h
index 5e9ee1601..3b29b604f 100644
--- a/source/cPlugin.h
+++ b/source/cPlugin.h
@@ -13,8 +13,13 @@ class cPickup;
class cItem;
class cEntity;
class cPawn;
+class cWorld;
struct TakeDamageInfo;
+
+
+
+
// tolua_begin
class cPlugin
{
@@ -43,6 +48,7 @@ public:
virtual void OnPlayerMove( cPlayer* a_Player ) { (void)a_Player; }
virtual void OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo ) { (void)a_Pawn; (void)a_TakeDamageInfo; }
virtual bool OnKilled( cPawn* a_Killed, cEntity* a_Killer ) { (void)a_Killed; (void)a_Killer; return false; }
+ virtual void OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ) {}
// Accessors
const char* GetName() const { return m_Name.c_str(); }
@@ -85,3 +91,7 @@ private:
std::string m_Name;
int m_Version;
}; //tolua_export
+
+
+
+
diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp
index 0b1d11299..40e8d2b95 100644
--- a/source/cPluginManager.cpp
+++ b/source/cPluginManager.cpp
@@ -363,6 +363,25 @@ bool cPluginManager::CallHook( PluginHook a_Hook, unsigned int a_NumArgs, ... )
break;
}
+ case E_PLUGIN_CHUNK_GENERATED:
+ {
+ if (a_NumArgs != 3)
+ {
+ break;
+ }
+ va_list argptr;
+ va_start( argptr, a_NumArgs);
+ cWorld * World = va_arg(argptr, cWorld *);
+ int ChunkX = va_arg(argptr, int);
+ int ChunkZ = va_arg(argptr, int);
+ va_end (argptr);
+ for( PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr )
+ {
+ (*itr)->OnChunkGenerated(World, ChunkX, ChunkZ);
+ }
+ break;
+ }
+
default:
{
LOGWARNING("cPluginManager: Calling Unknown hook: %i", a_Hook );
diff --git a/source/cPluginManager.h b/source/cPluginManager.h
index d2099ebd7..b6983a5e3 100644
--- a/source/cPluginManager.h
+++ b/source/cPluginManager.h
@@ -12,22 +12,24 @@ public: //tolua_export
// Called each tick
virtual void Tick(float a_Dt);
- enum PluginHook //tolua_export
- { //tolua_export
- E_PLUGIN_TICK, //tolua_export
- E_PLUGIN_CHAT, //tolua_export
- E_PLUGIN_COLLECT_ITEM, //tolua_export
- E_PLUGIN_BLOCK_DIG, //tolua_export
- E_PLUGIN_BLOCK_PLACE, //tolua_export
- E_PLUGIN_DISCONNECT, //tolua_export
- E_PLUGIN_HANDSHAKE, //tolua_export
- E_PLUGIN_LOGIN, //tolua_export
- E_PLUGIN_PLAYER_SPAWN, //tolua_export
- E_PLUGIN_PLAYER_JOIN, //tolua_export
- E_PLUGIN_PLAYER_MOVE, //tolua_export
- E_PLUGIN_TAKE_DAMAGE, //tolua_export
- E_PLUGIN_KILLED, //tolua_export
- }; //tolua_export
+ enum PluginHook // tolua_export
+ { // tolua_export
+ E_PLUGIN_TICK, // tolua_export
+ E_PLUGIN_CHAT, // tolua_export
+ E_PLUGIN_COLLECT_ITEM, // tolua_export
+ E_PLUGIN_BLOCK_DIG, // tolua_export
+ E_PLUGIN_BLOCK_PLACE, // tolua_export
+ E_PLUGIN_DISCONNECT, // tolua_export
+ E_PLUGIN_HANDSHAKE, // tolua_export
+ E_PLUGIN_LOGIN, // tolua_export
+ E_PLUGIN_PLAYER_SPAWN, // tolua_export
+ E_PLUGIN_PLAYER_JOIN, // tolua_export
+ E_PLUGIN_PLAYER_MOVE, // tolua_export
+ E_PLUGIN_TAKE_DAMAGE, // tolua_export
+ E_PLUGIN_KILLED, // tolua_export
+ E_PLUGIN_CHUNK_GENERATED, // tolua_export
+ E_PLUGIN_CHUNK_GENERATING, // tolua_export
+ }; // tolua_export
static cPluginManager * GetPluginManager(); //tolua_export
diff --git a/source/cPlugin_NewLua.cpp b/source/cPlugin_NewLua.cpp
index bae24d0ff..1b617f1ef 100644
--- a/source/cPlugin_NewLua.cpp
+++ b/source/cPlugin_NewLua.cpp
@@ -135,6 +135,10 @@ void cPlugin_NewLua::Tick(float a_Dt)
CallFunction(1, 0, "Tick");
}
+
+
+
+
bool cPlugin_NewLua::OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player )
{
cCSLock Lock( m_CriticalSection );
@@ -151,6 +155,10 @@ bool cPlugin_NewLua::OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player )
return bRetVal;
}
+
+
+
+
bool cPlugin_NewLua::OnDisconnect( std::string a_Reason, cPlayer* a_Player )
{
cCSLock Lock( m_CriticalSection );
@@ -167,6 +175,10 @@ bool cPlugin_NewLua::OnDisconnect( std::string a_Reason, cPlayer* a_Player )
return bRetVal;
}
+
+
+
+
bool cPlugin_NewLua::OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player )
{
cCSLock Lock( m_CriticalSection );
@@ -183,6 +195,10 @@ bool cPlugin_NewLua::OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_
return bRetVal;
}
+
+
+
+
bool cPlugin_NewLua::OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem )
{
cCSLock Lock( m_CriticalSection );
@@ -200,6 +216,10 @@ bool cPlugin_NewLua::OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Play
return bRetVal;
}
+
+
+
+
bool cPlugin_NewLua::OnChat( const char* a_Chat, cPlayer* a_Player )
{
cCSLock Lock( m_CriticalSection );
@@ -216,6 +236,10 @@ bool cPlugin_NewLua::OnChat( const char* a_Chat, cPlayer* a_Player )
return bRetVal;
}
+
+
+
+
bool cPlugin_NewLua::OnLogin( cPacket_Login* a_PacketData )
{
cCSLock Lock( m_CriticalSection );
@@ -231,6 +255,10 @@ bool cPlugin_NewLua::OnLogin( cPacket_Login* a_PacketData )
return bRetVal;
}
+
+
+
+
void cPlugin_NewLua::OnPlayerSpawn( cPlayer* a_Player )
{
cCSLock Lock( m_CriticalSection );
@@ -242,6 +270,10 @@ void cPlugin_NewLua::OnPlayerSpawn( cPlayer* a_Player )
CallFunction(1, 0, "OnPlayerSpawn");
}
+
+
+
+
bool cPlugin_NewLua::OnPlayerJoin( cPlayer* a_Player )
{
cCSLock Lock( m_CriticalSection );
@@ -257,6 +289,10 @@ bool cPlugin_NewLua::OnPlayerJoin( cPlayer* a_Player )
return bRetVal;
}
+
+
+
+
void cPlugin_NewLua::OnPlayerMove( cPlayer* a_Player )
{
cCSLock Lock( m_CriticalSection );
@@ -268,6 +304,10 @@ void cPlugin_NewLua::OnPlayerMove( cPlayer* a_Player )
CallFunction(1, 0, "OnPlayerMove");
}
+
+
+
+
void cPlugin_NewLua::OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo )
{
cCSLock Lock( m_CriticalSection );
@@ -280,6 +320,10 @@ void cPlugin_NewLua::OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageIn
CallFunction(2, 0, "OnTakeDamage");
}
+
+
+
+
bool cPlugin_NewLua::OnKilled( cPawn* a_Killed, cEntity* a_Killer )
{
cCSLock Lock( m_CriticalSection );
@@ -297,6 +341,28 @@ bool cPlugin_NewLua::OnKilled( cPawn* a_Killed, cEntity* a_Killer )
}
+
+
+
+void cPlugin_NewLua::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ)
+{
+ cCSLock Lock(m_CriticalSection);
+ if (!PushFunction("OnChunkGenerated"))
+ {
+ return;
+ }
+
+ tolua_pushusertype(m_LuaState, a_World, "cWorld");
+ tolua_pushnumber (m_LuaState, a_ChunkX);
+ tolua_pushnumber (m_LuaState, a_ChunkZ);
+
+ CallFunction(3, 0, "OnChunkGenerated");
+}
+
+
+
+
+
cWebPlugin_Lua* cPlugin_NewLua::CreateWebPlugin(lua_State* a_LuaState)
{
cCSLock Lock( m_CriticalSection );
diff --git a/source/cPlugin_NewLua.h b/source/cPlugin_NewLua.h
index 971f79b80..8fb2e9dc0 100644
--- a/source/cPlugin_NewLua.h
+++ b/source/cPlugin_NewLua.h
@@ -25,19 +25,19 @@ public: //tolua_export
virtual void Tick(float a_Dt); //tolua_export
- //tolua_begin
- virtual bool OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player );
- virtual bool OnDisconnect( std::string a_Reason, cPlayer* a_Player );
- virtual bool OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player );
- virtual bool OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem );
- virtual bool OnChat( const char* a_Chat, cPlayer* a_Player );
- virtual bool OnLogin( cPacket_Login* a_PacketData );
- virtual void OnPlayerSpawn( cPlayer* a_Player );
- virtual bool OnPlayerJoin( cPlayer* a_Player );
- virtual void OnPlayerMove( cPlayer* a_Player );
- virtual void OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo );
- virtual bool OnKilled( cPawn* a_Killed, cEntity* a_Killer );
- //tolua_end
+ virtual bool OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player ) override;
+ virtual bool OnDisconnect( std::string a_Reason, cPlayer* a_Player ) override;
+ virtual bool OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player ) override;
+ virtual bool OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem ) override;
+ virtual bool OnChat( const char* a_Chat, cPlayer* a_Player ) override;
+ virtual bool OnLogin( cPacket_Login* a_PacketData ) override;
+ virtual void OnPlayerSpawn( cPlayer* a_Player ) override;
+ virtual bool OnPlayerJoin( cPlayer* a_Player ) override;
+ virtual void OnPlayerMove( cPlayer* a_Player ) override;
+ virtual void OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo ) override;
+ virtual bool OnKilled( cPawn* a_Killed, cEntity* a_Killer ) override;
+
+ virtual void OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
lua_State* GetLuaState() { return m_LuaState; }
diff --git a/source/cRoot.cpp b/source/cRoot.cpp
index 4220c0f41..69d854ee1 100644
--- a/source/cRoot.cpp
+++ b/source/cRoot.cpp
@@ -141,6 +141,9 @@ void cRoot::Start()
LOG("Starting Authenticator...");
m_Authenticator.Start();
+ LOG("Starting worlds...");
+ StartWorlds();
+
LOG("Starting server...");
m_Server->StartListenThread();
//cHeartBeat* HeartBeat = new cHeartBeat();
@@ -202,35 +205,49 @@ void cRoot::LoadGlobalSettings()
-void cRoot::LoadWorlds()
+void cRoot::LoadWorlds(void)
{
cIniFile IniFile("settings.ini"); IniFile.ReadFile();
// First get the default world
AString DefaultWorldName = IniFile.GetValue("Worlds", "DefaultWorld", "world");
m_pState->pDefaultWorld = new cWorld( DefaultWorldName.c_str() );
- m_pState->pDefaultWorld->InitializeSpawn();
m_pState->WorldsByName[ DefaultWorldName ] = m_pState->pDefaultWorld;
// Then load the other worlds
unsigned int KeyNum = IniFile.FindKey("Worlds");
unsigned int NumWorlds = IniFile.GetNumValues( KeyNum );
- if ( NumWorlds > 0 )
+ if (NumWorlds <= 0)
+ {
+ return;
+ }
+
+ for (unsigned int i = 0; i < NumWorlds; i++)
{
- for (unsigned int i = 0; i < NumWorlds; i++)
+ std::string ValueName = IniFile.GetValueName(KeyNum, i );
+ if (ValueName.compare("World") != 0)
{
- std::string ValueName = IniFile.GetValueName(KeyNum, i );
- if( ValueName.compare("World") == 0 )
- {
- std::string WorldName = IniFile.GetValue(KeyNum, i );
- if (!WorldName.empty())
- {
- cWorld* NewWorld = new cWorld( WorldName.c_str() );
- NewWorld->InitializeSpawn();
- m_pState->WorldsByName[ WorldName ] = NewWorld;
- }
- }
+ continue;
+ }
+ std::string WorldName = IniFile.GetValue(KeyNum, i );
+ if (WorldName.empty())
+ {
+ continue;
}
+ cWorld* NewWorld = new cWorld( WorldName.c_str() );
+ m_pState->WorldsByName[ WorldName ] = NewWorld;
+ } // for i - Worlds
+}
+
+
+
+
+
+void cRoot::StartWorlds(void)
+{
+ for( WorldMap::iterator itr = m_pState->WorldsByName.begin(); itr != m_pState->WorldsByName.end(); ++itr )
+ {
+ itr->second->InitializeSpawn();
}
}
@@ -238,7 +255,7 @@ void cRoot::LoadWorlds()
-void cRoot::UnloadWorlds()
+void cRoot::UnloadWorlds(void)
{
for( WorldMap::iterator itr = m_pState->WorldsByName.begin(); itr != m_pState->WorldsByName.end(); ++itr )
{
diff --git a/source/cRoot.h b/source/cRoot.h
index f1b9bb7ca..95edfe73a 100644
--- a/source/cRoot.h
+++ b/source/cRoot.h
@@ -74,8 +74,13 @@ public:
private:
void LoadGlobalSettings();
- void LoadWorlds();
- void UnloadWorlds();
+ /// Loads the worlds from settings.ini, creates the worldmap
+ void LoadWorlds(void);
+
+ /// Starts each world's life
+ void StartWorlds(void);
+
+ void UnloadWorlds(void);
cServer * m_Server;
cMonsterConfig * m_MonsterConfig;