summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Spider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Spider.cpp')
-rw-r--r--src/Mobs/Spider.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp
index 845bc145b..0a824aca2 100644
--- a/src/Mobs/Spider.cpp
+++ b/src/Mobs/Spider.cpp
@@ -7,10 +7,26 @@
#include "../Entities/Player.h"
#include "../Chunk.h"
-bool AggressiveAtNightFunction(cBehaviorAggressive & a_Behavior, cMonster & a_Monster)
+bool AggressiveAtNightFunction(cBehaviorAggressive & a_Behavior, cMonster & a_Monster, cChunk & a_Chunk)
{
- return
- !((Chunk->GetSkyLightAltered(Rel.x, Rel.y, Rel.z) > 11) || (Chunk->GetBlockLight(Rel.x, Rel.y, Rel.z) > 11))
+ UNUSED(a_Behavior);
+ if (!a_Monster.GetWorld()->IsChunkLighted(a_Monster.GetChunkX(), a_Monster.GetChunkZ()))
+ {
+ return false;
+ }
+
+ PREPARE_REL_AND_CHUNK(a_Monster.GetPosition(), a_Chunk);
+ if (!RelSuccess)
+ {
+ return false;
+ }
+
+ if (
+ !((Chunk->GetSkyLightAltered(Rel.x, Rel.y, Rel.z) > 11) || (Chunk->GetBlockLight(Rel.x, Rel.y, Rel.z) > 11))
+ )
+ {
+ return true;
+ }
}
cSpider::cSpider(void) :