diff options
author | Mattes D <github@xoft.cz> | 2016-06-30 19:35:00 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-07-18 22:11:38 +0200 |
commit | f0c53dbad48a295413d3207cd463e1dfb19faa93 (patch) | |
tree | e63263b5e0a328c9f833b25cd2bb2f1ca01802c6 | |
parent | Bindings: Added a script to generate a diff between APIDesc and ToLua. (diff) | |
download | cuberite-f0c53dbad48a295413d3207cd463e1dfb19faa93.tar cuberite-f0c53dbad48a295413d3207cd463e1dfb19faa93.tar.gz cuberite-f0c53dbad48a295413d3207cd463e1dfb19faa93.tar.bz2 cuberite-f0c53dbad48a295413d3207cd463e1dfb19faa93.tar.lz cuberite-f0c53dbad48a295413d3207cd463e1dfb19faa93.tar.xz cuberite-f0c53dbad48a295413d3207cd463e1dfb19faa93.tar.zst cuberite-f0c53dbad48a295413d3207cd463e1dfb19faa93.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 32 | ||||
-rw-r--r-- | src/Generating/ChunkDesc.cpp | 2 | ||||
-rw-r--r-- | src/Generating/ChunkDesc.h | 7 |
3 files changed, 39 insertions, 2 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 1d735ac83..8bcd5a4e6 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -30,6 +30,7 @@ #include "../BlockEntities/NoteEntity.h" #include "../BlockEntities/MobHeadEntity.h" #include "../BlockEntities/FlowerPotEntity.h" +#include "../Generating/ChunkDesc.h" #include "../LineBlockTracer.h" #include "../WorldStorage/SchematicFileSerializer.h" #include "../CompositeChat.h" @@ -3443,6 +3444,33 @@ static int tolua_cBoundingBox_Intersect(lua_State * a_LuaState) +static int tolua_cChunkDesc_GetBlockTypeMeta(lua_State * a_LuaState) +{ + /* Function signature: + ChunkDesc:GetBlockTypeMeta(RelX, RelY, RelZ) -> BlockType, BlockMeta + */ + + cLuaState L(a_LuaState); + const cChunkDesc * self; + int relX, relY, relZ; + if (!L.GetStackValues(1, self, relX, relY, relZ)) + { + L.LogStackValues(); + tolua_error(a_LuaState, "Invalid function params. Expected chunkDesc:GetBlockTypeMeta(relX, relY, relZ)", nullptr); + return 0; + } + BLOCKTYPE blockType; + NIBBLETYPE blockMeta; + self->GetBlockTypeMeta(relX, relY, relZ, blockType, blockMeta); + L.Push(blockType); + L.Push(blockMeta); + return 2; +} + + + + + static int tolua_cCompositeChat_AddRunCommandPart(lua_State * tolua_S) { // function cCompositeChat:AddRunCommandPart(Message, Command, [Style]) @@ -3736,6 +3764,10 @@ void cManualBindings::Bind(lua_State * tolua_S) tolua_function(tolua_S, "Intersect", tolua_cBoundingBox_Intersect); tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cChunkDesc"); + tolua_function(tolua_S, "GetBlockTypeMeta", tolua_cChunkDesc_GetBlockTypeMeta); + tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cClientHandle"); tolua_constant(tolua_S, "MAX_VIEW_DISTANCE", cClientHandle::MAX_VIEW_DISTANCE); tolua_constant(tolua_S, "MIN_VIEW_DISTANCE", cClientHandle::MIN_VIEW_DISTANCE); diff --git a/src/Generating/ChunkDesc.cpp b/src/Generating/ChunkDesc.cpp index fcbebf1ca..6ba63d5ce 100644 --- a/src/Generating/ChunkDesc.cpp +++ b/src/Generating/ChunkDesc.cpp @@ -72,7 +72,7 @@ void cChunkDesc::SetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE -void cChunkDesc::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) +void cChunkDesc::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const { m_BlockArea.GetRelBlockTypeMeta(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); } diff --git a/src/Generating/ChunkDesc.h b/src/Generating/ChunkDesc.h index aa689fcd6..9e3f4af5e 100644 --- a/src/Generating/ChunkDesc.h +++ b/src/Generating/ChunkDesc.h @@ -52,7 +52,12 @@ public: void FillBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); void SetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - void GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta); + + // tolua_end + /** Returns the BlockType and BlockMeta at the specified coords. + Exported to Lua manually to avoid extra parameters generated by ToLua++. */ + void GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const; + // tolua_begin void SetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType); BLOCKTYPE GetBlockType(int a_RelX, int a_RelY, int a_RelZ); |