From 26ac146f41091dc070d8075f5fc9de25b5a22578 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 17 Apr 2020 11:36:37 +0200 Subject: More Vector3 in cBlockHandler (#4644) * cBlockHandler.OnUpdate uses Vector3 params. Also slightly changed how block ticking works. --- src/Bindings/DeprecatedBindings.cpp | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/Bindings') diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp index 63b5919ac..11b15a8c8 100644 --- a/src/Bindings/DeprecatedBindings.cpp +++ b/src/Bindings/DeprecatedBindings.cpp @@ -518,6 +518,43 @@ static int tolua_cWorld_SetSignLines(lua_State * tolua_S) +/** function: cWorld:SetNextBlockTick */ +static int tolua_cWorld_SetNextBlockTick(lua_State * tolua_S) +{ + cLuaState LuaState(tolua_S); + + if ( + !LuaState.CheckParamUserType(1, "cWorld") || + !LuaState.CheckParamNumber(2, 4) || + !LuaState.CheckParamEnd(5) + ) + { + return 0; + } + + cWorld * Self = nullptr; + int BlockX = 0; + int BlockY = 0; + int BlockZ = 0; + + if (!LuaState.GetStackValues(1, Self, BlockX, BlockY, BlockZ)) + { + tolua_error(LuaState, "Failed to read parameters", nullptr); + } + if (Self == nullptr) + { + tolua_error(LuaState, "invalid 'self' in function 'SetNextBlockTick'", nullptr); + } + Self->SetNextBlockToTick({BlockX, BlockY, BlockZ}); + LOGWARNING("Warning: 'cWorld:SetNextBlockTick' function is deprecated. Please use 'cWorld:SetNextBlockToTick' instead."); + LuaState.LogStackTrace(0); + return 1; +} + + + + + void DeprecatedBindings::Bind(lua_State * tolua_S) { tolua_beginmodule(tolua_S, nullptr); @@ -558,6 +595,7 @@ void DeprecatedBindings::Bind(lua_State * tolua_S) tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cWorld"); + tolua_function(tolua_S, "SetNextBlockTick", tolua_cWorld_SetNextBlockTick); tolua_function(tolua_S, "UpdateSign", tolua_cWorld_SetSignLines); tolua_endmodule(tolua_S); -- cgit v1.2.3