New BlockTracer classes
#11
Maybe this class also is usefull for the "rays" in an explosion. With the OnNextBlock function it does the blast power the ray has left minus the block resistance the block has. if it is 0 or less the block is destroyed.
Reply
Thanks given by:
#12
I think Vanilla uses a slightly different algorithm - instead of tracing blocks, it makes little steps along the rays, checking the block in each step. The MC wiki had quite a nice article on it.

Ladies and gentlemen, I think the BlockTracing is nearing its finish. The C++ code seems to work, and even the Lua API works. Try the latest version (on the BlockTracing branch) and the "/spidey" command in the Debuggers plugin there. It's real fun Smile
Reply
Thanks given by:
#13
haha its a realy funny command Wink
Reply
Thanks given by:
#14
Video of the spidey command ? :p
Reply
Thanks given by:
#15
I can't create any videos anymore because Action! doesn't seem to like Windows 8.1 Preview, so here are some pictures:            

How to expand the range of the line?
Reply
Thanks given by:
#16
You may use Bandicam, it's a very good recording program, but i'm not sure if it works in windows 8.
Reply
Thanks given by:
#17
The range has been capped at 50 blocks quite on purpose, I didn't want to run into "chunk not allocated" issues just yet. Just find the constant "50" in the code and play with it, if you want.
Reply
Thanks given by: NiLSPACE
#18
Haha useless but fun! :p
Reply
Thanks given by:
#19
are the functions mentioned here: https://forum.cuberite.org/showthread.ph...37#pid9337 the only functions or are there more?
Reply
Thanks given by:
#20
No, all the functions in cBlockTracer::cCallbacks are available to Lua:
/** Called on each block encountered along the path, including the first block (path start)
When this callback returns true, the tracing is aborted.
*/
bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);

/** Called on each block encountered along the path, including the first block (path start), if chunk data is not loaded
When this callback returns true, the tracing is aborted.
*/
bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ);

/** Called when the path goes out of world, either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
The coords specify the exact point at which the path exited the world.
If this callback returns true, the tracing is aborted.
Note that some paths can go out of the world and come back again (parabola),
in such a case this callback is followed by OnIntoWorld() and further OnNextBlock() calls
*/
bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ);

/** Called when the path goes into the world, from either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
The coords specify the exact point at which the path entered the world.
If this callback returns true, the tracing is aborted.
Note that some paths can go out of the world and come back again (parabola),
in such a case this callback is followed by further OnNextBlock() calls
*/
bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ);

/** Called when the path is sure not to hit any more blocks.
Note that for some shapes this might never happen (line with constant Y)
*/
void OnNoMoreHits(void);

/** Called when the block tracing walks into a chunk that is not allocated.
This usually means that the tracing is aborted.
*/
void OnNoChunk(void);

Care to document all this in the wiki?
Note: There will be a cParabolaBlockTracer later on that will use the same callbacks, but for a parabolic path, so it will be useful to document the callbacks separately
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)