1
0

Allow enderman to attack during day (#4522)

This commit is contained in:
Mat 2020-03-22 12:13:44 +02:00 committed by GitHub
parent 0d444b62c9
commit 038194d2a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,13 +113,6 @@ void cEnderman::CheckEventSeePlayer(cChunk & a_Chunk)
ASSERT(Callback.GetPlayer() != nullptr);
if (!CheckLight())
{
// Insufficient light for enderman to become aggravated
// TODO: Teleport to a suitable location
return;
}
if (!Callback.GetPlayer()->CanMobsTarget())
{
return;
@ -139,10 +132,7 @@ void cEnderman::CheckEventSeePlayer(cChunk & a_Chunk)
void cEnderman::CheckEventLostPlayer(void)
{
super::CheckEventLostPlayer();
if (!CheckLight())
{
EventLosePlayer();
}
EventLosePlayer();
}
@ -160,31 +150,6 @@ void cEnderman::EventLosePlayer()
bool cEnderman::CheckLight()
{
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 true;
}
// Enderman only attack if the skylight is lower or equal to 8
if (m_World->GetBlockSkyLight(POSX_TOINT, POSY_TOINT, POSZ_TOINT) - GetWorld()->GetSkyDarkness() > 8)
{
return false;
}
return true;
}
void cEnderman::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);