1
0

Exposed a function to Lua to get a block's sky light value

git-svn-id: http://mc-server.googlecode.com/svn/trunk@416 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth 2012-03-16 15:48:40 +00:00
parent 8127148f4c
commit 38b219de62
6 changed files with 72 additions and 33 deletions

View File

@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 03/09/12 14:38:38.
** Generated automatically by tolua++-1.0.92 on 03/11/12 17:55:41.
*/
#ifndef __cplusplus
@ -9546,34 +9546,6 @@ static int tolua_AllToLua_cServer_SendMessage00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetWorld of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetWorld00
static int tolua_AllToLua_cWorld_GetWorld00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"cWorld",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
{
cWorld* tolua_ret = (cWorld*) cWorld::GetWorld();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'GetWorld'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetTime of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetTime00
static int tolua_AllToLua_cWorld_GetTime00(lua_State* tolua_S)
@ -10168,6 +10140,44 @@ tolua_lerror:
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetBlockSkyLight of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockSkyLight00
static int tolua_AllToLua_cWorld_GetBlockSkyLight00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cWorld",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
{
cWorld* self = (cWorld*) 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 'GetBlockSkyLight'", NULL);
#endif
{
char tolua_ret = (char) self->GetBlockSkyLight(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 'GetBlockSkyLight'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: DigBlock of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_DigBlock00
static int tolua_AllToLua_cWorld_DigBlock00(lua_State* tolua_S)
@ -17888,7 +17898,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cWorld","cWorld","",NULL);
tolua_beginmodule(tolua_S,"cWorld");
tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cWorld_GetWorld00);
tolua_function(tolua_S,"GetTime",tolua_AllToLua_cWorld_GetTime00);
tolua_function(tolua_S,"GetGameMode",tolua_AllToLua_cWorld_GetGameMode00);
tolua_function(tolua_S,"SetWorldTime",tolua_AllToLua_cWorld_SetWorldTime00);
@ -17906,6 +17915,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cWorld_GetBlockMeta01);
tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cWorld_SetBlockMeta00);
tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cWorld_SetBlockMeta01);
tolua_function(tolua_S,"GetBlockSkyLight",tolua_AllToLua_cWorld_GetBlockSkyLight00);
tolua_function(tolua_S,"DigBlock",tolua_AllToLua_cWorld_DigBlock00);
tolua_function(tolua_S,"SendBlockTo",tolua_AllToLua_cWorld_SendBlockTo00);
tolua_function(tolua_S,"GetSpawnX",tolua_AllToLua_cWorld_GetSpawnX00);

View File

@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 03/09/12 14:38:39.
** Generated automatically by tolua++-1.0.92 on 03/11/12 17:55:42.
*/
/* Exported function */

View File

@ -557,7 +557,25 @@ BLOCKTYPE cChunkMap::GetBlockMeta(int a_X, int a_Y, int a_Z)
void cChunkMap::SetBlockMeta(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockMeta)
BLOCKTYPE cChunkMap::GetBlockSkyLight(int a_X, int a_Y, int a_Z)
{
int ChunkX, ChunkZ;
cChunkDef::AbsoluteToRelative( a_X, a_Y, a_Z, ChunkX, ChunkZ );
cCSLock Lock(m_CSLayers);
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
if ((Chunk != NULL) && Chunk->IsValid() )
{
return cChunk::GetNibble( Chunk->pGetSkyLight(), a_X, a_Y, a_Z );
}
return 0;
}
void cChunkMap::SetBlockMeta(int a_X, int a_Y, int a_Z, char a_BlockMeta)
{
int ChunkX, ChunkZ;
cChunkDef::AbsoluteToRelative( a_X, a_Y, a_Z, ChunkX, ChunkZ );

View File

@ -87,6 +87,7 @@ public:
void CollectPickupsByPlayer(cPlayer * a_Player);
BLOCKTYPE GetBlock (int a_X, int a_Y, int a_Z);
BLOCKTYPE GetBlockMeta (int a_X, int a_Y, int a_Z);
BLOCKTYPE GetBlockSkyLight (int a_X, int a_Y, int a_Z);
void SetBlockMeta (int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockMeta);
void SetBlock (int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta);
bool DigBlock (int a_X, int a_Y, int a_Z, cItem & a_PickupItem);

View File

@ -896,6 +896,15 @@ void cWorld::SetBlockMeta( int a_X, int a_Y, int a_Z, char a_MetaData )
char cWorld::GetBlockSkyLight( int a_X, int a_Y, int a_Z )
{
return m_ChunkMap->GetBlockSkyLight(a_X, a_Y, a_Z);
}
bool cWorld::DigBlock( int a_X, int a_Y, int a_Z, cItem & a_PickupItem )
{
bool res = m_ChunkMap->DigBlock(a_X, a_Y, a_Z, a_PickupItem);

View File

@ -49,7 +49,7 @@ class cWorld //tolua_export
{ //tolua_export
public:
OBSOLETE static cWorld* GetWorld(); //tolua_export
OBSOLETE static cWorld* GetWorld();
// Return time in seconds
inline static float GetTime() //tolua_export
@ -187,6 +187,7 @@ public:
char GetBlockMeta( const Vector3i & a_Pos ) { return GetBlockMeta( a_Pos.x, a_Pos.y, a_Pos.z ); } //tolua_export
void SetBlockMeta( int a_X, int a_Y, int a_Z, char a_MetaData ); //tolua_export
void SetBlockMeta( const Vector3i & a_Pos, char a_MetaData ) { SetBlockMeta( a_Pos.x, a_Pos.y, a_Pos.z, a_MetaData ); } //tolua_export
char GetBlockSkyLight( int a_X, int a_Y, int a_Z ); //tolua_export
bool DigBlock( int a_X, int a_Y, int a_Z, cItem & a_PickupItem ); //tolua_export
void SendBlockTo( int a_X, int a_Y, int a_Z, cPlayer* a_Player ); //tolua_export