summaryrefslogtreecommitdiffstats
path: root/src/Bindings/DeprecatedBindings.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2017-05-11 14:34:36 +0200
committerworktycho <work.tycho@gmail.com>2017-05-11 14:34:36 +0200
commit2c3c1f15273835923d9bd4950a19ee88a95ee0f4 (patch)
treecda390aa07a202497271439c2b330643074239df /src/Bindings/DeprecatedBindings.cpp
parentExported cFallingBlock and cExpOrb (#3700) (diff)
downloadcuberite-2c3c1f15273835923d9bd4950a19ee88a95ee0f4.tar
cuberite-2c3c1f15273835923d9bd4950a19ee88a95ee0f4.tar.gz
cuberite-2c3c1f15273835923d9bd4950a19ee88a95ee0f4.tar.bz2
cuberite-2c3c1f15273835923d9bd4950a19ee88a95ee0f4.tar.lz
cuberite-2c3c1f15273835923d9bd4950a19ee88a95ee0f4.tar.xz
cuberite-2c3c1f15273835923d9bd4950a19ee88a95ee0f4.tar.zst
cuberite-2c3c1f15273835923d9bd4950a19ee88a95ee0f4.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/DeprecatedBindings.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp
index 0ffc58cbb..029d4edb7 100644
--- a/src/Bindings/DeprecatedBindings.cpp
+++ b/src/Bindings/DeprecatedBindings.cpp
@@ -10,6 +10,7 @@
#include "../World.h"
#include "../Entities/Player.h"
#include "LuaState.h"
+#include "../Tracer.h"
@@ -291,6 +292,47 @@ tolua_lerror:
+/* method: Trace of class cTracer */
+static int tolua_cTracer_Trace(lua_State * a_LuaState)
+{
+ // Log a deprecation warning with stacktrace:
+ cLuaState S(a_LuaState);
+ LOGWARNING("The function cTracer:Trace is obsolete, use the cLineBlockTracer instead");
+ S.LogStackTrace();
+
+ // Check params:
+ if (
+ !S.CheckParamUserType(1, "cTracer") ||
+ !S.CheckParamUserType(2, "const Vector3<float>", 3) ||
+ !S.CheckParamNumber (4)
+ )
+ {
+ return 0;
+ }
+
+ // Read params:
+ cTracer * self;
+ Vector3d * start;
+ Vector3d * direction;
+ int distance;
+ bool lineOfSight = false;
+ if (!S.GetStackValues(1, self, start, direction, distance))
+ {
+ LOGWARNING("Cannot retrieve parameters for cTracer::Trace. Expected a cTracer (self), Vector3d, Vector3d, number and optional boolean.");
+ S.LogStackValues();
+ return 0;
+ }
+ S.GetStackValue(5, lineOfSight);
+
+ // Call and push the result:
+ S.Push(self->Trace(*start, *direction, distance, lineOfSight));
+ return 1;
+}
+
+
+
+
+
/** function: cWorld:SetSignLines */
static int tolua_cWorld_SetSignLines(lua_State * tolua_S)
{
@@ -398,6 +440,10 @@ void DeprecatedBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "StringToMobType", tolua_AllToLua_StringToMobType00);
+ tolua_beginmodule(tolua_S, "cTracer");
+ tolua_function(tolua_S, "Trace", tolua_cTracer_Trace);
+ tolua_endmodule(tolua_S);
+
tolua_beginmodule(tolua_S, "cWorld");
tolua_function(tolua_S, "UpdateSign", tolua_cWorld_SetSignLines);
tolua_endmodule(tolua_S);