From ee9e024bed46b794bfa035058127ab93131b2780 Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 13 Jun 2012 15:52:28 +0000 Subject: I think the chunk generation hooks for Lua are pretty good now, though it might still need some tweaking git-svn-id: http://mc-server.googlecode.com/svn/trunk@600 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Bindings.cpp | 536 +++++++++++++++++++++++++++++++++++++++++++-- source/Bindings.h | 2 +- source/cChunkGenerator.cpp | 26 ++- source/cLuaChunk.h | 126 +++++++++-- 4 files changed, 655 insertions(+), 35 deletions(-) diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 90cb4aa47..ac7e66a57 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on Wed Jun 13 02:33:14 2012. +** Generated automatically by tolua++-1.0.92 on 06/13/12 17:39:42. */ #ifndef __cplusplus @@ -13,8 +13,8 @@ /* Exported function */ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules -#include "tolua_base.h" +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules +#include "tolua_base.h" #include "cTorch.h" #include "cStairs.h" #include "cStep.h" @@ -18015,6 +18015,41 @@ static int tolua_set_cPacket_BlockPlace_m_Uses(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: FillBlocks of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_FillBlocks00 +static int tolua_AllToLua_cLuaChunk_FillBlocks00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + char a_BlockID = ((char) tolua_tonumber(tolua_S,2,0)); + unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillBlocks'", NULL); +#endif + { + self->FillBlocks(a_BlockID,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FillBlocks'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: SetBlock of class cLuaChunk */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetBlock00 static int tolua_AllToLua_cLuaChunk_SetBlock00(lua_State* tolua_S) @@ -18023,24 +18058,28 @@ static int tolua_AllToLua_cLuaChunk_SetBlock00(lua_State* tolua_S) tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnumber(tolua_S,2,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) + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) ) goto tolua_lerror; else #endif { cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); - const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - char a_BlockID = ((char) tolua_tonumber(tolua_S,3,0)); - unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,4,0)); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); + char a_BlockID = ((char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,6,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlock'", NULL); #endif { - self->SetBlock(*a_Pos,a_BlockID,a_BlockMeta); + self->SetBlock(a_X,a_Y,a_Z,a_BlockID,a_BlockMeta); } } return 0; @@ -18052,9 +18091,122 @@ static int tolua_AllToLua_cLuaChunk_SetBlock00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: FillBlocks of class cLuaChunk */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_FillBlocks00 -static int tolua_AllToLua_cLuaChunk_FillBlocks00(lua_State* tolua_S) +/* method: GetBlock of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_GetBlock00 +static int tolua_AllToLua_cLuaChunk_GetBlock00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,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 + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlock'", NULL); +#endif + { + char tolua_ret = (char) self->GetBlock(a_X,a_Y,a_Z); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlock'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockMeta of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_GetBlockMeta00 +static int tolua_AllToLua_cLuaChunk_GetBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,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 + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); +#endif + { + char tolua_ret = (char) self->GetBlockMeta(a_X,a_Y,a_Z); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBiome of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetBiome00 +static int tolua_AllToLua_cLuaChunk_SetBiome00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,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 + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BiomeID = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBiome'", NULL); +#endif + { + self->SetBiome(a_X,a_Z,a_BiomeID); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBiome'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBiome of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_GetBiome00 +static int tolua_AllToLua_cLuaChunk_GetBiome00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -18069,19 +18221,353 @@ static int tolua_AllToLua_cLuaChunk_FillBlocks00(lua_State* tolua_S) #endif { cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); - char a_BlockID = ((char) tolua_tonumber(tolua_S,2,0)); - unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,3,0)); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,3,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillBlocks'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBiome'", NULL); #endif { - self->FillBlocks(a_BlockID,a_BlockMeta); + int tolua_ret = (int) self->GetBiome(a_X,a_Z); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBiome'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetHeight of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetHeight00 +static int tolua_AllToLua_cLuaChunk_SetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,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 + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Height = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHeight'", NULL); +#endif + { + self->SetHeight(a_X,a_Z,a_Height); } } return 0; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FillBlocks'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'SetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHeight of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_GetHeight00 +static int tolua_AllToLua_cLuaChunk_GetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); +#endif + { + int tolua_ret = (int) self->GetHeight(a_X,a_Z); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultBiomes of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetUseDefaultBiomes00 +static int tolua_AllToLua_cLuaChunk_SetUseDefaultBiomes00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultBiomes = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultBiomes'", NULL); +#endif + { + self->SetUseDefaultBiomes(a_bUseDefaultBiomes); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultBiomes'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultBiomes of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_IsUsingDefaultBiomes00 +static int tolua_AllToLua_cLuaChunk_IsUsingDefaultBiomes00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultBiomes'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultBiomes(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultBiomes'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultComposition of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetUseDefaultComposition00 +static int tolua_AllToLua_cLuaChunk_SetUseDefaultComposition00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultComposition = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultComposition'", NULL); +#endif + { + self->SetUseDefaultComposition(a_bUseDefaultComposition); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultComposition'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultComposition of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_IsUsingDefaultComposition00 +static int tolua_AllToLua_cLuaChunk_IsUsingDefaultComposition00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultComposition'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultComposition(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultComposition'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultStructures of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetUseDefaultStructures00 +static int tolua_AllToLua_cLuaChunk_SetUseDefaultStructures00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultStructures = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultStructures'", NULL); +#endif + { + self->SetUseDefaultStructures(a_bUseDefaultStructures); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultStructures'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultStructures of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_IsUsingDefaultStructures00 +static int tolua_AllToLua_cLuaChunk_IsUsingDefaultStructures00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultStructures'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultStructures(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultStructures'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultFinish of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetUseDefaultFinish00 +static int tolua_AllToLua_cLuaChunk_SetUseDefaultFinish00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultFinish = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultFinish'", NULL); +#endif + { + self->SetUseDefaultFinish(a_bUseDefaultFinish); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultFinish'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultFinish of class cLuaChunk */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_IsUsingDefaultFinish00 +static int tolua_AllToLua_cLuaChunk_IsUsingDefaultFinish00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultFinish'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultFinish(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultFinish'.",&tolua_err); return 0; #endif } @@ -20196,8 +20682,22 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cLuaChunk","cLuaChunk","",NULL); tolua_beginmodule(tolua_S,"cLuaChunk"); - tolua_function(tolua_S,"SetBlock",tolua_AllToLua_cLuaChunk_SetBlock00); tolua_function(tolua_S,"FillBlocks",tolua_AllToLua_cLuaChunk_FillBlocks00); + tolua_function(tolua_S,"SetBlock",tolua_AllToLua_cLuaChunk_SetBlock00); + tolua_function(tolua_S,"GetBlock",tolua_AllToLua_cLuaChunk_GetBlock00); + tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cLuaChunk_GetBlockMeta00); + tolua_function(tolua_S,"SetBiome",tolua_AllToLua_cLuaChunk_SetBiome00); + tolua_function(tolua_S,"GetBiome",tolua_AllToLua_cLuaChunk_GetBiome00); + tolua_function(tolua_S,"SetHeight",tolua_AllToLua_cLuaChunk_SetHeight00); + tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cLuaChunk_GetHeight00); + tolua_function(tolua_S,"SetUseDefaultBiomes",tolua_AllToLua_cLuaChunk_SetUseDefaultBiomes00); + tolua_function(tolua_S,"IsUsingDefaultBiomes",tolua_AllToLua_cLuaChunk_IsUsingDefaultBiomes00); + tolua_function(tolua_S,"SetUseDefaultComposition",tolua_AllToLua_cLuaChunk_SetUseDefaultComposition00); + tolua_function(tolua_S,"IsUsingDefaultComposition",tolua_AllToLua_cLuaChunk_IsUsingDefaultComposition00); + tolua_function(tolua_S,"SetUseDefaultStructures",tolua_AllToLua_cLuaChunk_SetUseDefaultStructures00); + tolua_function(tolua_S,"IsUsingDefaultStructures",tolua_AllToLua_cLuaChunk_IsUsingDefaultStructures00); + tolua_function(tolua_S,"SetUseDefaultFinish",tolua_AllToLua_cLuaChunk_SetUseDefaultFinish00); + tolua_function(tolua_S,"IsUsingDefaultFinish",tolua_AllToLua_cLuaChunk_IsUsingDefaultFinish00); tolua_endmodule(tolua_S); #ifdef __cplusplus tolua_cclass(tolua_S,"cCraftingGrid","cCraftingGrid","",tolua_collect_cCraftingGrid); diff --git a/source/Bindings.h b/source/Bindings.h index 00b4b9cdc..808fc8e69 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on Wed Jun 13 02:33:15 2012. +** Generated automatically by tolua++-1.0.92 on 06/13/12 17:39:42. */ /* Exported function */ diff --git a/source/cChunkGenerator.cpp b/source/cChunkGenerator.cpp index 34bbe4b3a..82dc432e3 100644 --- a/source/cChunkGenerator.cpp +++ b/source/cChunkGenerator.cpp @@ -484,12 +484,32 @@ void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkY, int a_ChunkZ) cEntityList Entities; cBlockEntityList BlockEntities; - cLuaChunk LuaChunk( BlockTypes, BlockMeta, HeightMap, BiomeMap ); if( cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_CHUNK_GENERATING, 3, a_ChunkX, a_ChunkZ, &LuaChunk ) ) { - // A plugin interrupted generation, handle something plugin specific? - //LOG("returned true"); + // A plugin interrupted generation, handle something plugin specific + if( LuaChunk.IsUsingDefaultBiomes() ) + { + m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, BiomeMap); + } + if( LuaChunk.IsUsingDefaultComposition() ) + { + m_CompositionGen->ComposeTerrain(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, BiomeMap, Entities, BlockEntities); + } + if( LuaChunk.IsUsingDefaultStructures() ) + { + for (cStructureGenList::iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr) + { + (*itr)->GenStructures(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, Entities, BlockEntities); + } // for itr - m_StructureGens[] + } + if( LuaChunk.IsUsingDefaultFinish() ) + { + for (cFinishGenList::iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr) + { + (*itr)->GenFinish(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, BiomeMap, Entities, BlockEntities); + } // for itr - m_FinishGens[] + } } else { diff --git a/source/cLuaChunk.h b/source/cLuaChunk.h index 5e1395a4c..70aa4e615 100644 --- a/source/cLuaChunk.h +++ b/source/cLuaChunk.h @@ -14,26 +14,126 @@ public: , m_BlockTypes( a_BlockTypes ) , m_BlockMeta( a_BlockNibbles ) , m_HeightMap( a_HeightMap ) - {} + , m_bUseDefaultBiomes( false ) + , m_bUseDefaultComposition( false ) + , m_bUseDefaultStructures( false ) + , m_bUseDefaultFinish( false ) + { + memset( m_BlockTypes, 0, sizeof( cChunkDef::BlockTypes ) ); + memset( m_BlockMeta, 0, sizeof( cChunkDef::BlockNibbles ) ); + memset( m_BiomeMap, 0, sizeof( cChunkDef::BiomeMap ) ); + memset( m_HeightMap, 0, sizeof( cChunkDef::HeightMap ) ); + } ~cLuaChunk() {} - void SetBlock( const Vector3i & a_Pos, char a_BlockID, unsigned char a_BlockMeta ) //tolua_export - { //tolua_export - } //tolua_export + //tolua_begin - void FillBlocks( char a_BlockID, unsigned char a_BlockMeta ) //tolua_export - { //tolua_export + // Block functions + void FillBlocks( char a_BlockID, unsigned char a_BlockMeta ) + { const NIBBLETYPE CompressedMeta = a_BlockMeta | a_BlockMeta << 4; memset( m_BlockTypes, a_BlockID, sizeof( cChunkDef::BlockTypes ) ); memset( m_BlockMeta, CompressedMeta, sizeof( cChunkDef::BlockNibbles ) ); + } + + void SetBlock( int a_X, int a_Y, int a_Z, char a_BlockID, unsigned char a_BlockMeta ) + { + cChunkDef::SetBlock( m_BlockTypes, a_X, a_Y, a_Z, a_BlockID ); + cChunkDef::SetNibble( m_BlockMeta, a_X, a_Y, a_Z, a_BlockMeta ); + } + + char GetBlock( int a_X, int a_Y, int a_Z ) + { + return cChunkDef::GetBlock( m_BlockTypes, a_X, a_Y, a_Z ); + } + + char GetBlockMeta( int a_X, int a_Y, int a_Z ) + { + return cChunkDef::GetNibble( m_BlockMeta, a_X, a_Y, a_Z ); + } + + + + + + // Biome functinos + void SetBiome( int a_X, int a_Z, int a_BiomeID ) + { + cChunkDef::SetBiome( m_BiomeMap, a_X, a_Z, (EMCSBiome)a_BiomeID ); + } + + int GetBiome( int a_X, int a_Z ) + { + return cChunkDef::GetBiome( m_BiomeMap, a_X, a_Z ); + } + + + + + + // Height functions + void SetHeight( int a_X, int a_Z, int a_Height ) + { + cChunkDef::SetHeight( m_HeightMap, a_X, a_Z, a_Height ); + } + + int GetHeight( int a_X, int a_Z ) + { + return cChunkDef::GetHeight( m_HeightMap, a_X, a_Z ); + } + + + + + + // Functions to explicitly tell the server to use default behavior for certain parts of generating terrain + void SetUseDefaultBiomes( bool a_bUseDefaultBiomes ) + { + m_bUseDefaultBiomes = a_bUseDefaultBiomes; + } + bool IsUsingDefaultBiomes() + { + return m_bUseDefaultBiomes; + } + + void SetUseDefaultComposition( bool a_bUseDefaultComposition ) + { + m_bUseDefaultComposition = a_bUseDefaultComposition; + } + bool IsUsingDefaultComposition() + { + return m_bUseDefaultComposition; + } + + void SetUseDefaultStructures( bool a_bUseDefaultStructures ) + { + m_bUseDefaultStructures = a_bUseDefaultStructures; + } + bool IsUsingDefaultStructures() + { + return m_bUseDefaultStructures; + } + + void SetUseDefaultFinish( bool a_bUseDefaultFinish ) + { + m_bUseDefaultFinish = a_bUseDefaultFinish; + } + bool IsUsingDefaultFinish() + { + return m_bUseDefaultFinish; + } + + //tolua_end - memset( m_BiomeMap, 0, sizeof( cChunkDef::BiomeMap ) ); - memset( m_HeightMap, 0, sizeof( cChunkDef::HeightMap ) ); - } //tolua_export private: - EMCSBiome * m_BiomeMap; - BLOCKTYPE * m_BlockTypes; - NIBBLETYPE * m_BlockMeta; - HEIGHTTYPE * m_HeightMap; + bool m_bUseDefaultBiomes; + bool m_bUseDefaultComposition; + bool m_bUseDefaultStructures; + bool m_bUseDefaultFinish; + + cChunkDef::BiomeMap & m_BiomeMap; + cChunkDef::BlockTypes & m_BlockTypes; + cChunkDef::BlockNibbles & m_BlockMeta; + cChunkDef::HeightMap & m_HeightMap; }; //tolua_export \ No newline at end of file -- cgit v1.2.3