![]() |
New BlockTracer classes - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: New BlockTracer classes (/thread-1188.html) Pages:
1
2
|
RE: New BlockTracer classes - NiLSPACE - 08-07-2013 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. RE: New BlockTracer classes - xoft - 08-07-2013 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 ![]() RE: New BlockTracer classes - NiLSPACE - 08-07-2013 haha its a realy funny command ![]() RE: New BlockTracer classes - ThuGie - 08-08-2013 Video of the spidey command ? :p RE: New BlockTracer classes - NiLSPACE - 08-08-2013 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? RE: New BlockTracer classes - tonibm19 - 08-08-2013 You may use Bandicam, it's a very good recording program, but i'm not sure if it works in windows 8. RE: New BlockTracer classes - xoft - 08-08-2013 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. RE: New BlockTracer classes - ThuGie - 08-08-2013 Haha useless but fun! :p RE: New BlockTracer classes - NiLSPACE - 08-09-2013 are the functions mentioned here: https://forum.cuberite.org/showthread.php?tid=1188&pid=9337#pid9337 the only functions or are there more? RE: New BlockTracer classes - xoft - 08-09-2013 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 |