summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-08-09 03:13:15 +0200
committerGitHub <noreply@github.com>2019-08-09 03:13:15 +0200
commite7016b15259f8432e0a333a948498fb280d4d7a9 (patch)
treec762898c05633066e37ec568f0e0146dcd3ab6f5 /src/Bindings
parentcBoundingBox: Fix tolua warning (#4361) (diff)
downloadcuberite-e7016b15259f8432e0a333a948498fb280d4d7a9.tar
cuberite-e7016b15259f8432e0a333a948498fb280d4d7a9.tar.gz
cuberite-e7016b15259f8432e0a333a948498fb280d4d7a9.tar.bz2
cuberite-e7016b15259f8432e0a333a948498fb280d4d7a9.tar.lz
cuberite-e7016b15259f8432e0a333a948498fb280d4d7a9.tar.xz
cuberite-e7016b15259f8432e0a333a948498fb280d4d7a9.tar.zst
cuberite-e7016b15259f8432e0a333a948498fb280d4d7a9.zip
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/ManualBindings.cpp134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 90251a4b2..af4a301a0 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -3954,6 +3954,134 @@ static int tolua_cCompositeChat_UnderlineUrls(lua_State * tolua_S)
+static int tolua_cCuboid_Assign(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+
+ if (!L.CheckParamSelf("cCuboid"))
+ {
+ return 0;
+ }
+
+ cCuboid * self = nullptr;
+ L.GetStackValue(1, self);
+
+ // Check the old coord-based signature:
+ int x1, y1, z1, x2, y2, z2;
+ if (L.GetStackValues(2, x1, y1, z1, x2, y2, z2))
+ {
+ LOGWARNING("cCuboid:Assign(x1, y1, z1, x2, y2, z2) is deprecated, use cCuboid:Assign(Vector3i, Vector3i) instead.");
+ L.LogStackTrace();
+ self->Assign({x1, y1, z1}, {x2, y2, z2});
+ return 0;
+ }
+
+ // Try the (cCuboid) param version:
+ cCuboid * other = nullptr;
+ if (L.GetStackValue(2, other) && (other != nullptr))
+ {
+ self->Assign(*other);
+ return 0;
+ }
+
+ // Try the (Vector3i, Vector3i) param version:
+ Vector3i * pt1 = nullptr;
+ Vector3i * pt2 = nullptr;
+ if (L.GetStackValues(2, pt1, pt2) && (pt1 != nullptr) && (pt2 != nullptr))
+ {
+ self->Assign(*pt1, *pt2);
+ return 0;
+ }
+ return L.ApiParamError("Invalid parameter, expected either a cCuboid or two Vector3i-s.");
+}
+
+
+
+
+
+static int tolua_cCuboid_IsInside(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+
+ if (!L.CheckParamSelf("cCuboid"))
+ {
+ return 0;
+ }
+
+ cCuboid * self = nullptr;
+ L.GetStackValue(1, self);
+
+ // Check the old coord-based signature:
+ int x, y, z;
+ if (L.GetStackValues(2, x, y, z))
+ {
+ LOGWARNING("cCuboid:IsInside(x, y, z) is deprecated, use cCuboid:IsInside(Vector3d) instead.");
+ L.LogStackTrace();
+ self->Move({x, y, z});
+ return 0;
+ }
+
+ // Try the (Vector3i) param version:
+ {
+ Vector3i * pt = nullptr;
+ if (L.GetStackValue(2, pt) && (pt != nullptr))
+ {
+ L.Push(self->IsInside(*pt));
+ return 1;
+ }
+ }
+
+ // Try the (Vector3d) param version:
+ {
+ Vector3d * pt = nullptr;
+ if (L.GetStackValue(2, pt) && (pt != nullptr))
+ {
+ L.Push(self->IsInside(*pt));
+ return 1;
+ }
+ }
+ return L.ApiParamError("Invalid parameter #2, expected a Vector3i or a Vector3d.");
+}
+
+
+
+
+
+static int tolua_cCuboid_Move(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+
+ if (!L.CheckParamSelf("cCuboid"))
+ {
+ return 0;
+ }
+
+ cCuboid * self = nullptr;
+ L.GetStackValue(1, self);
+
+ // Check the old coord-based signature:
+ int x, y, z;
+ if (L.GetStackValues(2, x, y, z))
+ {
+ LOGWARNING("cCuboid:Move(x, y, z) is deprecated, use cCuboid:Move(Vector3i) instead.");
+ L.LogStackTrace();
+ self->Move({x, y, z});
+ return 0;
+ }
+
+ Vector3i * offset = nullptr;
+ if (!L.GetStackValue(2, offset) || (offset == nullptr))
+ {
+ return L.ApiParamError("Invalid parameter #2, expected a Vector3i.");
+ }
+ self->Move(*offset);
+ return 0;
+}
+
+
+
+
+
static int tolua_cEntity_IsSubmerged(lua_State * tolua_S)
{
// Check the params:
@@ -4121,6 +4249,12 @@ void cManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "sha1HexString", tolua_sha1HexString);
tolua_endmodule(tolua_S);
+ tolua_beginmodule(tolua_S, "cCuboid");
+ tolua_function(tolua_S, "Assign", tolua_cCuboid_Assign);
+ tolua_function(tolua_S, "IsInside", tolua_cCuboid_IsInside);
+ tolua_function(tolua_S, "Move", tolua_cCuboid_Move);
+ tolua_endmodule(tolua_S);
+
tolua_beginmodule(tolua_S, "cEntity");
tolua_constant(tolua_S, "INVALID_ID", cEntity::INVALID_ID);
tolua_function(tolua_S, "IsSubmerged", tolua_cEntity_IsSubmerged);