From 47a497fa895fa5f353ba593d4bb232ea514e66c9 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 9 Feb 2014 20:39:45 +0100 Subject: First working version of cLuaChunkStay. It works, but has random failures, probably due to threading issues. --- src/Bindings/ManualBindings.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/Bindings/ManualBindings.cpp') diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 841ec5cf2..3571fd7ea 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -8,6 +8,7 @@ #include "PluginLua.h" #include "PluginManager.h" #include "LuaWindow.h" +#include "LuaChunkStay.h" #include "../Root.h" #include "../World.h" #include "../Entities/Player.h" @@ -1638,6 +1639,42 @@ static int tolua_cPluginManager_CallPlugin(lua_State * tolua_S) +static int tolua_cLuaChunkStay_Enable(lua_State * tolua_S) +{ + cLuaState L(tolua_S); + if ( + !L.CheckParamUserType(1, "cLuaChunkStay") || + !L.CheckParamUserType(2, "cWorld") || + !L.CheckParamFunction(3, 4) + ) + { + return 0; + } + + // Read the params: + cLuaChunkStay * ChunkStay = (cLuaChunkStay *)tolua_tousertype(tolua_S, 1, NULL); + if (ChunkStay == NULL) + { + LOGWARNING("cLuaChunkStay:Enable(): invalid self"); + L.LogStackTrace(); + return 0; + } + cWorld * World = (cWorld *)tolua_tousertype(tolua_S, 2, NULL); + if (World == NULL) + { + LOGWARNING("cLuaChunkStay:Enable(): invalid world parameter"); + L.LogStackTrace(); + return 0; + } + + ChunkStay->Enable(*World, tolua_S, 3, 4); + return 0; +} + + + + + static int tolua_cPlayer_GetGroups(lua_State* tolua_S) { cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); @@ -2403,6 +2440,10 @@ void ManualBindings::Bind(lua_State * tolua_S) tolua_function(tolua_S, "LogStackTrace", tolua_cPluginManager_LogStackTrace); tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cLuaChunkStay"); + tolua_function(tolua_S, "Enable", tolua_cLuaChunkStay_Enable); + tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cPlayer"); tolua_function(tolua_S, "GetGroups", tolua_cPlayer_GetGroups); tolua_function(tolua_S, "GetResolvedPermissions", tolua_cPlayer_GetResolvedPermissions); -- cgit v1.2.3