summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/Debuggers/Debuggers.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-06-05 18:23:16 +0200
committerMattes D <github@xoft.cz>2016-06-05 18:23:16 +0200
commitc2759186c09dc981aa672fecb57cce4aea722ec6 (patch)
treeece066d1c1f8e5ebe4a0da9cf918e06094002188 /Server/Plugins/Debuggers/Debuggers.lua
parentBindings: Add a const-ptr variant to all stack getter functions (diff)
downloadcuberite-c2759186c09dc981aa672fecb57cce4aea722ec6.tar
cuberite-c2759186c09dc981aa672fecb57cce4aea722ec6.tar.gz
cuberite-c2759186c09dc981aa672fecb57cce4aea722ec6.tar.bz2
cuberite-c2759186c09dc981aa672fecb57cce4aea722ec6.tar.lz
cuberite-c2759186c09dc981aa672fecb57cce4aea722ec6.tar.xz
cuberite-c2759186c09dc981aa672fecb57cce4aea722ec6.tar.zst
cuberite-c2759186c09dc981aa672fecb57cce4aea722ec6.zip
Diffstat (limited to '')
-rw-r--r--Server/Plugins/Debuggers/Debuggers.lua46
1 files changed, 46 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua
index aa2205368..362dc4dd9 100644
--- a/Server/Plugins/Debuggers/Debuggers.lua
+++ b/Server/Plugins/Debuggers/Debuggers.lua
@@ -1921,6 +1921,52 @@ end
+function HandleConsoleTestBbox(a_Split, a_EntireCmd)
+ -- Test bbox intersection:
+ local bbox1 = cBoundingBox(0, 5, 0, 5, 0, 5)
+ local bbox2 = cBoundingBox(bbox1) -- Make a copy
+ bbox2:Move(20, 20, 20)
+ local bbox3 = cBoundingBox(bbox1) -- Make a copy
+ bbox3:Move(2, 2, 2)
+ local doesIntersect, intersection = bbox1:Intersect(bbox2)
+ LOG("Bbox 2 intersection: " .. tostring(doesIntersect))
+ LOG(" Intersection type: " .. type(intersection) .. " / " .. tolua.type(intersection))
+ if (intersection) then
+ LOG(" {" .. intersection:GetMinX() .. ", " .. intersection:GetMinY() .. ", " .. intersection:GetMinZ() .. "}")
+ LOG(" {" .. intersection:GetMaxX() .. ", " .. intersection:GetMaxY() .. ", " .. intersection:GetMaxZ() .. "}")
+ end
+ doesIntersect, intersection = bbox1:Intersect(bbox3)
+ LOG("Bbox 3 intersection: " .. tostring(doesIntersect))
+ LOG(" Intersection type: " .. type(intersection) .. " / " .. tolua.type(intersection))
+ if (intersection) then
+ LOG(" {" .. intersection:GetMinX() .. ", " .. intersection:GetMinY() .. ", " .. intersection:GetMinZ() .. "}")
+ LOG(" {" .. intersection:GetMaxX() .. ", " .. intersection:GetMaxY() .. ", " .. intersection:GetMaxZ() .. "}")
+ end
+
+ -- Test line intersection:
+ local lines =
+ {
+ { Vector3d(5, 0, 5), Vector3d(5, 1, 5) },
+ { Vector3d(0, 0, 0), Vector3d(0, 1, 0) },
+ }
+ for idx, line in ipairs(lines) do
+ local doesIntersect, coeff, face = bbox2:CalcLineIntersection(line[1], line[2])
+ LOG("Line " .. idx .. " intersection: " .. tostring(doesIntersect))
+ LOG(" Coeff: " .. tostring(coeff))
+ LOG(" Face: " .. tostring(face))
+ local doesIntersect2, coeff2, face2 = cBoundingBox:CalcLineIntersection(bbox2:GetMin(), bbox2:GetMax(), line[1], line[2])
+ assert(doesIntersect == doesIntersect2)
+ assert(coeff == coeff2)
+ assert(face == face2)
+ end
+
+ return true
+end
+
+
+
+
+
function HandleConsoleTestCall(a_Split, a_EntireCmd)
LOG("Testing inter-plugin calls")
LOG("Note: These will fail if the Core plugin is not enabled")