summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/Debuggers
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 /Server/Plugins/Debuggers
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 'Server/Plugins/Debuggers')
-rw-r--r--Server/Plugins/Debuggers/Debuggers.lua72
-rw-r--r--Server/Plugins/Debuggers/Info.lua12
2 files changed, 84 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua
index 7d7246484..fb18a0c19 100644
--- a/Server/Plugins/Debuggers/Debuggers.lua
+++ b/Server/Plugins/Debuggers/Debuggers.lua
@@ -1838,6 +1838,44 @@ end
+function HandleConsoleHitTrace(a_Split)
+ local world = cRoot:Get():GetDefaultWorld()
+ local s = Vector3d(0, 70, 0)
+ local e = Vector3d(100, 75, 100)
+ if (tonumber(a_Split[2])) then
+ s.x = tonumber(a_Split[2])
+ end
+ if (tonumber(a_Split[3])) then
+ s.y = tonumber(a_Split[3])
+ end
+ if (tonumber(a_Split[4])) then
+ s.z = tonumber(a_Split[4])
+ end
+ if (tonumber(a_Split[5])) then
+ e.x = tonumber(a_Split[5])
+ end
+ if (tonumber(a_Split[6])) then
+ e.y = tonumber(a_Split[6])
+ end
+ if (tonumber(a_Split[7])) then
+ e.z = tonumber(a_Split[7])
+ end
+ local res, hitCoords, hitBlockCoords, hitBlockFace = cLineBlockTracer:FirstSolidHitTrace(world, s, e)
+ if (res) then
+ return true, string.format("The line hits block {%d, %d, %d} at point {%f, %f, %f}, face %s",
+ hitBlockCoords.x, hitBlockCoords.y, hitBlockCoords.z,
+ hitCoords.x, hitCoords.y, hitCoords.z,
+ BlockFaceToString(hitBlockFace)
+ )
+ else
+ return true, "The two points specified don't have a solid block between them."
+ end
+end
+
+
+
+
+
--- Monitors the state of the "inh" entity-spawning hook
-- if false, the hook is installed before the "inh" command processing
local isInhHookInstalled = false
@@ -1954,6 +1992,40 @@ end
+function HandleConsoleLosTrace(a_Split)
+ local world = cRoot:Get():GetDefaultWorld()
+ local s = Vector3d(0, 70, 0)
+ local e = Vector3d(100, 75, 100)
+ if (tonumber(a_Split[2])) then
+ s.x = tonumber(a_Split[2])
+ end
+ if (tonumber(a_Split[3])) then
+ s.y = tonumber(a_Split[3])
+ end
+ if (tonumber(a_Split[4])) then
+ s.z = tonumber(a_Split[4])
+ end
+ if (tonumber(a_Split[5])) then
+ e.x = tonumber(a_Split[5])
+ end
+ if (tonumber(a_Split[6])) then
+ e.y = tonumber(a_Split[6])
+ end
+ if (tonumber(a_Split[7])) then
+ e.z = tonumber(a_Split[7])
+ end
+ local res = cLineBlockTracer:LineOfSightTrace(world, s, e, cLineBlockTracer.losAir)
+ if (res) then
+ return true, "The two points can see each other."
+ else
+ return true, "The two points cannot see each other"
+ end
+end
+
+
+
+
+
function HandleConsolePluginStats(a_Split)
cPluginManager:ForEachPlugin(
function (a_CBPlugin)
diff --git a/Server/Plugins/Debuggers/Info.lua b/Server/Plugins/Debuggers/Info.lua
index 8b2e7017b..dea656837 100644
--- a/Server/Plugins/Debuggers/Info.lua
+++ b/Server/Plugins/Debuggers/Info.lua
@@ -290,6 +290,12 @@ g_PluginInfo =
HelpString = "Tests the crypto hashing functions",
},
+ ["hittrace"] =
+ {
+ Handler = HandleConsoleHitTrace,
+ HelpString = "Tests the FirstSolidHit trace",
+ },
+
["inh"] =
{
Handler = HandleConsoleInh,
@@ -302,6 +308,12 @@ g_PluginInfo =
HelpString = "Loads the specified chunk into memory",
},
+ ["lostrace"] =
+ {
+ Handler = HandleConsoleLosTrace,
+ HelpString = "Tests a LineOfSight trace",
+ },
+
["pluginstats"] =
{
Handler = HandleConsolePluginStats,