1
0

Added lighting code and added comments

This commit is contained in:
STRWarrior 2014-07-30 19:18:11 +02:00
parent 5daeba7e88
commit c4e6a14235

View File

@ -116,6 +116,23 @@ void cEnderman::CheckEventSeePlayer()
ASSERT(Callback.GetPlayer() != NULL);
int ChunkX, ChunkZ;
cChunkDef::BlockToChunk(POSX_TOINT, POSZ_TOINT, ChunkX, ChunkZ);
// Check if the chunk the enderman is in is lit.
if (!m_World->IsChunkLighted(ChunkX, ChunkZ))
{
m_World->QueueLightChunk(ChunkX, ChunkZ);
return;
}
// Enderman only attack if the skylight is higher than 6
if (m_World->GetBlockSkyLight(POSX_TOINT, POSY_TOINT, POSZ_TOINT) <= 7)
{
// TODO: Teleport the enderman to a random spot.
return;
}
if (!Callback.GetPlayer()->IsGameModeCreative())
{
super::EventSeePlayer(Callback.GetPlayer());