diff options
author | Mattes D <github@xoft.cz> | 2017-05-11 14:34:36 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2017-05-11 14:34:36 +0200 |
commit | 2c3c1f15273835923d9bd4950a19ee88a95ee0f4 (patch) | |
tree | cda390aa07a202497271439c2b330643074239df /Server/Plugins/APIDump/Classes | |
parent | Exported cFallingBlock and cExpOrb (#3700) (diff) | |
download | cuberite-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-- | Server/Plugins/APIDump/Classes/Geometry.lua | 137 |
1 files changed, 105 insertions, 32 deletions
diff --git a/Server/Plugins/APIDump/Classes/Geometry.lua b/Server/Plugins/APIDump/Classes/Geometry.lua index cd7793ee9..32a4bbb27 100644 --- a/Server/Plugins/APIDump/Classes/Geometry.lua +++ b/Server/Plugins/APIDump/Classes/Geometry.lua @@ -977,52 +977,103 @@ return { Desc = [[ This class provides an easy-to-use interface for tracing lines through individual -blocks in the world. It will call the provided callbacks according to what events it encounters along the -way.</p> -<p> -For the Lua API, there's only one static function exported that takes all the parameters necessary to do -the tracing. The Callbacks parameter is a table containing all the functions that will be called upon the -various events. See below for further information. +blocks in the world. It can either be used to call the provided callbacks according +to what events it encounters along the way, or there are shortcut functions used for +the most popular tracing reasons - line of sight and solid hits. ]], Functions = { - Trace = + FirstSolidHitTrace = { - IsStatic = true, - Params = { + IsStatic = true, + Params = { - Name = "World", - Type = "cWorld", + { Name = "World", Type = "cWorld" }, + { Name = "StartX", Type = "number" }, + { Name = "StartY", Type = "number" }, + { Name = "StartZ", Type = "number" }, + { Name = "EndX", Type = "number" }, + { Name = "EndY", Type = "number" }, + { Name = "EndZ", Type = "number" }, }, + Returns = { - Name = "Callbacks", - Type = "table", + { Name = "HasHitSolid", Type = "boolean" }, + { Name = "HitCoords", Type = "Vector3d" }, + { Name = "HitBlockCoords", Type = "Vector3i" }, + { Name = "HitBlockFace", Type = "eBlockFace" }, }, + Notes = "If the specified line hits a solid block, return true and the coordinates / face of the first such solid block hit. Returns false if there's no solid block on that line.", + }, + { + IsStatic = true, + Params = { - Name = "StartX", - Type = "number", + { Name = "World", Type = "cWorld" }, + { Name = "Start", Type = "Vector3d" }, + { Name = "End", Type = "Vector3d" }, }, + Returns = { - Name = "StartY", - Type = "number", + { Name = "HasHitSolid", Type = "boolean" }, + { Name = "HitCoords", Type = "Vector3d" }, + { Name = "HitBlockCoords", Type = "Vector3i" }, + { Name = "HitBlockFace", Type = "eBlockFace" }, }, + Notes = "If the specified line hits a solid block, return true and the coordinates / face of the first such solid block hit. Returns false if there's no solid block on that line.", + }, + }, -- FirstSolidHitTrace + LineOfSightTrace = + { + { + IsStatic = true, + Params = { - Name = "StartZ", - Type = "number", + { Name = "World", Type = "cWorld" }, + { Name = "StartX", Type = "number" }, + { Name = "StartY", Type = "number" }, + { Name = "StartZ", Type = "number" }, + { Name = "EndX", Type = "number" }, + { Name = "EndY", Type = "number" }, + { Name = "EndZ", Type = "number" }, + { Name = "Sight", Type = "number" }, }, + Returns = { - Name = "EndX", - Type = "number", + { Name = "CanSee", Type = "boolean" }, }, + Notes = "Returns true if the two points specified are within line of sight of each other. The Sight parameter specifies which blocks are considered transparent for the trace, it is a combination of {{cLineBlockTracer#eLineOfSight|losXXX}} values added together." + }, + { + IsStatic = true, + Params = { - Name = "EndY", - Type = "number", + { Name = "World", Type = "cWorld" }, + { Name = "Start", Type = "Vector3d" }, + { Name = "End", Type = "Vector3d" }, + { Name = "Sight", Type = "number" }, }, + Returns = { - Name = "EndZ", - Type = "number", + { Name = "CanSee", Type = "boolean" }, }, + Notes = "Returns true if the two points specified are within line of sight of each other. The Sight parameter specifies which blocks are considered transparent for the trace, it is a combination of {{cLineBlockTracer#eLineOfSight|losXXX}} values added together." + }, + }, -- LineOfSightTrace + Trace = + { + IsStatic = true, + Params = + { + { Name = "World", Type = "cWorld" }, + { Name = "Callbacks", Type = "table" }, + { Name = "StartX", Type = "number" }, + { Name = "StartY", Type = "number" }, + { Name = "StartZ", Type = "number" }, + { Name = "EndX", Type = "number" }, + { Name = "EndY", Type = "number" }, + { Name = "EndZ", Type = "number" }, }, Returns = { @@ -1033,6 +1084,29 @@ various events. See below for further information. Notes = "Performs the trace on the specified line. Returns true if the entire trace was processed (no callback returned true)", }, }, + Constants = + { + losAir = + { + Notes = "LineOfSight tracing can 'see' through air blocks.", + }, + losWater = + { + Notes = "LineOfSight tracing can 'see' through water blocks.", + }, + losLava = + { + Notes = "LineOfSight tracing can 'see' through lava blocks.", + }, + }, + ConstantGroups = + { + eLineOfSight = + { + Include = "los.*", + TextBefore = "The following constants are used to speficy which blocks are see-through when tracing a LineOfSight trace. Add them together to make up the Sight parameter.", + }, + }, AdditionalInfo = { { @@ -1109,16 +1183,15 @@ end cTracer = { Desc = [[ - A cTracer object is used to trace lines in the world. One thing you can use the cTracer for, is - tracing what block a player is looking at, but you can do more with it if you want.</p> - <p> - The cTracer is still a work in progress and is not documented at all.</p> - <p> - See also the {{cLineBlockTracer}} class for an alternative approach using callbacks. + This class is <b>OBSOLETE</b>, do not use it. + See the {{cLineBlockTracer}} class for the replacement. ]], Functions = { - + Trace = + { + Notes = "<b>OBSOLETE</b>, use the {{cLineBlockTracer}} class instead.", + }, }, }, Vector3d = |