Allow enderman to attack during day (#4522)
This commit is contained in:
parent
0d444b62c9
commit
038194d2a6
@ -113,13 +113,6 @@ void cEnderman::CheckEventSeePlayer(cChunk & a_Chunk)
|
|||||||
|
|
||||||
ASSERT(Callback.GetPlayer() != nullptr);
|
ASSERT(Callback.GetPlayer() != nullptr);
|
||||||
|
|
||||||
if (!CheckLight())
|
|
||||||
{
|
|
||||||
// Insufficient light for enderman to become aggravated
|
|
||||||
// TODO: Teleport to a suitable location
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Callback.GetPlayer()->CanMobsTarget())
|
if (!Callback.GetPlayer()->CanMobsTarget())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -139,10 +132,7 @@ void cEnderman::CheckEventSeePlayer(cChunk & a_Chunk)
|
|||||||
void cEnderman::CheckEventLostPlayer(void)
|
void cEnderman::CheckEventLostPlayer(void)
|
||||||
{
|
{
|
||||||
super::CheckEventLostPlayer();
|
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)
|
void cEnderman::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||||
{
|
{
|
||||||
super::Tick(a_Dt, a_Chunk);
|
super::Tick(a_Dt, a_Chunk);
|
||||||
|
Loading…
Reference in New Issue
Block a user