From 38b219de625c6c334b1b900c911886f5469a1720 Mon Sep 17 00:00:00 2001 From: faketruth Date: Fri, 16 Mar 2012 15:48:40 +0000 Subject: 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 --- source/cChunkMap.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source/cChunkMap.cpp') diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp index 97f6a659f..c36f2610f 100644 --- a/source/cChunkMap.cpp +++ b/source/cChunkMap.cpp @@ -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 ); -- cgit v1.2.3