Cuberite Forum
SkyLight Detection with cLineBlockTracer - 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: SkyLight Detection with cLineBlockTracer (/thread-1234.html)



SkyLight Detection with cLineBlockTracer - tigerw - 08-26-2013

Hi!

I want to try to solve the zombies burning in a cave issue, so I thought I'll use lineblocktracer to trace upwards until the height of the chunk is reached. I was wondering what the correct syntax for it is?

Apparently it takes a World, a Callback, and 6 doubles. In zombie.cpp, I have:

Code:
#include LineblockTracer.h

...

*callback I copied from World.cpp*
cLineBlockTracer::Trace(GetWorld(), Callback, GetPosX, GetPosY, GetPosZ, GetPosX, *value for chunk height, how can I use cChunk::Height here?*, GetPosZ)

However, it tells me that the overloaded function doesn't have the correct argument list. Why is this? Thanks!


RE: SkyLight Detection with cLineBlockTracer - xoft - 08-26-2013

Why use such a heavy caliber to solve this simple issue?

Just query the SkyLight value at the block coords, if it is 15, the block is fully day-lit.


RE: SkyLight Detection with cLineBlockTracer - NiLSPACE - 08-26-2013

Would it not be easy to check if the Y Pos is equal or higher then cChunk::Height?


RE: SkyLight Detection with cLineBlockTracer - tigerw - 08-26-2013

Wait, you can check the block light value of a block? Awesome!

So, how would I do it?Tongue


RE: SkyLight Detection with cLineBlockTracer - NiLSPACE - 08-26-2013

cWorld::GetBlockSkyLight(BlockX, BlockY, BlockZ) or
cWorld::GetBlockBlockLight(BlockX, BlockY, BlockZ)
(yes its GetBlockBlockLight)


RE: SkyLight Detection with cLineBlockTracer - bearbin - 08-26-2013

Shouldn't it be getblockskylight?


RE: SkyLight Detection with cLineBlockTracer - NiLSPACE - 08-26-2013

Yes I already editted my post Wink


RE: SkyLight Detection with cLineBlockTracer - tigerw - 08-26-2013

Thanks, I'll try them all.


RE: SkyLight Detection with cLineBlockTracer - xoft - 08-26-2013

The only problem with light is that it may go out of sync with the world contents for short whiles - when the player places blocks, for example, the light is not recalculated immediately; it will be recalculated on a different thread in a little while. So it is possible for the light values to actually be wrong. I don't think it matters for most practical purposes, just be aware of that Smile